Author: tkreuzer
Date: Sun May 17 00:35:09 2015
New Revision: 67795
URL:
http://svn.reactos.org/svn/reactos?rev=67795&view=rev
Log:
[NTOSKRNL]
Modify MmLocateMemoryAreaByAddress as well to use the VAD table. Since the page fault
handler uses it to find ARM3-Fault pages and the shared user page does have a memory area,
but not a VAD, add a check for the shared user page in the old fault handler.
Modified:
trunk/reactos/ntoskrnl/mm/marea.c
trunk/reactos/ntoskrnl/mm/mmfault.c
Modified: trunk/reactos/ntoskrnl/mm/marea.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/mm/marea.c?rev=67…
==============================================================================
--- trunk/reactos/ntoskrnl/mm/marea.c [iso-8859-1] (original)
+++ trunk/reactos/ntoskrnl/mm/marea.c [iso-8859-1] Sun May 17 00:35:09 2015
@@ -167,28 +167,44 @@
PMMSUPPORT AddressSpace,
PVOID Address_)
{
- PMEMORY_AREA Node = (PMEMORY_AREA)AddressSpace->WorkingSetExpansionLinks.Flink;
- ULONG_PTR Address = (ULONG_PTR)Address_;
-
- DPRINT("MmLocateMemoryAreaByAddress(AddressSpace %p, Address %p)\n",
- AddressSpace, Address);
-
- while (Node != NULL)
- {
- if (Address < MA_GetStartingAddress(Node))
- Node = Node->LeftChild;
- else if (Address >= MA_GetEndingAddress(Node))
- Node = Node->RightChild;
+ ULONG_PTR StartVpn = (ULONG_PTR)Address_ / PAGE_SIZE;
+ PEPROCESS Process;
+ PMM_AVL_TABLE Table;
+ PMMADDRESS_NODE Node;
+ PMEMORY_AREA MemoryArea;
+ TABLE_SEARCH_RESULT Result;
+ PMMVAD_LONG Vad;
+
+ Process = MmGetAddressSpaceOwner(AddressSpace);
+ Table = (Process != NULL) ? &Process->VadRoot : &MiRosKernelVadRoot;
+
+ Result = MiCheckForConflictingNode(StartVpn, StartVpn, Table, &Node);
+ if (Result != TableFoundNode)
+ {
+ return NULL;
+ }
+
+ Vad = (PMMVAD_LONG)Node;
+ if (Vad->u.VadFlags.Spare == 0)
+ {
+ /* Check if this is VM VAD */
+ if (Vad->ControlArea == NULL)
+ {
+ /* We store the reactos MEMORY_AREA here */
+ MemoryArea = (PMEMORY_AREA)Vad->FirstPrototypePte;
+ }
else
{
- DPRINT("MmLocateMemoryAreaByAddress(%p): %p [%p - %p]\n",
- Address, Node, MA_GetStartingAddress(Node),
MA_GetEndingAddress(Node));
- return Node;
- }
- }
-
- DPRINT("MmLocateMemoryAreaByAddress(%p): 0\n", Address);
- return NULL;
+ /* This is a section VAD. Store the MAREA here for now */
+ MemoryArea = (PMEMORY_AREA)Vad->u4.Banked;
+ }
+ }
+ else
+ {
+ MemoryArea = (PMEMORY_AREA)Node;
+ }
+
+ return MemoryArea;
}
PMEMORY_AREA
Modified: trunk/reactos/ntoskrnl/mm/mmfault.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/mm/mmfault.c?rev=…
==============================================================================
--- trunk/reactos/ntoskrnl/mm/mmfault.c [iso-8859-1] (original)
+++ trunk/reactos/ntoskrnl/mm/mmfault.c [iso-8859-1] Sun May 17 00:35:09 2015
@@ -221,6 +221,14 @@
#endif
}
+ /* Handle shared user page, which doesn't have a VAD / MemoryArea */
+ if (PAGE_ALIGN(Address) == (PVOID)MM_SHARED_USER_DATA_VA)
+ {
+ /* This is an ARM3 fault */
+ DPRINT("ARM3 fault %p\n", MemoryArea);
+ return MmArmAccessFault(StoreInstruction, Address, Mode, TrapInformation);
+ }
+
/* Is there a ReactOS address space yet? */
if (MmGetKernelAddressSpace())
{