[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH v3 33/39] windbg: implement kd_api_read_physical_mem
From: |
Mikhail Abakumov |
Subject: |
[Qemu-devel] [PATCH v3 33/39] windbg: implement kd_api_read_physical_memory and kd_api_write_physical_memory |
Date: |
Thu, 06 Dec 2018 15:01:43 +0300 |
User-agent: |
StGit/0.17.1-dirty |
Signed-off-by: Mikhail Abakumov <address@hidden>
Signed-off-by: Pavel Dovgalyuk <address@hidden>
---
include/exec/windbgstub-utils.h | 2 ++
windbgstub-utils.c | 29 +++++++++++++++++++++++++++++
windbgstub.c | 8 ++++++++
3 files changed, 39 insertions(+)
diff --git a/include/exec/windbgstub-utils.h b/include/exec/windbgstub-utils.h
index f0a786cdef..fa67a7048d 100644
--- a/include/exec/windbgstub-utils.h
+++ b/include/exec/windbgstub-utils.h
@@ -78,6 +78,8 @@ void kd_api_read_control_space(CPUState *cs, PacketData *pd);
void kd_api_write_control_space(CPUState *cs, PacketData *pd);
void kd_api_read_io_space(CPUState *cs, PacketData *pd);
void kd_api_write_io_space(CPUState *cs, PacketData *pd);
+void kd_api_read_physical_memory(CPUState *cs, PacketData *pd);
+void kd_api_write_physical_memory(CPUState *cs, PacketData *pd);
void kd_api_clear_all_internal_breakpoints(CPUState *cs, PacketData *pd);
void kd_api_get_context_ex(CPUState *cs, PacketData *pd);
void kd_api_set_context_ex(CPUState *cs, PacketData *pd);
diff --git a/windbgstub-utils.c b/windbgstub-utils.c
index 48855cc858..4289e537a9 100644
--- a/windbgstub-utils.c
+++ b/windbgstub-utils.c
@@ -388,6 +388,35 @@ void kd_api_write_io_space(CPUState *cs, PacketData *pd)
pd->m64.ReturnStatus = STATUS_SUCCESS;
}
+void kd_api_read_physical_memory(CPUState *cs, PacketData *pd)
+{
+ DBGKD_READ_MEMORY64 *mem = &pd->m64.u.ReadMemory;
+ uint32_t len;
+ target_ulong addr;
+
+ len = MIN(ldl_p(&mem->TransferCount),
+ PACKET_MAX_SIZE - sizeof(DBGKD_MANIPULATE_STATE64));
+ addr = ldtul_p(&mem->TargetBaseAddress);
+
+ cpu_physical_memory_rw(addr, pd->extra, len, 0);
+ pd->extra_size = len;
+ stl_p(&mem->ActualBytesRead, len);
+}
+
+void kd_api_write_physical_memory(CPUState *cs, PacketData *pd)
+{
+ DBGKD_WRITE_MEMORY64 *mem = &pd->m64.u.WriteMemory;
+ uint32_t len;
+ target_ulong addr;
+
+ len = MIN(ldl_p(&mem->TransferCount), pd->extra_size);
+ addr = ldtul_p(&mem->TargetBaseAddress);
+
+ cpu_physical_memory_rw(addr, pd->extra, len, 1);
+ pd->extra_size = 0;
+ stl_p(&mem->ActualBytesWritten, len);
+}
+
void kd_api_clear_all_internal_breakpoints(CPUState *cs, PacketData *pd)
{
}
diff --git a/windbgstub.c b/windbgstub.c
index 78f96a6621..25331f218f 100644
--- a/windbgstub.c
+++ b/windbgstub.c
@@ -204,6 +204,14 @@ static void windbg_process_manipulate_packet(WindbgState
*state)
kd_api_write_io_space(cs, data);
break;
+ case DbgKdReadPhysicalMemoryApi:
+ kd_api_read_physical_memory(cs, data);
+ break;
+
+ case DbgKdWritePhysicalMemoryApi:
+ kd_api_write_physical_memory(cs, data);
+ break;
+
case DbgKdClearAllInternalBreakpointsApi:
kd_api_clear_all_internal_breakpoints(cs, data);
return;
- [Qemu-devel] [PATCH v3 23/39] windbg: add helper functions, (continued)
- [Qemu-devel] [PATCH v3 23/39] windbg: add helper functions, Mikhail Abakumov, 2018/12/06
- [Qemu-devel] [PATCH v3 24/39] windbg: [de]serialization cpu context, Mikhail Abakumov, 2018/12/06
- [Qemu-devel] [PATCH v3 25/39] windbg: [de]serialization cpu spec registers, Mikhail Abakumov, 2018/12/06
- [Qemu-devel] [PATCH v3 26/39] windbg: implement kd_api_get_context and kd_api_set_context, Mikhail Abakumov, 2018/12/06
- [Qemu-devel] [PATCH v3 27/39] windbg: implement kd_api_get_context_ex and kd_api_set_context_ex, Mikhail Abakumov, 2018/12/06
- [Qemu-devel] [PATCH v3 28/39] windbg: implement kd_api_read_control_space and kd_api_write_control_space, Mikhail Abakumov, 2018/12/06
- [Qemu-devel] [PATCH v3 30/39] windbg: debug exception subscribing, Mikhail Abakumov, 2018/12/06
- [Qemu-devel] [PATCH v3 29/39] windbg: implement kd_api_write_breakpoint and kd_api_restore_breakpoint, Mikhail Abakumov, 2018/12/06
- [Qemu-devel] [PATCH v3 31/39] windbg: implement kd_api_continue, Mikhail Abakumov, 2018/12/06
- [Qemu-devel] [PATCH v3 32/39] windbg: implement kd_api_read_io_space and kd_api_write_io_space, Mikhail Abakumov, 2018/12/06
- [Qemu-devel] [PATCH v3 33/39] windbg: implement kd_api_read_physical_memory and kd_api_write_physical_memory,
Mikhail Abakumov <=
- [Qemu-devel] [PATCH v3 35/39] windbg: implement kd_api_read_msr and kd_api_write_msr, Mikhail Abakumov, 2018/12/06
- [Qemu-devel] [PATCH v3 34/39] windbg: implement kd_api_get_version, Mikhail Abakumov, 2018/12/06
- [Qemu-devel] [PATCH v3 36/39] windbg: implement kd_api_search_memory, Mikhail Abakumov, 2018/12/06
- [Qemu-devel] [PATCH v3 37/39] windbg: implement kd_api_fill_memory, Mikhail Abakumov, 2018/12/06
- [Qemu-devel] [PATCH v3 38/39] windbg: implement kd_api_query_memory, Mikhail Abakumov, 2018/12/06
- [Qemu-devel] [PATCH v3 39/39] windbg: maintainers, Mikhail Abakumov, 2018/12/06
- Re: [Qemu-devel] [PATCH v3 00/39] Windbg supporting, no-reply, 2018/12/06