Skip to content

Commit 42e038f

Browse files
hpoussinHBelusca
authored andcommitted
[NTOS:KD64] Implement KdSystemDebugControl: SysDbgReadPhysical/SysDbgWritePhysical
1 parent 2efaa5e commit 42e038f

File tree

1 file changed

+29
-0
lines changed

1 file changed

+29
-0
lines changed

ntoskrnl/kd64/kdapi.c

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2335,6 +2335,35 @@ KdSystemDebugControl(
23352335

23362336
case SysDbgReadPhysical:
23372337
case SysDbgWritePhysical:
2338+
if (InputBufferLength != sizeof(SYSDBG_PHYSICAL))
2339+
{
2340+
Status = STATUS_INFO_LENGTH_MISMATCH;
2341+
}
2342+
else
2343+
{
2344+
SYSDBG_PHYSICAL Request = *(PSYSDBG_PHYSICAL)InputBuffer;
2345+
PVOID LockedBuffer;
2346+
PMDL LockVariable;
2347+
2348+
Status = ExLockUserBuffer(Request.Buffer,
2349+
Request.Request,
2350+
PreviousMode,
2351+
Command == SysDbgReadVirtual ? IoWriteAccess : IoReadAccess,
2352+
&LockedBuffer,
2353+
&LockVariable);
2354+
if (NT_SUCCESS(Status))
2355+
{
2356+
Status = KdpCopyMemoryChunks(Request.Address.QuadPart,
2357+
Request.Buffer,
2358+
Request.Request,
2359+
0,
2360+
MMDBG_COPY_PHYSICAL | (Command == SysDbgReadVirtual ? 0 : MMDBG_COPY_WRITE),
2361+
&Length);
2362+
ExUnlockUserBuffer(LockVariable);
2363+
}
2364+
}
2365+
break;
2366+
23382367
case SysDbgReadControlSpace:
23392368
case SysDbgWriteControlSpace:
23402369
case SysDbgReadIoSpace:

0 commit comments

Comments
 (0)