Author: ros-arm-bringup
Date: Tue Jun 24 09:16:06 2008
New Revision: 34072
URL:
http://svn.reactos.org/svn/reactos?rev=34072&view=rev
Log:
- Implement MmGetPfnForProcess, MmIsPageSwapEntry.
- Fix a bug in MmDeletePageTable.
- Use MmCreateVirtualMappingForKernel when we are already in the right process context,
and allow it to be used for addresses < KSEG0_BASE as well.
- We now have full memory mapped file support, and get all the way to CmInitSystem1.
Modified:
trunk/reactos/ntoskrnl/mm/arm/stubs.c
Modified: trunk/reactos/ntoskrnl/mm/arm/stubs.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/mm/arm/stubs.c?re…
==============================================================================
--- trunk/reactos/ntoskrnl/mm/arm/stubs.c [iso-8859-1] (original)
+++ trunk/reactos/ntoskrnl/mm/arm/stubs.c [iso-8859-1] Tue Jun 24 09:16:06 2008
@@ -162,22 +162,9 @@
ASSERT(PointerPde->u.Hard.L1.Fault.Type == FaultPte);
//
- // Check if this is a kernel PDE
- //
- if ((PointerPde >= (PMMPTE)PTE_BASE) && (PointerPde < (PMMPTE)PTE_BASE
+ (1024 * 1024)))
- {
- //
- // Invalidate the TLB entry
- //
- KiFlushSingleTb(TRUE, Address);
- }
- else
- {
- //
- // Process PDE, unmap it from hyperspace (will also invalidate TLB entry)
- //
- MmDeleteHyperspaceMapping((PVOID)PAGE_ROUND_DOWN(PointerPde));
- }
+ // Invalidate the TLB entry
+ //
+ KiFlushSingleTb(TRUE, Address);
}
PFN_TYPE
@@ -185,13 +172,41 @@
MmGetPfnForProcess(IN PEPROCESS Process,
IN PVOID Address)
{
- PFN_TYPE Pfn = {0};
-
- //
- // TODO
- //
- UNIMPLEMENTED;
- return Pfn;
+ PMMPTE Pte;
+
+ //
+ // Check if this is for a different process
+ //
+ if ((Process) && (Process != PsGetCurrentProcess()))
+ {
+ //
+ // TODO
+ //
+ UNIMPLEMENTED;
+ return 0;
+ }
+
+ //
+ // Get the PDE
+ //
+ Pte = MiGetPdeAddress(Address);
+ if (Pte->u.Hard.L1.Fault.Type != FaultPte)
+ {
+ //
+ // Get the PTE
+ //
+ Pte = MiGetPteAddress(Address);
+ }
+
+ //
+ // If PTE is invalid, return 0
+ //
+ if (Pte->u.Hard.L2.Fault.Type == FaultPte) return 0;
+
+ //
+ // Return PFN
+ //
+ return Pte->u.Hard.L2.Small.BaseAddress;
}
VOID
@@ -323,8 +338,6 @@
// Return whether or not it's valid
//
return (Pte->u.Hard.L1.Fault.Type != FaultPte);
-
-
}
BOOLEAN
@@ -332,11 +345,36 @@
MmIsPageSwapEntry(IN PEPROCESS Process,
IN PVOID Address)
{
- //
- // TODO
- //
- UNIMPLEMENTED;
- return 0;
+ PMMPTE Pte;
+
+ //
+ // Check if this is for a different process
+ //
+ if ((Process) && (Process != PsGetCurrentProcess()))
+ {
+ //
+ // TODO
+ //
+ UNIMPLEMENTED;
+ return 0;
+ }
+
+ //
+ // Get the PDE
+ //
+ Pte = MiGetPdeAddress(Address);
+ if (Pte->u.Hard.L1.Fault.Type != FaultPte)
+ {
+ //
+ // Get the PTE
+ //
+ Pte = MiGetPteAddress(Address);
+ }
+
+ //
+ // Return whether or not it's valid
+ //
+ return ((Pte->u.Hard.L2.Fault.Type == FaultPte) &&
(Pte->u.Hard.AsUlong));
}
NTSTATUS
@@ -351,7 +389,7 @@
NTSTATUS Status;
PFN_NUMBER Pfn;
DPRINT1("[KMAP]: %p %d\n", Address, PageCount);
- ASSERT(Address >= MmSystemRangeStart);
+ //ASSERT(Address >= MmSystemRangeStart);
//
// Get our templates
@@ -468,7 +506,7 @@
//
// Are we only handling the kernel?
//
- if (!Process)
+ if (!(Process) || (Process == PsGetCurrentProcess()))
{
//
// Call the kernel version
@@ -675,7 +713,6 @@
//
KiFlushSingleTb(TRUE, Address);
return Pfn;
-
}
VOID