[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:
Timo Kreuzer 2011-07-09 14:15:47 +00:00
parent 5bf3d7c1d8
commit b5eab2f965

View file

@ -150,6 +150,8 @@ MmDbgCopyMemory(IN ULONG64 Address,
{ {
NTSTATUS Status; NTSTATUS Status;
PVOID TargetAddress; PVOID TargetAddress;
ULONG64 PhysicalAddress;
PMMPTE PointerPte;
// //
// No local kernel debugging support yet, so don't worry about locking // No local kernel debugging support yet, so don't worry about locking
@ -238,35 +240,31 @@ MmDbgCopyMemory(IN ULONG64 Address,
// No session space support yet // No session space support yet
// //
ASSERT(MmIsSessionAddress(TargetAddress) == FALSE); ASSERT(MmIsSessionAddress(TargetAddress) == FALSE);
}
// /* If we are going to write to the address, then check if its writable */
// If we are going to write to the address then make sure it is writeable too PointerPte = MiAddressToPte(TargetAddress);
// if ((Flags & MMDBG_COPY_WRITE) && !MI_IS_PAGE_WRITEABLE(PointerPte))
if ((Flags & MMDBG_COPY_WRITE) &&
(!MI_IS_PAGE_WRITEABLE(MiAddressToPte(TargetAddress))))
{ {
// /* Not writable, we need to do a physical copy */
// Check if we mapped anything Flags |= MMDBG_COPY_PHYSICAL;
//
if (Flags & MMDBG_COPY_PHYSICAL)
{
//
// Get rid of the mapping
//
MiDbgUnTranslatePhysicalAddress();
}
// /* Calculate the physical address */
// Fail PhysicalAddress = PointerPte->u.Hard.PageFrameNumber << PAGE_SHIFT;
// PhysicalAddress += BYTE_OFFSET(Address);
// FIXME: We should attempt to override the write protection instead of
// failing here /* Translate the physical address */
// TargetAddress = MiDbgTranslatePhysicalAddress(PhysicalAddress, Flags);
KdpDprintf("MmDbgCopyMemory: Failing Write for Protected Address 0x%p\n",
TargetAddress); /* Check if translation failed */
if (!TargetAddress)
{
/* Fail */
KdpDprintf("MmDbgCopyMemory: Failed to translate for write "
"%I64x (%I64x)\n", PhysicalAddress, Address);
return STATUS_UNSUCCESSFUL; return STATUS_UNSUCCESSFUL;
} }
}
}
// //
// Use SEH to try to catch anything else somewhat cleanly // Use SEH to try to catch anything else somewhat cleanly