[FREELDR]

Cleanup headers

svn path=/trunk/; revision=53881
This commit is contained in:
Timo Kreuzer 2011-09-28 09:54:05 +00:00
parent 885910a88e
commit 17d1b0cdea
7 changed files with 43 additions and 141 deletions

View file

@ -19,6 +19,9 @@
#include <freeldr.h>
void sound(int freq);
void delay(unsigned msec);
void PcBeep(void)
{
sound(700);

View file

@ -338,16 +338,14 @@ void WinLdrSetupSpecialDataPointers()
{
*ExtendedBIOSDataArea = BiosRegs.w.es << 4;
*ExtendedBIOSDataSize = 1024;
ERR(">> *ExtendedBIOSDataArea = 0x%lx\n", *ExtendedBIOSDataArea);
TRACE("*ExtendedBIOSDataArea = 0x%lx\n", *ExtendedBIOSDataArea);
}
else
{
ERR("Couldn't get address of extended BIOS data area\n");
WARN("Couldn't get address of extended BIOS data area\n");
*ExtendedBIOSDataArea = 0;
*ExtendedBIOSDataSize = 0;
}
/* Store size of the extended bios data area in 0x740 */
}
void WinLdrSetupMachineDependent(PLOADER_PARAMETER_BLOCK LoaderBlock)

View file

@ -56,6 +56,8 @@ PVOID KernelMemory = 0;
#define KernelMemorySize (8 * 1024 * 1024)
#define XROUNDUP(x,n) ((((ULONG)x) + ((n) - 1)) & (~((n) - 1)))
char reactos_module_strings[64][256]; // Array to hold module names
/* Load Address of Next Module */
ULONG_PTR NextModuleBase = 0;
@ -178,7 +180,7 @@ FrLdrAddPageMapping(ppc_map_set_t *set, int proc, paddr_t phys, vaddr_t virt)
set->info = newinfo;
set->mapsize *= 2;
}
set->info[set->usecount].flags = MMU_ALL_RW;
set->info[set->usecount].proc = proc;
set->info[set->usecount].addr = virt;
@ -208,7 +210,7 @@ FrLdrStartup(ULONG Magic)
while(OldModCount != LoaderBlock.ModsCount)
{
printf("Added %d modules last pass\n",
printf("Added %d modules last pass\n",
LoaderBlock.ModsCount - OldModCount);
OldModCount = LoaderBlock.ModsCount;
@ -224,7 +226,7 @@ FrLdrStartup(ULONG Magic)
((PVOID)reactos_modules[i].ModStart,
(PCHAR)reactos_modules[i].String);
}
}
}
}
printf("Starting mmu\n");
@ -233,7 +235,7 @@ FrLdrStartup(ULONG Magic)
printf("Allocating vsid 0 (kernel)\n");
MmuAllocVsid(0, 0xff00);
/* We'll use vsid 1 for freeldr (expendable) */
printf("Allocating vsid 1 (freeldr)\n");
MmuAllocVsid(1, 0xff);
@ -247,7 +249,7 @@ FrLdrStartup(ULONG Magic)
i += (1<<PFN_SHIFT) ) {
FrLdrAddPageMapping(&memmap, 1, i, 0);
}
printf("KernelBase %x\n", KernelBase);
/* Heap pages -- this gets the entire freeldr heap */
@ -255,7 +257,7 @@ FrLdrStartup(ULONG Magic)
tmp = i<<PFN_SHIFT;
if (FreeLdrMap[i].PageAllocated == LoaderSystemCode) {
UsedEntries++;
if (tmp >= (ULONG)KernelMemory &&
if (tmp >= (ULONG)KernelMemory &&
tmp < (ULONG)KernelMemory + KernelMemorySize) {
FrLdrAddPageMapping(&memmap, 0, tmp, KernelBase + tmp - (ULONG)KernelMemory);
} else {
@ -721,7 +723,7 @@ FrLdrLoadModule(FILE *ModuleImage,
} while(TempName);
NameBuffer = reactos_module_strings[LoaderBlock.ModsCount];
/* Get Module Size */
LocalModuleSize = FsGetFileSize(ModuleImage);
@ -773,7 +775,7 @@ FrLdrMapImage(IN FILE *Image, IN PCHAR ShortName, IN ULONG ImageType)
PVOID ModuleBase = (PVOID)NextModuleBase;
if(FrLdrMapModule(Image, ShortName, 0, 0))
Result = ModuleBase;
Result = ModuleBase;
}
return Result;
}

View file

@ -24,6 +24,32 @@
#undef KIP0PCRADDRESS
#define KIP0PCRADDRESS 0xffdff000
/* Bits to shift to convert a Virtual Address into an Offset in the Page Table */
#define PFN_SHIFT 12
/* Bits to shift to convert a Virtual Address into an Offset in the Page Directory */
#define PDE_SHIFT 22
#define PDE_SHIFT_PAE 18
/* Converts a Physical Address Pointer into a Page Frame Number */
#define PaPtrToPfn(p) \
(((ULONG_PTR)&p) >> PFN_SHIFT)
/* Converts a Physical Address into a Page Frame Number */
#define PaToPfn(p) \
((p) >> PFN_SHIFT)
#define STARTUP_BASE 0xC0000000
#define LowMemPageTableIndex 0
#define StartupPageTableIndex (STARTUP_BASE >> 22)
#define HalPageTableIndex (HAL_BASE >> 22)
typedef struct _PAGE_DIRECTORY_X86
{
HARDWARE_PTE Pde[1024];
} PAGE_DIRECTORY_X86, *PPAGE_DIRECTORY_X86;
void i386DivideByZero(void);
void i386DebugException(void);
void i386NMIException(void);

View file

@ -45,8 +45,6 @@
#include <stdlib.h>
#include <stdio.h>
#include <ctype.h>
#include <rosldr.h>
#include <rtl.h>
#include <ntdddisk.h>
#include <internal/hal.h>
#include <drivers/pci/pci.h>
@ -55,8 +53,8 @@
/* internal headers */
#include <arcemul.h>
#include <bytesex.h>
#include <bget.h>
#include <bytesex.h>
#include <cache.h>
#include <cmdline.h>
#include <comm.h>

View file

@ -19,53 +19,6 @@
#pragma once
/* Base Addres of Kernel in Physical Memory */
#define KERNEL_BASE_PHYS 0x800000
#if defined(_M_IX86)
/* Bits to shift to convert a Virtual Address into an Offset in the Page Table */
#define PFN_SHIFT 12
/* Bits to shift to convert a Virtual Address into an Offset in the Page Directory */
#define PDE_SHIFT 22
#define PDE_SHIFT_PAE 18
/* Converts a Physical Address Pointer into a Page Frame Number */
#define PaPtrToPfn(p) \
(((ULONG_PTR)&p) >> PFN_SHIFT)
/* Converts a Physical Address into a Page Frame Number */
#define PaToPfn(p) \
((p) >> PFN_SHIFT)
#define STARTUP_BASE 0xC0000000
#define LowMemPageTableIndex 0
#define StartupPageTableIndex (STARTUP_BASE >> 22)
#define HalPageTableIndex (HAL_BASE >> 22)
typedef struct _PAGE_DIRECTORY_X86
{
HARDWARE_PTE Pde[1024];
} PAGE_DIRECTORY_X86, *PPAGE_DIRECTORY_X86;
#endif
///////////////////////////////////////////////////////////////////////////////////////
//
// ReactOS Loading Functions
//
///////////////////////////////////////////////////////////////////////////////////////
VOID LoadAndBootReactOS(PCSTR OperatingSystemName);
///////////////////////////////////////////////////////////////////////////////////////
//
// ReactOS Setup Loader Functions
//
///////////////////////////////////////////////////////////////////////////////////////
VOID ReactOSRunSetupLoader(VOID);
///////////////////////////////////////////////////////////////////////////////////////
//
// ARC Path Functions
@ -83,53 +36,4 @@ BOOLEAN DissectArcPath(CHAR *ArcPath, CHAR *BootPath, UCHAR* BootDrive, ULONG* B
VOID ConstructArcPath(PCHAR ArcPath, PCHAR SystemFolder, UCHAR Disk, ULONG Partition);
UCHAR ConvertArcNameToBiosDriveNumber(PCHAR ArcPath);
///////////////////////////////////////////////////////////////////////////////////////
//
// Loader Functions And Definitions
//
///////////////////////////////////////////////////////////////////////////////////////
extern ROS_LOADER_PARAMETER_BLOCK LoaderBlock; /* Multiboot info structure passed to kernel */
extern char reactos_kernel_cmdline[255]; // Command line passed to kernel
extern LOADER_MODULE reactos_modules[64]; // Array to hold boot module info loaded for the kernel
extern char reactos_module_strings[64][256]; // Array to hold module names
typedef struct _reactos_mem_data {
unsigned long memory_map_descriptor_size;
memory_map_t memory_map[32]; // Memory map
} reactos_mem_data_t;
extern reactos_mem_data_t reactos_mem_data;
#define reactos_memory_map_descriptor_size reactos_mem_data.memory_map_descriptor_size
#define reactos_memory_map reactos_mem_data.memory_map
VOID FASTCALL FrLdrSetupPae(ULONG Magic);
VOID FASTCALL FrLdrSetupPageDirectory(VOID);
VOID FASTCALL FrLdrGetPaeMode(VOID);
BOOLEAN NTAPI FrLdrMapKernel(PFILE KernelImage);
ULONG_PTR NTAPI FrLdrCreateModule(LPCSTR ModuleName);
ULONG_PTR NTAPI FrLdrLoadModule(PFILE ModuleImage, LPCSTR ModuleName, PULONG ModuleSize);
BOOLEAN NTAPI FrLdrCloseModule(ULONG_PTR ModuleBase, ULONG dwModuleSize);
VOID NTAPI FrLdrStartup(ULONG Magic);
typedef VOID (NTAPI *ROS_KERNEL_ENTRY_POINT)(IN PROS_LOADER_PARAMETER_BLOCK LoaderBlock);
PVOID
NTAPI
FrLdrMapImage(
IN PFILE Image,
IN PCHAR ShortName,
IN ULONG ImageType
);
PVOID
NTAPI
FrLdrReadAndMapImage(
IN PFILE Image,
IN PCHAR ShortName,
IN ULONG ImageType
);
PVOID
NTAPI
FrLdrLoadImage(
IN PCHAR szFileName,
IN INT nPos,
IN ULONG ImageType
);
void PcBeep(void);

View file

@ -1,29 +0,0 @@
/*
* FreeLoader
* Copyright (C) 1998-2003 Brian Palmer <brianp@sginet.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along
* with this program; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
#pragma once
#include <freeldr.h>
char * convert_to_ascii(char *buf, int c, int num);
char * convert_i64_to_ascii(char *buf, int c, unsigned long long num);
void PcBeep(void);
void delay(unsigned msec);
void sound(int freq);