https://git.reactos.org/?p=reactos.git;a=commitdiff;h=42e038f227bf0deeb9134e19851bf25d74f6472f

commit 42e038f227bf0deeb9134e19851bf25d74f6472f
Author:     Hervé Poussineau <hpous...@reactos.org>
AuthorDate: Sun Sep 22 21:39:09 2024 +0200
Commit:     Hermès Bélusca-Maïto <hermes.belusca-ma...@reactos.org>
CommitDate: Tue Jan 28 22:00:43 2025 +0100

    [NTOS:KD64] Implement KdSystemDebugControl: 
SysDbgReadPhysical/SysDbgWritePhysical
---
 ntoskrnl/kd64/kdapi.c | 29 +++++++++++++++++++++++++++++
 1 file changed, 29 insertions(+)

diff --git a/ntoskrnl/kd64/kdapi.c b/ntoskrnl/kd64/kdapi.c
index f6e375dbc7d..d6506701841 100644
--- a/ntoskrnl/kd64/kdapi.c
+++ b/ntoskrnl/kd64/kdapi.c
@@ -2335,6 +2335,35 @@ KdSystemDebugControl(
 
         case SysDbgReadPhysical:
         case SysDbgWritePhysical:
+            if (InputBufferLength != sizeof(SYSDBG_PHYSICAL))
+            {
+                Status = STATUS_INFO_LENGTH_MISMATCH;
+            }
+            else
+            {
+                SYSDBG_PHYSICAL Request = *(PSYSDBG_PHYSICAL)InputBuffer;
+                PVOID LockedBuffer;
+                PMDL LockVariable;
+
+                Status = ExLockUserBuffer(Request.Buffer,
+                                          Request.Request,
+                                          PreviousMode,
+                                          Command == SysDbgReadVirtual ? 
IoWriteAccess : IoReadAccess,
+                                          &LockedBuffer,
+                                          &LockVariable);
+                if (NT_SUCCESS(Status))
+                {
+                    Status = KdpCopyMemoryChunks(Request.Address.QuadPart,
+                                                 Request.Buffer,
+                                                 Request.Request,
+                                                 0,
+                                                 MMDBG_COPY_PHYSICAL | 
(Command == SysDbgReadVirtual ? 0 : MMDBG_COPY_WRITE),
+                                                 &Length);
+                    ExUnlockUserBuffer(LockVariable);
+                }
+            }
+            break;
+
         case SysDbgReadControlSpace:
         case SysDbgWriteControlSpace:
         case SysDbgReadIoSpace:

Reply via email to