- Fixed the size of the hyperspace area (thanks to Filip Navara).

- Enabled Pae mode in freeldr if it is requested.

svn path=/trunk/; revision=16592
This commit is contained in:
Hartmut Birr 2005-07-16 09:01:07 +00:00
parent 6d92ae56c6
commit 6088c647a3
3 changed files with 53 additions and 26 deletions

View file

@ -72,7 +72,7 @@ _kernel_pagetable:
.fill 2*4096, 1, 0 .fill 2*4096, 1, 0
_hyperspace_pagetable: _hyperspace_pagetable:
.fill 2*4096, 1, 0 .fill 4096, 1, 0
_apic_pagetable: _apic_pagetable:
.fill 4096, 1, 0 .fill 4096, 1, 0

View file

@ -279,11 +279,32 @@ VOID
FASTCALL FASTCALL
FrLdrGetPaeMode(VOID) FrLdrGetPaeMode(VOID)
{ {
/* FIXME: Read command line */ PCHAR p;
PaeModeEnabled = FALSE; 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) if (PaeModeEnabled)
{ {
/* FIXME:
* Check if the cpu is pae capable
*/
} }
} }
@ -445,9 +466,6 @@ FrLdrSetupPageDirectory(VOID)
PageDir->Pde[HyperspacePageTableIndex].Valid = 1; PageDir->Pde[HyperspacePageTableIndex].Valid = 1;
PageDir->Pde[HyperspacePageTableIndex].Write = 1; PageDir->Pde[HyperspacePageTableIndex].Write = 1;
PageDir->Pde[HyperspacePageTableIndex].PageFrameNumber = PaPtrToPfn(hyperspace_pagetable); 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 */ /* Set up the Apic PDE */
PageDir->Pde[ApicPageTableIndex].Valid = 1; PageDir->Pde[ApicPageTableIndex].Valid = 1;

View file

@ -40,7 +40,7 @@
#define PAE_PAGEDIRECTORY_MAP (0xc0000000 + (PAGETABLE_MAP / (512))) #define PAE_PAGEDIRECTORY_MAP (0xc0000000 + (PAGETABLE_MAP / (512)))
#define HYPERSPACE (Ke386Pae ? 0xc0800000 : 0xc0400000) #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]; ULONG MmGlobalKernelPageDirectory[1024];
ULONGLONG MmGlobalKernelPageDirectoryForPAE[2048]; ULONGLONG MmGlobalKernelPageDirectoryForPAE[2048];
@ -2371,32 +2371,41 @@ MiInitPageDirectoryMap(VOID)
MEMORY_AREA* hyperspace_desc = NULL; MEMORY_AREA* hyperspace_desc = NULL;
PHYSICAL_ADDRESS BoundaryAddressMultiple; PHYSICAL_ADDRESS BoundaryAddressMultiple;
PVOID BaseAddress; PVOID BaseAddress;
NTSTATUS Status;
DPRINT("MiInitPageDirectoryMap()\n"); DPRINT("MiInitPageDirectoryMap()\n");
BoundaryAddressMultiple.QuadPart = 0; BoundaryAddressMultiple.QuadPart = 0;
BaseAddress = (PVOID)PAGETABLE_MAP; BaseAddress = (PVOID)PAGETABLE_MAP;
MmCreateMemoryArea(NULL, Status = MmCreateMemoryArea(NULL,
MmGetKernelAddressSpace(), MmGetKernelAddressSpace(),
MEMORY_AREA_SYSTEM, MEMORY_AREA_SYSTEM,
&BaseAddress, &BaseAddress,
Ke386Pae ? 0x800000 : 0x400000, Ke386Pae ? 0x800000 : 0x400000,
0, 0,
&kernel_map_desc, &kernel_map_desc,
TRUE, TRUE,
FALSE, FALSE,
BoundaryAddressMultiple); BoundaryAddressMultiple);
if (!NT_SUCCESS(Status))
{
KEBUGCHECK(0);
}
BaseAddress = (PVOID)HYPERSPACE; BaseAddress = (PVOID)HYPERSPACE;
MmCreateMemoryArea(NULL, Status = MmCreateMemoryArea(NULL,
MmGetKernelAddressSpace(), MmGetKernelAddressSpace(),
MEMORY_AREA_SYSTEM, MEMORY_AREA_SYSTEM,
&BaseAddress, &BaseAddress,
Ke386Pae ? 0x400000 : 0x800000, 0x400000,
0, 0,
&hyperspace_desc, &hyperspace_desc,
TRUE, TRUE,
FALSE, FALSE,
BoundaryAddressMultiple); BoundaryAddressMultiple);
if (!NT_SUCCESS(Status))
{
KEBUGCHECK(0);
}
} }
/* EOF */ /* EOF */