Author: ros-arm-bringup
Date: Sat Jun 27 09:32:53 2009
New Revision: 41631
URL: http://svn.reactos.org/svn/reactos?rev=41631&view=rev
Log:
- Blow away the bottom 2GB of virtual address space in the ARM^3 initializer. Previously this was kind of done with MmUnmapPageTable in MmInit1, but this code (And the function, which had only been used for this purpose, are gone)
- Also set the Page Directory for the system/idle process in a slightly more correct way, instead of depending on the CR3 value. Do this in ARM^3 now, and remove the older code (and the MmGetPageDirectory function, which was only used by this).
Modified:
trunk/reactos/ntoskrnl/mm/ARM3/init.c
trunk/reactos/ntoskrnl/mm/i386/page.c
trunk/reactos/ntoskrnl/mm/mminit.c
Modified: trunk/reactos/ntoskrnl/mm/ARM3/init.c
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/mm/ARM3/init.c?re…
==============================================================================
--- trunk/reactos/ntoskrnl/mm/ARM3/init.c [iso-8859-1] (original)
+++ trunk/reactos/ntoskrnl/mm/ARM3/init.c [iso-8859-1] Sat Jun 27 09:32:53 2009
@@ -146,6 +146,20 @@
if (Phase == 0)
{
//
+ // Set CR3 for the system process
+ //
+ PointerPte = MiAddressToPde(PAGETABLE_MAP);
+ PageFrameIndex = PFN_FROM_PTE(PointerPte) << PAGE_SHIFT;
+ PsGetCurrentProcess()->Pcb.DirectoryTableBase[0] = PageFrameIndex;
+
+ //
+ // Blow away user-mode
+ //
+ StartPde = MiAddressToPde(0);
+ EndPde = MiAddressToPde(KSEG0_BASE);
+ RtlZeroMemory(StartPde, (EndPde - StartPde) * sizeof(MMPTE));
+
+ //
// Check if this is a machine with less than 19MB of RAM
//
if (MmNumberOfPhysicalPages < MI_MIN_PAGES_FOR_SYSPTE_TUNING)
Modified: trunk/reactos/ntoskrnl/mm/i386/page.c
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/mm/i386/page.c?re…
==============================================================================
--- trunk/reactos/ntoskrnl/mm/i386/page.c [iso-8859-1] (original)
+++ trunk/reactos/ntoskrnl/mm/i386/page.c [iso-8859-1] Sat Jun 27 09:32:53 2009
@@ -71,12 +71,6 @@
}
}
-PULONG
-MmGetPageDirectory(VOID)
-{
- return (PULONG)(ULONG_PTR)__readcr3();
-}
-
static ULONG
ProtectToPTE(ULONG flProtect)
{
@@ -224,32 +218,6 @@
DirectoryTableBase[1] = 0;
DPRINT("Finished MmCopyMmInfo(): 0x%x\n", DirectoryTableBase[0]);
return TRUE;
-}
-
-VOID
-NTAPI
-MmDeletePageTable(PEPROCESS Process, PVOID Address)
-{
- PEPROCESS CurrentProcess = PsGetCurrentProcess();
-
- if (Process != NULL && Process != CurrentProcess)
- {
- KeAttachProcess(&Process->Pcb);
- }
-
- MiAddressToPde(Address)->u.Long = 0;
- MiFlushTlb((PULONG)MiAddressToPde(Address),
- MiAddressToPte(Address));
-
- if (Address >= MmSystemRangeStart)
- {
- KeBugCheck(MEMORY_MANAGEMENT);
- // MmGlobalKernelPageDirectory[ADDR_TO_PDE_OFFSET(Address)] = 0;
- }
- if (Process != NULL && Process != CurrentProcess)
- {
- KeDetachProcess();
- }
}
static PULONG
Modified: trunk/reactos/ntoskrnl/mm/mminit.c
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/mm/mminit.c?rev=4…
==============================================================================
--- trunk/reactos/ntoskrnl/mm/mminit.c [iso-8859-1] (original)
+++ trunk/reactos/ntoskrnl/mm/mminit.c [iso-8859-1] Sat Jun 27 09:32:53 2009
@@ -305,9 +305,6 @@
/* Dump memory descriptors */
if (MiDbgEnableMdDump) MiDbgDumpMemoryDescriptors();
- /* Set the page directory */
- PsGetCurrentProcess()->Pcb.DirectoryTableBase[0] = (ULONG)MmGetPageDirectory();
-
/* Get the size of FreeLDR's image allocations */
MmBootImageSize = KeLoaderBlock->Extension->LoaderPagesSpanned;
MmBootImageSize *= PAGE_SIZE;
@@ -377,9 +374,6 @@
/* Initialize the page list */
MmInitializePageList();
-
- /* Unmap low memory */
- MmDeletePageTable(NULL, 0);
//
// Initialize ARM³