mirror of
https://github.com/reactos/reactos.git
synced 2025-08-03 19:05:52 +00:00
[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. svn path=/trunk/; revision=67795
This commit is contained in:
parent
3538fd9556
commit
2b1be6187c
2 changed files with 41 additions and 17 deletions
|
@ -167,28 +167,44 @@ MmLocateMemoryAreaByAddress(
|
||||||
PMMSUPPORT AddressSpace,
|
PMMSUPPORT AddressSpace,
|
||||||
PVOID Address_)
|
PVOID Address_)
|
||||||
{
|
{
|
||||||
PMEMORY_AREA Node = (PMEMORY_AREA)AddressSpace->WorkingSetExpansionLinks.Flink;
|
ULONG_PTR StartVpn = (ULONG_PTR)Address_ / PAGE_SIZE;
|
||||||
ULONG_PTR Address = (ULONG_PTR)Address_;
|
PEPROCESS Process;
|
||||||
|
PMM_AVL_TABLE Table;
|
||||||
|
PMMADDRESS_NODE Node;
|
||||||
|
PMEMORY_AREA MemoryArea;
|
||||||
|
TABLE_SEARCH_RESULT Result;
|
||||||
|
PMMVAD_LONG Vad;
|
||||||
|
|
||||||
DPRINT("MmLocateMemoryAreaByAddress(AddressSpace %p, Address %p)\n",
|
Process = MmGetAddressSpaceOwner(AddressSpace);
|
||||||
AddressSpace, Address);
|
Table = (Process != NULL) ? &Process->VadRoot : &MiRosKernelVadRoot;
|
||||||
|
|
||||||
while (Node != NULL)
|
Result = MiCheckForConflictingNode(StartVpn, StartVpn, Table, &Node);
|
||||||
|
if (Result != TableFoundNode)
|
||||||
{
|
{
|
||||||
if (Address < MA_GetStartingAddress(Node))
|
return NULL;
|
||||||
Node = Node->LeftChild;
|
|
||||||
else if (Address >= MA_GetEndingAddress(Node))
|
|
||||||
Node = Node->RightChild;
|
|
||||||
else
|
|
||||||
{
|
|
||||||
DPRINT("MmLocateMemoryAreaByAddress(%p): %p [%p - %p]\n",
|
|
||||||
Address, Node, MA_GetStartingAddress(Node), MA_GetEndingAddress(Node));
|
|
||||||
return Node;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
DPRINT("MmLocateMemoryAreaByAddress(%p): 0\n", Address);
|
Vad = (PMMVAD_LONG)Node;
|
||||||
return NULL;
|
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
|
||||||
|
{
|
||||||
|
/* 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
|
PMEMORY_AREA
|
||||||
|
|
|
@ -221,6 +221,14 @@ MmAccessFault(IN BOOLEAN StoreInstruction,
|
||||||
#endif
|
#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? */
|
/* Is there a ReactOS address space yet? */
|
||||||
if (MmGetKernelAddressSpace())
|
if (MmGetKernelAddressSpace())
|
||||||
{
|
{
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue