diff --git a/reactos/boot/freeldr/freeldr/arch/i386/mb.S b/reactos/boot/freeldr/freeldr/arch/i386/mb.S index 5225e11ab73..7bea5b2b0ee 100644 --- a/reactos/boot/freeldr/freeldr/arch/i386/mb.S +++ b/reactos/boot/freeldr/freeldr/arch/i386/mb.S @@ -72,7 +72,7 @@ _kernel_pagetable: .fill 2*4096, 1, 0 _hyperspace_pagetable: - .fill 2*4096, 1, 0 + .fill 4096, 1, 0 _apic_pagetable: .fill 4096, 1, 0 diff --git a/reactos/boot/freeldr/freeldr/reactos/loader.c b/reactos/boot/freeldr/freeldr/reactos/loader.c index 543f71db0b2..44cb02b8860 100644 --- a/reactos/boot/freeldr/freeldr/reactos/loader.c +++ b/reactos/boot/freeldr/freeldr/reactos/loader.c @@ -279,11 +279,32 @@ VOID FASTCALL FrLdrGetPaeMode(VOID) { - /* FIXME: Read command line */ + PCHAR p; + PaeModeEnabled = FALSE; + /* Read Command Line */ + p = (PCHAR)LoaderBlock.CommandLine; + while ((p = strchr(p, '/')) != NULL) { + + p++; + /* Find "PAE" */ + if (!strnicmp(p, "PAE", 3)) { + + /* Make sure there's nothing following it */ + if (p[3] == ' ' || p[3] == 0) { + + /* Use Pae */ + PaeModeEnabled = TRUE; + break; + } + } + } if (PaeModeEnabled) { + /* FIXME: + * Check if the cpu is pae capable + */ } } @@ -445,9 +466,6 @@ FrLdrSetupPageDirectory(VOID) PageDir->Pde[HyperspacePageTableIndex].Valid = 1; PageDir->Pde[HyperspacePageTableIndex].Write = 1; PageDir->Pde[HyperspacePageTableIndex].PageFrameNumber = PaPtrToPfn(hyperspace_pagetable); - PageDir->Pde[HyperspacePageTableIndex + 1].Valid = 1; - PageDir->Pde[HyperspacePageTableIndex + 1].Write = 1; - PageDir->Pde[HyperspacePageTableIndex + 1].PageFrameNumber = PaPtrToPfn(hyperspace_pagetable + 4096); /* Set up the Apic PDE */ PageDir->Pde[ApicPageTableIndex].Valid = 1; diff --git a/reactos/ntoskrnl/mm/i386/page.c b/reactos/ntoskrnl/mm/i386/page.c index 301b9139672..f578771d14e 100644 --- a/reactos/ntoskrnl/mm/i386/page.c +++ b/reactos/ntoskrnl/mm/i386/page.c @@ -40,7 +40,7 @@ #define PAE_PAGEDIRECTORY_MAP (0xc0000000 + (PAGETABLE_MAP / (512))) #define HYPERSPACE (Ke386Pae ? 0xc0800000 : 0xc0400000) -#define IS_HYPERSPACE(v) (((ULONG)(v) >= HYPERSPACE && (ULONG)(v) < 0xc0c00000)) +#define IS_HYPERSPACE(v) (((ULONG)(v) >= HYPERSPACE && (ULONG)(v) < HYPERSPACE + 0x400000)) ULONG MmGlobalKernelPageDirectory[1024]; ULONGLONG MmGlobalKernelPageDirectoryForPAE[2048]; @@ -2371,32 +2371,41 @@ MiInitPageDirectoryMap(VOID) MEMORY_AREA* hyperspace_desc = NULL; PHYSICAL_ADDRESS BoundaryAddressMultiple; PVOID BaseAddress; + NTSTATUS Status; DPRINT("MiInitPageDirectoryMap()\n"); BoundaryAddressMultiple.QuadPart = 0; BaseAddress = (PVOID)PAGETABLE_MAP; - MmCreateMemoryArea(NULL, - MmGetKernelAddressSpace(), - MEMORY_AREA_SYSTEM, - &BaseAddress, - Ke386Pae ? 0x800000 : 0x400000, - 0, - &kernel_map_desc, - TRUE, - FALSE, - BoundaryAddressMultiple); + Status = MmCreateMemoryArea(NULL, + MmGetKernelAddressSpace(), + MEMORY_AREA_SYSTEM, + &BaseAddress, + Ke386Pae ? 0x800000 : 0x400000, + 0, + &kernel_map_desc, + TRUE, + FALSE, + BoundaryAddressMultiple); + if (!NT_SUCCESS(Status)) + { + KEBUGCHECK(0); + } BaseAddress = (PVOID)HYPERSPACE; - MmCreateMemoryArea(NULL, - MmGetKernelAddressSpace(), - MEMORY_AREA_SYSTEM, - &BaseAddress, - Ke386Pae ? 0x400000 : 0x800000, - 0, - &hyperspace_desc, - TRUE, - FALSE, - BoundaryAddressMultiple); + Status = MmCreateMemoryArea(NULL, + MmGetKernelAddressSpace(), + MEMORY_AREA_SYSTEM, + &BaseAddress, + 0x400000, + 0, + &hyperspace_desc, + TRUE, + FALSE, + BoundaryAddressMultiple); + if (!NT_SUCCESS(Status)) + { + KEBUGCHECK(0); + } } /* EOF */