mirror of
https://github.com/reactos/reactos.git
synced 2025-08-06 12:13:10 +00:00
- Fixed the offset calculation in MmWritePagePhysicalAddress and MmPageOutPhysicalAddress.
- Add some code which will check for adding of multiple rmap entries. svn path=/trunk/; revision=17415
This commit is contained in:
parent
37aea079c1
commit
75983b1ade
1 changed files with 26 additions and 3 deletions
|
@ -21,6 +21,9 @@ typedef struct _MM_RMAP_ENTRY
|
||||||
struct _MM_RMAP_ENTRY* Next;
|
struct _MM_RMAP_ENTRY* Next;
|
||||||
PEPROCESS Process;
|
PEPROCESS Process;
|
||||||
PVOID Address;
|
PVOID Address;
|
||||||
|
#ifdef DBG
|
||||||
|
PVOID Caller;
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
MM_RMAP_ENTRY, *PMM_RMAP_ENTRY;
|
MM_RMAP_ENTRY, *PMM_RMAP_ENTRY;
|
||||||
|
|
||||||
|
@ -110,8 +113,8 @@ MmWritePagePhysicalAddress(PFN_TYPE Page)
|
||||||
Type = MemoryArea->Type;
|
Type = MemoryArea->Type;
|
||||||
if (Type == MEMORY_AREA_SECTION_VIEW)
|
if (Type == MEMORY_AREA_SECTION_VIEW)
|
||||||
{
|
{
|
||||||
Offset = (ULONG_PTR)Address - (ULONG_PTR)MemoryArea->StartingAddress;
|
Offset = (ULONG_PTR)Address - (ULONG_PTR)MemoryArea->StartingAddress
|
||||||
|
+ MemoryArea->Data.SectionData.ViewOffset;
|
||||||
/*
|
/*
|
||||||
* Get or create a pageop
|
* Get or create a pageop
|
||||||
*/
|
*/
|
||||||
|
@ -234,7 +237,8 @@ MmPageOutPhysicalAddress(PFN_TYPE Page)
|
||||||
Type = MemoryArea->Type;
|
Type = MemoryArea->Type;
|
||||||
if (Type == MEMORY_AREA_SECTION_VIEW)
|
if (Type == MEMORY_AREA_SECTION_VIEW)
|
||||||
{
|
{
|
||||||
Offset = (ULONG_PTR)Address - (ULONG_PTR)MemoryArea->StartingAddress;
|
Offset = (ULONG_PTR)Address - (ULONG_PTR)MemoryArea->StartingAddress
|
||||||
|
+ MemoryArea->Data.SectionData.ViewOffset;;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Get or create a pageop
|
* Get or create a pageop
|
||||||
|
@ -381,6 +385,9 @@ MmInsertRmap(PFN_TYPE Page, PEPROCESS Process,
|
||||||
}
|
}
|
||||||
new_entry->Address = Address;
|
new_entry->Address = Address;
|
||||||
new_entry->Process = Process;
|
new_entry->Process = Process;
|
||||||
|
#ifdef DBG
|
||||||
|
new_entry->Caller = __builtin_return_address(0);
|
||||||
|
#endif
|
||||||
|
|
||||||
if (MmGetPfnForProcess(Process, Address) != Page)
|
if (MmGetPfnForProcess(Process, Address) != Page)
|
||||||
{
|
{
|
||||||
|
@ -394,6 +401,22 @@ MmInsertRmap(PFN_TYPE Page, PEPROCESS Process,
|
||||||
ExAcquireFastMutex(&RmapListLock);
|
ExAcquireFastMutex(&RmapListLock);
|
||||||
current_entry = MmGetRmapListHeadPage(Page);
|
current_entry = MmGetRmapListHeadPage(Page);
|
||||||
new_entry->Next = current_entry;
|
new_entry->Next = current_entry;
|
||||||
|
#ifdef DBG
|
||||||
|
while (current_entry)
|
||||||
|
{
|
||||||
|
if (current_entry->Address == new_entry->Address && current_entry->Process == new_entry->Process)
|
||||||
|
{
|
||||||
|
DbgPrint("MmInsertRmap tries to add a second rmap entry for address %p\n current caller ",
|
||||||
|
current_entry->Address);
|
||||||
|
KeRosPrintAddress(new_entry->Caller);
|
||||||
|
DbgPrint("\n previous caller ");
|
||||||
|
KeRosPrintAddress(current_entry->Caller);
|
||||||
|
DbgPrint("\n");
|
||||||
|
KeBugCheck(0);
|
||||||
|
}
|
||||||
|
current_entry = current_entry->Next;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
MmSetRmapListHeadPage(Page, new_entry);
|
MmSetRmapListHeadPage(Page, new_entry);
|
||||||
ExReleaseFastMutex(&RmapListLock);
|
ExReleaseFastMutex(&RmapListLock);
|
||||||
if (Process == NULL)
|
if (Process == NULL)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue