mirror of
https://github.com/reactos/reactos.git
synced 2025-02-24 17:34:57 +00:00
Fix memory map to kernel mode.
Allow prep serial in kdcom (and stop clobbering the data miss handler). Clean up boot mapping a bit. Silence some boot time spam. Enable not present page handler (yes, this routing actually works). Scan physical memory on the (virtually 100%) chance that open firmware will somehow have a buggy implementation of the memory object, or we're on prep hardware. Initialize syscall trap early, so we can do DbgPrint. svn path=/trunk/; revision=29928
This commit is contained in:
parent
3c9062ca96
commit
bc2e271c94
12 changed files with 167 additions and 115 deletions
|
@ -22,7 +22,9 @@
|
|||
|
||||
#define NDEBUG
|
||||
#include <debug.h>
|
||||
|
||||
#undef DbgPrint
|
||||
#define DbgPrint printf
|
||||
|
||||
extern PVOID KernelMemory;
|
||||
|
||||
|
@ -96,13 +98,11 @@ LdrPEGetExportByName(PVOID BaseAddress,
|
|||
BaseAddress = (PVOID)((ULONG_PTR)BaseAddress - KSEG0_BASE + (ULONG)KernelMemory);
|
||||
}
|
||||
|
||||
DbgPrint("Exports: RtlImageDirectoryEntryToData\n");
|
||||
ExportDir = (PIMAGE_EXPORT_DIRECTORY)
|
||||
RtlImageDirectoryEntryToData(BaseAddress,
|
||||
TRUE,
|
||||
IMAGE_DIRECTORY_ENTRY_EXPORT,
|
||||
&ExportDirSize);
|
||||
DbgPrint("RtlImageDirectoryEntryToData done\n");
|
||||
if (!ExportDir)
|
||||
{
|
||||
DbgPrint("LdrPEGetExportByName(): no export directory!\n");
|
||||
|
@ -202,7 +202,6 @@ LdrPEGetExportByName(PVOID BaseAddress,
|
|||
if ((ULONG_PTR)Function >= (ULONG_PTR)ExportDir &&
|
||||
(ULONG_PTR)Function < (ULONG_PTR)ExportDir + ExportDirSize)
|
||||
{
|
||||
DbgPrint("Forward: %s\n", (PCHAR)Function);
|
||||
Function = LdrPEFixupForward((PCHAR)Function);
|
||||
if (Function == NULL)
|
||||
{
|
||||
|
@ -323,16 +322,12 @@ LdrPEFixupImports(IN PVOID DllBase,
|
|||
PLOADER_MODULE ImportedModule;
|
||||
ULONG Size;
|
||||
|
||||
printf("Fixing up %x (%s)\n", DllBase, DllName);
|
||||
|
||||
/* Process each import module */
|
||||
DbgPrint("FixupImports: RtlImageDirectoryEntryToData\n");
|
||||
ImportModuleDirectory = (PIMAGE_IMPORT_DESCRIPTOR)
|
||||
RtlImageDirectoryEntryToData(DllBase,
|
||||
TRUE,
|
||||
IMAGE_DIRECTORY_ENTRY_IMPORT,
|
||||
&Size);
|
||||
DbgPrint("RtlImageDirectoryEntryToData done\n");
|
||||
while (ImportModuleDirectory && ImportModuleDirectory->Name)
|
||||
{
|
||||
/* Check to make sure that import lib is kernel */
|
||||
|
|
|
@ -301,6 +301,9 @@ VOID PpcInitializeMmu(int max_mem)
|
|||
}
|
||||
}
|
||||
|
||||
ULONG PpcPrepGetMemoryMap( PBIOS_MEMORY_MAP BiosMemoryMap,
|
||||
ULONG MaxMemoryMapSize );
|
||||
|
||||
/*
|
||||
* Get memory the proper openfirmware way
|
||||
*/
|
||||
|
@ -319,7 +322,7 @@ ULONG PpcGetMemoryMap( PBIOS_MEMORY_MAP BiosMemoryMap,
|
|||
printf("Returned data: %d\n", returned);
|
||||
if( returned == -1 ) {
|
||||
printf("getprop /memory[@reg] failed\n");
|
||||
return 0;
|
||||
return PpcPrepGetMemoryMap( BiosMemoryMap, MaxMemoryMapSize );
|
||||
}
|
||||
|
||||
for( i = 0; i < returned; i++ ) {
|
||||
|
@ -328,7 +331,7 @@ ULONG PpcGetMemoryMap( PBIOS_MEMORY_MAP BiosMemoryMap,
|
|||
printf("\n");
|
||||
|
||||
for( i = 0; i < returned / 2; i++ ) {
|
||||
BiosMemoryMap[slots].Type = 1/*MEMTYPE_USABLE*/;
|
||||
BiosMemoryMap[slots].Type = BiosMemoryUsable;
|
||||
BiosMemoryMap[slots].BaseAddress = memdata[i*2];
|
||||
BiosMemoryMap[slots].Length = memdata[i*2+1];
|
||||
printf("MemoryMap[%d] = (%x:%x)\n",
|
||||
|
|
|
@ -123,18 +123,59 @@ int MmuPageMiss(int trapCode, ppc_trap_frame_t *trap)
|
|||
while(1);
|
||||
}
|
||||
|
||||
typedef struct _ppc_map_set_t {
|
||||
int mapsize;
|
||||
int usecount;
|
||||
ppc_map_info_t *info;
|
||||
} ppc_map_set_t;
|
||||
|
||||
VOID
|
||||
NTAPI
|
||||
FrLdrAddPageMapping(ppc_map_set_t *set, int proc, paddr_t phys, vaddr_t virt)
|
||||
{
|
||||
int j;
|
||||
paddr_t page = ROUND_DOWN(phys, (1<<PFN_SHIFT));
|
||||
if (virt == 0)
|
||||
virt = page;
|
||||
else
|
||||
virt = ROUND_DOWN(virt, (1<<PFN_SHIFT));
|
||||
|
||||
for( j = 0; j < set->usecount; j++ )
|
||||
{
|
||||
if(set->info[j].addr == page) return;
|
||||
}
|
||||
|
||||
if (!set->mapsize)
|
||||
{
|
||||
set->mapsize = 0x80;
|
||||
set->info = MmAllocateMemory(0x80 * sizeof(*set->info));
|
||||
}
|
||||
else if (set->mapsize <= set->usecount)
|
||||
{
|
||||
ppc_map_info_t *newinfo = MmAllocateMemory(set->mapsize * 2 * sizeof(*set->info));
|
||||
memcpy(newinfo, set->info, set->mapsize * sizeof(*set->info));
|
||||
MmFreeMemory(set->info);
|
||||
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;
|
||||
set->info[set->usecount].phys = page;
|
||||
set->usecount++;
|
||||
}
|
||||
|
||||
VOID
|
||||
NTAPI
|
||||
FrLdrStartup(ULONG Magic)
|
||||
{
|
||||
ULONG_PTR i, j, page, count;
|
||||
ULONG_PTR i, tmp;
|
||||
PCHAR ModHeader;
|
||||
boot_infos_t *LocalBootInfo = &BootInfo;
|
||||
LocalBootInfo->dispFont = (font_char *)&LocalBootInfo[1];
|
||||
LoaderBlock.ArchExtra = (ULONG)LocalBootInfo;
|
||||
ppc_map_info_t *info = MmAllocateMemory(0x80 * sizeof(*info));
|
||||
|
||||
printf("FrLdrStartup(KernelEntry = %x)\n", KernelEntryPoint);
|
||||
ppc_map_set_t memmap = { };
|
||||
|
||||
for(i = 0; i < LoaderBlock.ModsCount; i++)
|
||||
{
|
||||
|
@ -145,85 +186,52 @@ FrLdrStartup(ULONG Magic)
|
|||
(PCHAR)reactos_modules[i].String);
|
||||
}
|
||||
|
||||
printf("PpcInitializeMmu\n");
|
||||
/* We don't use long longs, but longs for the addresses in the
|
||||
* ADDRESS_RANGE structure. Swap the quad halves of our memory
|
||||
* map.
|
||||
*/
|
||||
for( i = 0;
|
||||
i < reactos_memory_map_descriptor_size / sizeof(reactos_memory_map[0]);
|
||||
i++ )
|
||||
{
|
||||
tmp = reactos_memory_map[i].base_addr_high;
|
||||
reactos_memory_map[i].base_addr_high = reactos_memory_map[i].base_addr_low;
|
||||
reactos_memory_map[i].base_addr_low = tmp;
|
||||
tmp = reactos_memory_map[i].length_high;
|
||||
reactos_memory_map[i].length_high = reactos_memory_map[i].length_low;
|
||||
reactos_memory_map[i].length_low = tmp;
|
||||
}
|
||||
|
||||
PpcInitializeMmu(0);
|
||||
printf("PpcInitializeMmu done\n");
|
||||
|
||||
/* We'll use vsid 1 for freeldr (expendable) */
|
||||
MmuAllocVsid(1, 0xff);
|
||||
printf("(1)\n");
|
||||
MmuSetVsid(0, 8, 1);
|
||||
printf("(2)\n");
|
||||
|
||||
MmuAllocVsid(0, 0xff00);
|
||||
printf("(3)\n");
|
||||
MmuSetVsid(8, 16, 0);
|
||||
printf("(4)\n");
|
||||
|
||||
printf("MmuSetTrapHandler\n");
|
||||
MmuSetTrapHandler(3, MmuPageMiss);
|
||||
MmuSetTrapHandler(4, MmuPageMiss);
|
||||
printf("MmuSetTrapHandler done\n");
|
||||
|
||||
info = MmAllocateMemory((KernelMemorySize >> PAGE_SHIFT) * sizeof(*info));
|
||||
printf("page info at %x\n", info);
|
||||
|
||||
/* Map kernel space 0x80000000 ... */
|
||||
for( i = (ULONG)KernelMemory, page = 0;
|
||||
for( i = (ULONG)KernelMemory;
|
||||
i < (ULONG)KernelMemory + KernelMemorySize;
|
||||
i += (1<<PFN_SHIFT), page++ ) {
|
||||
info[page].proc = 0;
|
||||
info[page].addr = KernelBase + (page << PAGE_SHIFT);
|
||||
info[page].phys = i; //PpcVirt2phys(i, 1);
|
||||
info[page].flags = MMU_ALL_RW;
|
||||
}
|
||||
i += (1<<PFN_SHIFT) ) {
|
||||
|
||||
printf("Adding page info (%d pages)\n", page);
|
||||
MmuMapPage(info, page);
|
||||
printf("Adding page info (%d pages) ... done\n", page);
|
||||
FrLdrAddPageMapping(&memmap, 0, i, KernelBase + i - (ULONG)KernelMemory);
|
||||
}
|
||||
|
||||
/* Map module name strings */
|
||||
for( count = 0, i = 0; i < LoaderBlock.ModsCount; i++ )
|
||||
for( i = 0; i < LoaderBlock.ModsCount; i++ )
|
||||
{
|
||||
printf("Checking string %s\n", reactos_modules[i].String);
|
||||
page = ROUND_DOWN(((ULONG)reactos_modules[i].String), (1<<PFN_SHIFT));
|
||||
for( j = 0; j < count; j++ )
|
||||
{
|
||||
if(info[j].addr == page) break;
|
||||
}
|
||||
if( j != count )
|
||||
{
|
||||
printf("Mapping page %x containing string %s\n",
|
||||
page, reactos_modules[i].String);
|
||||
info[count].flags = MMU_ALL_RW;
|
||||
info[count].proc = 1;
|
||||
info[count].addr = page;
|
||||
info[count].phys = page; // PpcVirt2phys(page, 0);
|
||||
count++;
|
||||
}
|
||||
FrLdrAddPageMapping(&memmap, 1, (ULONG)reactos_modules[i].String, 0);
|
||||
}
|
||||
|
||||
page = ROUND_DOWN((vaddr_t)&LoaderBlock, (1 << PAGE_SHIFT));
|
||||
for( j = 0; j < count; j++ )
|
||||
{
|
||||
if(info[j].addr == page) break;
|
||||
}
|
||||
/* Map memory zones */
|
||||
FrLdrAddPageMapping(&memmap, 1, (vaddr_t)&reactos_memory_map_descriptor_size, 0);
|
||||
FrLdrAddPageMapping(&memmap, 1, (vaddr_t)&LoaderBlock, 0);
|
||||
|
||||
if( j != count )
|
||||
{
|
||||
info[count].flags = MMU_ALL_RW;
|
||||
info[count].proc = 1;
|
||||
info[count].addr = page;
|
||||
info[count].phys = page; // PpcVirt2phys(page, 0);
|
||||
count++;
|
||||
}
|
||||
printf("Mapping module name strings\n");
|
||||
MmuMapPage(info, count);
|
||||
printf("Module name strings mapped\n");
|
||||
MmuMapPage(memmap.info, memmap.usecount);
|
||||
|
||||
printf("MmuTurnOn(KernelEntry = %x)\n", KernelEntryPoint);
|
||||
MmuTurnOn((KernelEntryFn)KernelEntryPoint, (void*)&LoaderBlock);
|
||||
printf("MAED OF FALE!!1\n");
|
||||
|
||||
/* Nothing more */
|
||||
while(1);
|
||||
|
@ -393,7 +401,7 @@ FrLdrMapModule(FILE *KernelImage, PCHAR ImageName, PCHAR MemLoadAddr, ULONG Kern
|
|||
MemLoadAddr = (PCHAR)NextModuleBase;
|
||||
|
||||
ModuleData = &reactos_modules[LoaderBlock.ModsCount];
|
||||
printf("Loading file (elf at %x)\n", KernelAddr);
|
||||
//printf("Loading file (elf at %x)\n", KernelAddr);
|
||||
|
||||
/* Load the first 1024 bytes of the kernel image so we can read the PE header */
|
||||
if (!FsReadFile(KernelImage, sizeof(ehdr), NULL, &ehdr)) {
|
||||
|
@ -414,8 +422,6 @@ FrLdrMapModule(FILE *KernelImage, PCHAR ImageName, PCHAR MemLoadAddr, ULONG Kern
|
|||
FsSetFilePointer(KernelImage, ehdr.e_shoff);
|
||||
FsReadFile(KernelImage, shsize * shnum, NULL, sptr);
|
||||
|
||||
printf("Loaded section headers\n");
|
||||
|
||||
/* Now we'll get the PE Header */
|
||||
for( i = 0; i < shnum; i++ )
|
||||
{
|
||||
|
@ -429,12 +435,14 @@ FrLdrMapModule(FILE *KernelImage, PCHAR ImageName, PCHAR MemLoadAddr, ULONG Kern
|
|||
FsReadFile(KernelImage, shdr->sh_size, NULL, MemLoadAddr);
|
||||
ImageHeader = (PIMAGE_DOS_HEADER)MemLoadAddr;
|
||||
NtHeader = (PIMAGE_NT_HEADERS)((PCHAR)MemLoadAddr + SWAPD(ImageHeader->e_lfanew));
|
||||
#if 0
|
||||
printf("NtHeader at %x\n", SWAPD(ImageHeader->e_lfanew));
|
||||
printf("SectionAlignment %x\n",
|
||||
SWAPD(NtHeader->OptionalHeader.SectionAlignment));
|
||||
SectionAddr = ROUND_UP
|
||||
(shdr->sh_size, SWAPD(NtHeader->OptionalHeader.SectionAlignment));
|
||||
printf("Header ends at %x\n", SectionAddr);
|
||||
#endif
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -444,10 +452,12 @@ FrLdrMapModule(FILE *KernelImage, PCHAR ImageName, PCHAR MemLoadAddr, ULONG Kern
|
|||
printf("No peheader section encountered :-(\n");
|
||||
return 0;
|
||||
}
|
||||
#if 0
|
||||
else
|
||||
{
|
||||
printf("DOS SIG: %s\n", (PCHAR)MemLoadAddr);
|
||||
}
|
||||
#endif
|
||||
|
||||
/* Save the Image Base */
|
||||
NtHeader->OptionalHeader.ImageBase = SWAPD(KernelAddr);
|
||||
|
@ -456,8 +466,6 @@ FrLdrMapModule(FILE *KernelImage, PCHAR ImageName, PCHAR MemLoadAddr, ULONG Kern
|
|||
Section = COFF_FIRST_SECTION(NtHeader);
|
||||
SectionCount = SWAPW(NtHeader->FileHeader.NumberOfSections);
|
||||
|
||||
printf("Section headers at %x\n", Section);
|
||||
|
||||
/* Walk each section */
|
||||
for (i=0; i < SectionCount; i++, Section++)
|
||||
{
|
||||
|
@ -603,11 +611,13 @@ FrLdrMapModule(FILE *KernelImage, PCHAR ImageName, PCHAR MemLoadAddr, ULONG Kern
|
|||
ModuleData->ModEnd = NextModuleBase;
|
||||
ModuleData->String = (ULONG)MmAllocateMemory(strlen(ImageName)+1);
|
||||
strcpy((PCHAR)ModuleData->String, ImageName);
|
||||
#if 0
|
||||
printf("Module %s (%x-%x) next at %x\n",
|
||||
ModuleData->String,
|
||||
ModuleData->ModStart,
|
||||
ModuleData->ModEnd,
|
||||
NextModuleBase);
|
||||
#endif
|
||||
LoaderBlock.ModsCount++;
|
||||
|
||||
/* Return Success */
|
||||
|
@ -640,7 +650,6 @@ FrLdrMapKernel(FILE *KernelImage)
|
|||
|
||||
/* Allocate kernel memory */
|
||||
KernelMemory = MmAllocateMemory(KernelMemorySize);
|
||||
printf("Kernel Memory @%x\n", (int)KernelMemory);
|
||||
|
||||
return FrLdrMapModule(KernelImage, "ntoskrnl.exe", KernelMemory, KernelBase);
|
||||
}
|
||||
|
@ -679,11 +688,6 @@ FrLdrLoadModule(FILE *ModuleImage,
|
|||
ModuleData->ModStart = NextModuleBase;
|
||||
ModuleData->ModEnd = NextModuleBase + LocalModuleSize;
|
||||
|
||||
printf("Module size %x len %x name %s\n",
|
||||
ModuleData->ModStart,
|
||||
ModuleData->ModEnd - ModuleData->ModStart,
|
||||
ModuleName);
|
||||
|
||||
/* Save name */
|
||||
strcpy(NameBuffer, ModuleName);
|
||||
ModuleData->String = (ULONG_PTR)NameBuffer;
|
||||
|
|
|
@ -71,10 +71,36 @@ VOID PpcInitializeMmu(int max);
|
|||
ULONG PpcPrepGetMemoryMap( PBIOS_MEMORY_MAP BiosMemoryMap,
|
||||
ULONG MaxMemoryMapSize )
|
||||
{
|
||||
// xxx fixme
|
||||
BiosMemoryMap[0].Type = 1;
|
||||
BiosMemoryMap[0].BaseAddress = 0xe80000;
|
||||
BiosMemoryMap[0].Length = (64 * 1024 * 1024) - BiosMemoryMap[0].BaseAddress;
|
||||
// Probe memory
|
||||
paddr_t physAddr;
|
||||
register int oldStore = 0, newStore = 0, change = 0, oldmsr;
|
||||
|
||||
__asm__("mfmsr %0\n" : "=r" (oldmsr));
|
||||
change = oldmsr & 0x6fff;
|
||||
__asm__("mtmsr %0\n" : : "r" (change));
|
||||
|
||||
// Find the last ram address in physical space ... this bypasses mapping
|
||||
// but could run into non-ram objects right above ram. Usually systems
|
||||
// aren't designed like that though.
|
||||
for (physAddr = 0x30000, change = newStore;
|
||||
(physAddr < 0x80000000) && (change == newStore);
|
||||
physAddr += 1 << 12)
|
||||
{
|
||||
oldStore = GetPhys(physAddr);
|
||||
newStore = (physAddr & 0x1000) ? 0x55aa55aa : 0xaa55aa55;
|
||||
SetPhys(physAddr, newStore);
|
||||
change = GetPhys(physAddr);
|
||||
SetPhys(physAddr, oldStore);
|
||||
}
|
||||
// Back off by one page
|
||||
physAddr -= 0x1000;
|
||||
BiosMemoryMap[0].BaseAddress = 0x30000; // End of ppcmmu
|
||||
BiosMemoryMap[0].Type = BiosMemoryUsable;
|
||||
BiosMemoryMap[0].Length = physAddr - BiosMemoryMap[0].BaseAddress;
|
||||
|
||||
__asm__("mtmsr %0\n" : : "r" (oldmsr));
|
||||
|
||||
printf("Actual RAM: %d Mb\n", physAddr >> 20);
|
||||
PpcInitializeMmu(BiosMemoryMap[0].BaseAddress + BiosMemoryMap[0].Length);
|
||||
return 1;
|
||||
}
|
||||
|
|
|
@ -84,8 +84,13 @@ extern ROS_LOADER_PARAMETER_BLOCK LoaderBlock; /* Multiboot info structure passe
|
|||
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
|
||||
extern unsigned long reactos_memory_map_descriptor_size;
|
||||
extern memory_map_t reactos_memory_map[32]; // Memory map
|
||||
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);
|
||||
|
|
|
@ -29,8 +29,9 @@ ROS_LOADER_PARAMETER_BLOCK LoaderBlock;
|
|||
char reactos_kernel_cmdline[255]; // Command line passed to kernel
|
||||
LOADER_MODULE reactos_modules[64]; // Array to hold boot module info loaded for the kernel
|
||||
char reactos_module_strings[64][256]; // Array to hold module names
|
||||
unsigned long reactos_memory_map_descriptor_size;
|
||||
memory_map_t reactos_memory_map[32]; // Memory map
|
||||
// Make this a single struct to guarantee that these elements are nearby in
|
||||
// memory.
|
||||
reactos_mem_data_t reactos_mem_data;
|
||||
ARC_DISK_SIGNATURE reactos_arc_disk_info[32]; // ARC Disk Information
|
||||
char reactos_arc_strings[32][256];
|
||||
unsigned long reactos_disk_count = 0;
|
||||
|
@ -409,7 +410,7 @@ FrLdrLoadBootDrivers(PCHAR szSystemRoot,
|
|||
if (rc != ERROR_SUCCESS) OrderList[0] = 0;
|
||||
|
||||
/* enumerate all drivers */
|
||||
for (TagIndex = 1; TagIndex <= OrderList[0]; TagIndex++) {
|
||||
for (TagIndex = 1; TagIndex <= SWAPD(OrderList[0]); TagIndex++) {
|
||||
|
||||
Index = 0;
|
||||
|
||||
|
@ -603,10 +604,13 @@ LoadAndBootReactOS(PCSTR OperatingSystemName)
|
|||
LoaderBlock.MmapLength = (unsigned long)MachGetMemoryMap((PBIOS_MEMORY_MAP)reactos_memory_map, 32) * sizeof(memory_map_t);
|
||||
if (LoaderBlock.MmapLength)
|
||||
{
|
||||
#ifdef _M_IX86
|
||||
ULONG i;
|
||||
#endif
|
||||
LoaderBlock.Flags |= MB_FLAGS_MEM_INFO | MB_FLAGS_MMAP_INFO;
|
||||
LoaderBlock.MmapAddr = (unsigned long)&reactos_memory_map;
|
||||
reactos_memory_map_descriptor_size = sizeof(memory_map_t); // GetBiosMemoryMap uses a fixed value of 24
|
||||
#ifdef _M_IX86
|
||||
for (i=0; i<(LoaderBlock.MmapLength/sizeof(memory_map_t)); i++)
|
||||
{
|
||||
if (BiosMemoryUsable == reactos_memory_map[i].type &&
|
||||
|
@ -625,6 +629,7 @@ LoadAndBootReactOS(PCSTR OperatingSystemName)
|
|||
LoaderBlock.MemHigher = (reactos_memory_map[i].base_addr_low + reactos_memory_map[i].length_low) / 1024 - 1024;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -761,10 +766,13 @@ LoadAndBootReactOS(PCSTR OperatingSystemName)
|
|||
LoadBase = FrLdrLoadImage(szKernelName, 5, 1);
|
||||
if (!LoadBase) return;
|
||||
|
||||
printf("Kernel loaded at %x\n", LoadBase);
|
||||
|
||||
/* Get the NT header, kernel base and kernel entry */
|
||||
NtHeader = RtlImageNtHeader(LoadBase);
|
||||
KernelBase = NtHeader->OptionalHeader.ImageBase;
|
||||
KernelEntryPoint = KernelBase + NtHeader->OptionalHeader.AddressOfEntryPoint;
|
||||
KernelBase = SWAPD(NtHeader->OptionalHeader.ImageBase);
|
||||
KernelEntryPoint = KernelBase + SWAPD(NtHeader->OptionalHeader.AddressOfEntryPoint);
|
||||
printf("KernelEntryPoint is %x (base %x)\n", KernelEntryPoint, KernelBase);
|
||||
LoaderBlock.KernelBase = KernelBase;
|
||||
|
||||
/*
|
||||
|
@ -836,14 +844,18 @@ LoadAndBootReactOS(PCSTR OperatingSystemName)
|
|||
/*
|
||||
* Load boot drivers
|
||||
*/
|
||||
printf("FrLdrLoadBootDrivers\n");
|
||||
FrLdrLoadBootDrivers(szBootPath, 40);
|
||||
printf("FrLdrLoadBootDrivers end\n");
|
||||
//UiUnInitialize("Booting ReactOS...");
|
||||
|
||||
/*
|
||||
* Now boot the kernel
|
||||
*/
|
||||
DiskStopFloppyMotor();
|
||||
printf("MachVideoPrepareForReactOS\n");
|
||||
MachVideoPrepareForReactOS(FALSE);
|
||||
printf("FrLdrStartup\n");
|
||||
FrLdrStartup(0x2badb002);
|
||||
}
|
||||
|
||||
|
|
|
@ -29,8 +29,7 @@ ROS_LOADER_PARAMETER_BLOCK LoaderBlock;
|
|||
char reactos_kernel_cmdline[255]; // Command line passed to kernel
|
||||
LOADER_MODULE reactos_modules[64]; // Array to hold boot module info loaded for the kernel
|
||||
char reactos_module_strings[64][256]; // Array to hold module names
|
||||
unsigned long reactos_memory_map_descriptor_size;
|
||||
memory_map_t reactos_memory_map[32]; // Memory map
|
||||
reactos_mem_data_t reactos_mem_data;
|
||||
char szBootPath[256];
|
||||
char szHalName[256];
|
||||
CHAR SystemRoot[255];
|
||||
|
|
|
@ -294,8 +294,12 @@ KdPortInitializeEx (
|
|||
ULONG Unknown2
|
||||
)
|
||||
{
|
||||
#ifdef _M_IX86
|
||||
ULONG BaseArray[5] = {0, 0x3F8, 0x2F8, 0x3E8, 0x2E8};
|
||||
PUCHAR ComPortBase;
|
||||
#elif defined(_M_PPC)
|
||||
ULONG BaseArray[5] = {0, 0x800003f8};
|
||||
#endif
|
||||
PUCHAR ComPortBase;
|
||||
char buffer[80];
|
||||
ULONG divisor;
|
||||
UCHAR lcr;
|
||||
|
|
|
@ -1180,6 +1180,10 @@ KiRosFrldrLpbToNtLpb(IN PROS_LOADER_PARAMETER_BLOCK RosLoaderBlock,
|
|||
}
|
||||
}
|
||||
|
||||
VOID
|
||||
NTAPI
|
||||
KiSetupSyscallHandler();
|
||||
|
||||
VOID
|
||||
FASTCALL
|
||||
KiRosPrepareForSystemStartup(IN ULONG Dummy,
|
||||
|
@ -1206,6 +1210,10 @@ KiRosPrepareForSystemStartup(IN ULONG Dummy,
|
|||
TssEntry->HighWord.Bytes.BaseHi = (UCHAR)((ULONG_PTR)Tss >> 24);
|
||||
#endif
|
||||
|
||||
#if defined(_M_PPC)
|
||||
KiSetupSyscallHandler();
|
||||
#endif
|
||||
|
||||
/* Save pointer to ROS Block */
|
||||
KeRosLoaderBlock = LoaderBlock;
|
||||
MmFreeLdrLastKernelAddress = PAGE_ROUND_UP(KeRosLoaderBlock->
|
||||
|
|
|
@ -226,7 +226,7 @@ NTAPI
|
|||
KiSystemStartup(IN PLOADER_PARAMETER_BLOCK LoaderBlock)
|
||||
{
|
||||
ULONG Cpu;
|
||||
ppc_map_info_t info[3];
|
||||
ppc_map_info_t info[4];
|
||||
PKIPCR Pcr = (PKIPCR)KPCR_BASE;
|
||||
PKPRCB Prcb;
|
||||
|
||||
|
@ -259,7 +259,11 @@ KiSystemStartup(IN PLOADER_PARAMETER_BLOCK LoaderBlock)
|
|||
info[2].proc = 2;
|
||||
info[2].addr = (vaddr_t)KI_USER_SHARED_DATA;
|
||||
info[2].flags = MMU_KRW_UR;
|
||||
MmuMapPage(info, 3);
|
||||
info[3].phys = 0;
|
||||
info[3].proc = 2;
|
||||
info[3].addr = (vaddr_t)KIP0PCRADDRESS;
|
||||
info[3].flags = MMU_KRW_UR;
|
||||
MmuMapPage(info, 4);
|
||||
}
|
||||
|
||||
/* Skip initial setup if this isn't the Boot CPU */
|
||||
|
|
|
@ -17,6 +17,11 @@
|
|||
|
||||
/* EXTERNS *******************************************************************/
|
||||
|
||||
NTSTATUS
|
||||
NTAPI
|
||||
MmNotPresentFault(KPROCESSOR_MODE Mode,
|
||||
ULONG_PTR Address,
|
||||
BOOLEAN FromMdl);
|
||||
extern ULONG KiKernelTrapHandler(PKTRAP_FRAME Tf, ULONG ExceptionNr, PVOID Cr2);
|
||||
|
||||
/* FUNCTIONS *****************************************************************/
|
||||
|
@ -61,8 +66,7 @@ int KiPageFaultHandler(int trap, ppc_trap_frame_t *frame)
|
|||
}
|
||||
else
|
||||
{
|
||||
KeBugCheck(0);
|
||||
//Status = MmNotPresentFault(Mode, (PVOID)VirtualAddr, FALSE, TrapInfo);
|
||||
Status = MmNotPresentFault(Mode, VirtualAddr, FALSE);
|
||||
}
|
||||
|
||||
if (NT_SUCCESS(Status))
|
||||
|
|
|
@ -50,20 +50,8 @@ SECTIONS
|
|||
{
|
||||
*(.rsrc)
|
||||
}
|
||||
.rela.text :
|
||||
.rela :
|
||||
{
|
||||
*(.rela.text)
|
||||
}
|
||||
.rela.data :
|
||||
{
|
||||
*(.rela.data)
|
||||
}
|
||||
.rela.rodata :
|
||||
{
|
||||
*(.rela.rodata)
|
||||
}
|
||||
.rela.got2 :
|
||||
{
|
||||
*(.rela.got2)
|
||||
*(.rela.*)
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue