Put the page tables and hyperspace at the right place in memory (ie. Windows compatible).
Modified: trunk/reactos/boot/freeldr/freeldr/arch/i386/mb.S
Modified: trunk/reactos/boot/freeldr/freeldr/multiboot.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-06 00:24:08 UTC (rev 16444)
+++ trunk/reactos/boot/freeldr/freeldr/arch/i386/mb.S	2005-07-06 00:29:39 UTC (rev 16445)
@@ -72,7 +72,7 @@
 	.fill 2*4096, 1, 0
 
 _hyperspace_pagetable:
-	.fill 4096, 1, 0
+	.fill 2*4096, 1, 0
 	
 _apic_pagetable:
 	.fill 4096, 1, 0

Modified: trunk/reactos/boot/freeldr/freeldr/multiboot.c
--- trunk/reactos/boot/freeldr/freeldr/multiboot.c	2005-07-06 00:24:08 UTC (rev 16444)
+++ trunk/reactos/boot/freeldr/freeldr/multiboot.c	2005-07-06 00:29:39 UTC (rev 16445)
@@ -36,20 +36,21 @@
 #define PaToPfn(p) \
     ((p) >> PFN_SHIFT)
 
-#define STARTUP_BASE                0xF0000000
-#define HYPERSPACE_BASE             0xF0800000
+#define STARTUP_BASE                0xC0000000
+#define HYPERSPACE_BASE             0xC0400000
+#define HYPERSPACE_PAE_BASE         0xC0800000
 #define APIC_BASE                   0xFEC00000
 #define KPCR_BASE                   0xFF000000
 
 #define LowMemPageTableIndex        0
-#define StartupPageTableIndex       (STARTUP_BASE >> 20)    / sizeof(HARDWARE_PTE_X86)
-#define HyperspacePageTableIndex    (HYPERSPACE_BASE >> 20) / sizeof(HARDWARE_PTE_X86)
-#define KpcrPageTableIndex          (KPCR_BASE >> 20)       / sizeof(HARDWARE_PTE_X86)
-#define ApicPageTableIndex          (APIC_BASE >> 20)       / sizeof(HARDWARE_PTE_X86)
+#define StartupPageTableIndex       (STARTUP_BASE >> 22)
+#define HyperspacePageTableIndex    (HYPERSPACE_BASE >> 22)
+#define KpcrPageTableIndex          (KPCR_BASE >> 22)
+#define ApicPageTableIndex          (APIC_BASE >> 22)
 
 #define LowMemPageTableIndexPae     0
 #define StartupPageTableIndexPae    (STARTUP_BASE >> 21)
-#define HyperspacePageTableIndexPae (HYPERSPACE_BASE >> 21)
+#define HyperspacePageTableIndexPae (HYPERSPACE_PAE_BASE >> 21)
 #define KpcrPageTableIndexPae       (KPCR_BASE >> 21)
 #define ApicPageTableIndexPae       (APIC_BASE >> 21)
 
@@ -250,7 +251,7 @@
             if (p[4] == ' ' || p[4] == 0) {
 
                 /* Use 3GB */
-                KernelBase = 0xC0000000;
+                KernelBase = 0xE0000000;
             }
         }
 
@@ -447,6 +448,9 @@
         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;
@@ -640,9 +644,6 @@
 
             ShortPtr = (PUSHORT)(Address + (*TypeOffset & 0xFFF));
 
-            /* Don't relocate after the end of the loaded driver */
-            if ((ULONG_PTR)ShortPtr >= MaxAddress) break;
-
             switch (*TypeOffset >> 12) {
 
                 case IMAGE_REL_BASED_ABSOLUTE:

Modified: trunk/reactos/ntoskrnl/mm/i386/page.c
--- trunk/reactos/ntoskrnl/mm/i386/page.c	2005-07-06 00:24:08 UTC (rev 16444)
+++ trunk/reactos/ntoskrnl/mm/i386/page.c	2005-07-06 00:29:39 UTC (rev 16445)
@@ -34,13 +34,13 @@
 #define PA_ACCESSED  (1 << PA_BIT_ACCESSED)
 #define PA_GLOBAL    (1 << PA_BIT_GLOBAL)
 
-#define PAGETABLE_MAP		(0xf0000000)
-#define PAGEDIRECTORY_MAP	(0xf0000000 + (PAGETABLE_MAP / (1024)))
+#define PAGETABLE_MAP		(0xc0000000)
+#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 IS_HYPERSPACE(v)	(((ULONG)(v) >= 0xF0800000 && (ULONG)(v) < 0xF0C00000))
+#define HYPERSPACE		(Ke386Pae ? 0xc0800000 : 0xc0400000)
+#define IS_HYPERSPACE(v)	(((ULONG)(v) >= HYPERSPACE && (ULONG)(v) < 0xc0c00000))
 
 ULONG MmGlobalKernelPageDirectory[1024];
 ULONGLONG MmGlobalKernelPageDirectoryForPAE[2048];
@@ -2390,7 +2390,7 @@
                       MmGetKernelAddressSpace(),
                       MEMORY_AREA_SYSTEM,
                       &BaseAddress,
-		      0x400000,
+		      Ke386Pae ? 0x400000 : 0x800000,
                       0,
                       &hyperspace_desc,
                       TRUE,