Subject: Re: [ros-dev] Re: [ros-svn] [navaraf] 16445: Put the page tables and hyperspace at the right place in memory (ie. Windows compatible).
From: Filip Navara <[email-masked]>
To: ReactOS Development List <[email-masked]>
Date: Fri, 08 Jul 2005 02:50:40 +0200

Hartmut Birr wrote:

>[email-masked] wrote:
>
>  
>
>>Put the page tables and hyperspace at the right place in memory (ie. Windows compatible).
>>
>>
>>Updated files:
>>trunk/reactos/boot/freeldr/freeldr/arch/i386/mb.S
>>trunk/reactos/boot/freeldr/freeldr/multiboot.c
>>trunk/reactos/ntoskrnl/mm/i386/page.c
>>
>>_______________________________________________
>>Ros-svn mailing list
>>[email-masked]
>>http://reactos.com:8080/mailman/listinfo/ros-svn
>>
>>
>> 
>>
>>    
>>
>Hi,
>
>on windows the hyperspace area is always 4MB. If you change the size you
>have also to change the mapping and initialisation functions.
>  
>
Sorry, I was confused by incorrect graph in the Windows Internals, 4th 
edition book which shows an 8Mb hyperspace region (in fact the high 4Mb 
are unused). Do you think the attached patch corrects the problem?

Regards,
Filip
Index: boot/freeldr/freeldr/reactos/loader.c
===================================================================
--- boot/freeldr/freeldr/reactos/loader.c	(revision 16454)
+++ boot/freeldr/freeldr/reactos/loader.c	(working copy)
@@ -445,9 +445,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;
Index: boot/freeldr/freeldr/arch/i386/mb.S
===================================================================
--- boot/freeldr/freeldr/arch/i386/mb.S	(revision 16454)
+++ boot/freeldr/freeldr/arch/i386/mb.S	(working copy)
@@ -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
Index: ntoskrnl/mm/i386/page.c
===================================================================
--- ntoskrnl/mm/i386/page.c	(revision 16476)
+++ ntoskrnl/mm/i386/page.c	(working copy)
@@ -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];
@@ -2391,7 +2391,7 @@
                       MmGetKernelAddressSpace(),
                       MEMORY_AREA_SYSTEM,
                       &BaseAddress,
-		      Ke386Pae ? 0x400000 : 0x800000,
+                      0x400000,
                       0,
                       &hyperspace_desc,
                       TRUE,