- Fixed the size of the hyperspace area (thanks to Filip Navara). - Enabled Pae mode in freeldr if it is requested. Modified: trunk/reactos/boot/freeldr/freeldr/arch/i386/mb.S Modified: trunk/reactos/boot/freeldr/freeldr/reactos/loader.c Modified: trunk/reactos/ntoskrnl/mm/i386/page.c _____
Modified: trunk/reactos/boot/freeldr/freeldr/arch/i386/mb.S --- trunk/reactos/boot/freeldr/freeldr/arch/i386/mb.S 2005-07-15 19:15:59 UTC (rev 16591) +++ trunk/reactos/boot/freeldr/freeldr/arch/i386/mb.S 2005-07-16 09:01:07 UTC (rev 16592) @@ -72,7 +72,7 @@
.fill 2*4096, 1, 0
_hyperspace_pagetable: - .fill 2*4096, 1, 0 + .fill 4096, 1, 0 _apic_pagetable: .fill 4096, 1, 0 _____
Modified: trunk/reactos/boot/freeldr/freeldr/reactos/loader.c --- trunk/reactos/boot/freeldr/freeldr/reactos/loader.c 2005-07-15 19:15:59 UTC (rev 16591) +++ trunk/reactos/boot/freeldr/freeldr/reactos/loader.c 2005-07-16 09:01:07 UTC (rev 16592) @@ -279,11 +279,32 @@
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 @@ 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; _____
Modified: trunk/reactos/ntoskrnl/mm/i386/page.c --- trunk/reactos/ntoskrnl/mm/i386/page.c 2005-07-15 19:15:59 UTC (rev 16591) +++ trunk/reactos/ntoskrnl/mm/i386/page.c 2005-07-16 09:01:07 UTC (rev 16592) @@ -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 @@ 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 */