Put the page tables and hyperspace at the right place in memory (ie. Windows compatible).

svn path=/trunk/; revision=16445
This commit is contained in:
Filip Navara 2005-07-06 00:29:39 +00:00
parent 4ea9392a55
commit 902a400b19
3 changed files with 19 additions and 18 deletions

View file

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

View file

@ -36,20 +36,21 @@
#define PaToPfn(p) \ #define PaToPfn(p) \
((p) >> PFN_SHIFT) ((p) >> PFN_SHIFT)
#define STARTUP_BASE 0xF0000000 #define STARTUP_BASE 0xC0000000
#define HYPERSPACE_BASE 0xF0800000 #define HYPERSPACE_BASE 0xC0400000
#define HYPERSPACE_PAE_BASE 0xC0800000
#define APIC_BASE 0xFEC00000 #define APIC_BASE 0xFEC00000
#define KPCR_BASE 0xFF000000 #define KPCR_BASE 0xFF000000
#define LowMemPageTableIndex 0 #define LowMemPageTableIndex 0
#define StartupPageTableIndex (STARTUP_BASE >> 20) / sizeof(HARDWARE_PTE_X86) #define StartupPageTableIndex (STARTUP_BASE >> 22)
#define HyperspacePageTableIndex (HYPERSPACE_BASE >> 20) / sizeof(HARDWARE_PTE_X86) #define HyperspacePageTableIndex (HYPERSPACE_BASE >> 22)
#define KpcrPageTableIndex (KPCR_BASE >> 20) / sizeof(HARDWARE_PTE_X86) #define KpcrPageTableIndex (KPCR_BASE >> 22)
#define ApicPageTableIndex (APIC_BASE >> 20) / sizeof(HARDWARE_PTE_X86) #define ApicPageTableIndex (APIC_BASE >> 22)
#define LowMemPageTableIndexPae 0 #define LowMemPageTableIndexPae 0
#define StartupPageTableIndexPae (STARTUP_BASE >> 21) #define StartupPageTableIndexPae (STARTUP_BASE >> 21)
#define HyperspacePageTableIndexPae (HYPERSPACE_BASE >> 21) #define HyperspacePageTableIndexPae (HYPERSPACE_PAE_BASE >> 21)
#define KpcrPageTableIndexPae (KPCR_BASE >> 21) #define KpcrPageTableIndexPae (KPCR_BASE >> 21)
#define ApicPageTableIndexPae (APIC_BASE >> 21) #define ApicPageTableIndexPae (APIC_BASE >> 21)
@ -250,7 +251,7 @@ FrLdrGetKernelBase(VOID)
if (p[4] == ' ' || p[4] == 0) { if (p[4] == ' ' || p[4] == 0) {
/* Use 3GB */ /* Use 3GB */
KernelBase = 0xC0000000; KernelBase = 0xE0000000;
} }
} }
@ -447,6 +448,9 @@ 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;
@ -640,9 +644,6 @@ FrLdrMapKernel(FILE *KernelImage)
ShortPtr = (PUSHORT)(Address + (*TypeOffset & 0xFFF)); ShortPtr = (PUSHORT)(Address + (*TypeOffset & 0xFFF));
/* Don't relocate after the end of the loaded driver */
if ((ULONG_PTR)ShortPtr >= MaxAddress) break;
switch (*TypeOffset >> 12) { switch (*TypeOffset >> 12) {
case IMAGE_REL_BASED_ABSOLUTE: case IMAGE_REL_BASED_ABSOLUTE:

View file

@ -34,13 +34,13 @@
#define PA_ACCESSED (1 << PA_BIT_ACCESSED) #define PA_ACCESSED (1 << PA_BIT_ACCESSED)
#define PA_GLOBAL (1 << PA_BIT_GLOBAL) #define PA_GLOBAL (1 << PA_BIT_GLOBAL)
#define PAGETABLE_MAP (0xf0000000) #define PAGETABLE_MAP (0xc0000000)
#define PAGEDIRECTORY_MAP (0xf0000000 + (PAGETABLE_MAP / (1024))) #define PAGEDIRECTORY_MAP (0xc0000000 + (PAGETABLE_MAP / (1024)))
#define PAE_PAGEDIRECTORY_MAP (0xf0000000 + (PAGETABLE_MAP / (512))) #define PAE_PAGEDIRECTORY_MAP (0xc0000000 + (PAGETABLE_MAP / (512)))
#define HYPERSPACE (0xf0800000) #define HYPERSPACE (Ke386Pae ? 0xc0800000 : 0xc0400000)
#define IS_HYPERSPACE(v) (((ULONG)(v) >= 0xF0800000 && (ULONG)(v) < 0xF0C00000)) #define IS_HYPERSPACE(v) (((ULONG)(v) >= HYPERSPACE && (ULONG)(v) < 0xc0c00000))
ULONG MmGlobalKernelPageDirectory[1024]; ULONG MmGlobalKernelPageDirectory[1024];
ULONGLONG MmGlobalKernelPageDirectoryForPAE[2048]; ULONGLONG MmGlobalKernelPageDirectoryForPAE[2048];
@ -2390,7 +2390,7 @@ MiInitPageDirectoryMap(VOID)
MmGetKernelAddressSpace(), MmGetKernelAddressSpace(),
MEMORY_AREA_SYSTEM, MEMORY_AREA_SYSTEM,
&BaseAddress, &BaseAddress,
0x400000, Ke386Pae ? 0x400000 : 0x800000,
0, 0,
&hyperspace_desc, &hyperspace_desc,
TRUE, TRUE,