mirror of
https://github.com/reactos/reactos.git
synced 2025-04-22 13:10:39 +00:00
[NTOSKRNL]
In MmDbgCopyMemory do physical memory copy, if the virtual target address is valid, but not writable. Fixes Step-Over on user mode addresses with WinDbg (can write break points now) svn path=/trunk/; revision=52582
This commit is contained in:
parent
5bf3d7c1d8
commit
b5eab2f965
1 changed files with 23 additions and 25 deletions
|
@ -150,6 +150,8 @@ MmDbgCopyMemory(IN ULONG64 Address,
|
|||
{
|
||||
NTSTATUS Status;
|
||||
PVOID TargetAddress;
|
||||
ULONG64 PhysicalAddress;
|
||||
PMMPTE PointerPte;
|
||||
|
||||
//
|
||||
// No local kernel debugging support yet, so don't worry about locking
|
||||
|
@ -238,34 +240,30 @@ MmDbgCopyMemory(IN ULONG64 Address,
|
|||
// No session space support yet
|
||||
//
|
||||
ASSERT(MmIsSessionAddress(TargetAddress) == FALSE);
|
||||
}
|
||||
|
||||
//
|
||||
// If we are going to write to the address then make sure it is writeable too
|
||||
//
|
||||
if ((Flags & MMDBG_COPY_WRITE) &&
|
||||
(!MI_IS_PAGE_WRITEABLE(MiAddressToPte(TargetAddress))))
|
||||
{
|
||||
//
|
||||
// Check if we mapped anything
|
||||
//
|
||||
if (Flags & MMDBG_COPY_PHYSICAL)
|
||||
/* If we are going to write to the address, then check if its writable */
|
||||
PointerPte = MiAddressToPte(TargetAddress);
|
||||
if ((Flags & MMDBG_COPY_WRITE) && !MI_IS_PAGE_WRITEABLE(PointerPte))
|
||||
{
|
||||
//
|
||||
// Get rid of the mapping
|
||||
//
|
||||
MiDbgUnTranslatePhysicalAddress();
|
||||
}
|
||||
/* Not writable, we need to do a physical copy */
|
||||
Flags |= MMDBG_COPY_PHYSICAL;
|
||||
|
||||
//
|
||||
// Fail
|
||||
//
|
||||
// FIXME: We should attempt to override the write protection instead of
|
||||
// failing here
|
||||
//
|
||||
KdpDprintf("MmDbgCopyMemory: Failing Write for Protected Address 0x%p\n",
|
||||
TargetAddress);
|
||||
return STATUS_UNSUCCESSFUL;
|
||||
/* Calculate the physical address */
|
||||
PhysicalAddress = PointerPte->u.Hard.PageFrameNumber << PAGE_SHIFT;
|
||||
PhysicalAddress += BYTE_OFFSET(Address);
|
||||
|
||||
/* Translate the physical address */
|
||||
TargetAddress = MiDbgTranslatePhysicalAddress(PhysicalAddress, Flags);
|
||||
|
||||
/* Check if translation failed */
|
||||
if (!TargetAddress)
|
||||
{
|
||||
/* Fail */
|
||||
KdpDprintf("MmDbgCopyMemory: Failed to translate for write "
|
||||
"%I64x (%I64x)\n", PhysicalAddress, Address);
|
||||
return STATUS_UNSUCCESSFUL;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
|
|
Loading…
Reference in a new issue