[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH v3 32/39] windbg: implement kd_api_read_io_space and
From: |
Mikhail Abakumov |
Subject: |
[Qemu-devel] [PATCH v3 32/39] windbg: implement kd_api_read_io_space and kd_api_write_io_space |
Date: |
Thu, 06 Dec 2018 15:01:37 +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 | 62 +++++++++++++++++++++++++++++++++++++++
windbgstub.c | 8 +++++
3 files changed, 72 insertions(+)
diff --git a/include/exec/windbgstub-utils.h b/include/exec/windbgstub-utils.h
index 2843ad055e..f0a786cdef 100644
--- a/include/exec/windbgstub-utils.h
+++ b/include/exec/windbgstub-utils.h
@@ -76,6 +76,8 @@ void kd_api_restore_breakpoint(CPUState *cs, PacketData *pd);
void kd_api_continue(CPUState *cs, PacketData *pd);
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_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 9432aad762..48855cc858 100644
--- a/windbgstub-utils.c
+++ b/windbgstub-utils.c
@@ -10,6 +10,7 @@
*/
#include "exec/windbgstub-utils.h"
+#include "exec/address-spaces.h"
#include "sysemu/sysemu.h"
static const char *kd_api_names[] = {
@@ -326,6 +327,67 @@ void kd_api_continue(CPUState *cs, PacketData *pd)
}
}
+void kd_api_read_io_space(CPUState *cs, PacketData *pd)
+{
+ DBGKD_READ_WRITE_IO64 *io = &pd->m64.u.ReadWriteIo;
+ CPUArchState *env = cs->env_ptr;
+
+ target_ulong addr = ldtul_p(&io->IoAddress);
+ uint32_t value = 0;
+
+ switch (io->DataSize) {
+ case 1:
+ value = address_space_ldub(&address_space_io, addr,
+ cpu_get_mem_attrs(env), NULL);
+ stl_p(&io->DataValue, value);
+ break;
+ case 2:
+ value = address_space_lduw(&address_space_io, addr,
+ cpu_get_mem_attrs(env), NULL);
+ stl_p(&io->DataValue, value);
+ break;
+ case 4:
+ value = address_space_ldl(&address_space_io, addr,
+ cpu_get_mem_attrs(env), NULL);
+ stl_p(&io->DataValue, value);
+ break;
+ default:
+ pd->m64.ReturnStatus = STATUS_UNSUCCESSFUL;
+ return;
+ }
+
+ pd->m64.ReturnStatus = STATUS_SUCCESS;
+}
+
+void kd_api_write_io_space(CPUState *cs, PacketData *pd)
+{
+ DBGKD_READ_WRITE_IO64 *io = &pd->m64.u.ReadWriteIo;
+ CPUArchState *env = cs->env_ptr;
+
+ target_ulong addr = ldtul_p(&io->IoAddress);
+ uint32_t value = ldl_p(&io->DataValue);
+
+ switch (io->DataSize) {
+ case 1:
+ address_space_stb(&address_space_io, addr, value,
+ cpu_get_mem_attrs(env), NULL);
+ break;
+ case 2:
+ address_space_stw(&address_space_io, addr, value,
+ cpu_get_mem_attrs(env), NULL);
+ break;
+ case 4:
+ address_space_stl(&address_space_io, addr, value,
+ cpu_get_mem_attrs(env), NULL);
+ break;
+ default:
+ pd->m64.ReturnStatus = STATUS_UNSUCCESSFUL;
+ return;
+ }
+
+ pd->m64.ReturnStatus = STATUS_SUCCESS;
+}
+
void kd_api_clear_all_internal_breakpoints(CPUState *cs, PacketData *pd)
{
}
diff --git a/windbgstub.c b/windbgstub.c
index d64bbc3f34..78f96a6621 100644
--- a/windbgstub.c
+++ b/windbgstub.c
@@ -196,6 +196,14 @@ static void windbg_process_manipulate_packet(WindbgState
*state)
kd_api_write_control_space(cs, data);
break;
+ case DbgKdReadIoSpaceApi:
+ kd_api_read_io_space(cs, data);
+ break;
+
+ case DbgKdWriteIoSpaceApi:
+ kd_api_write_io_space(cs, data);
+ break;
+
case DbgKdClearAllInternalBreakpointsApi:
kd_api_clear_all_internal_breakpoints(cs, data);
return;
- [Qemu-devel] [PATCH v3 22/39] windbg: some kernel structures, (continued)
- [Qemu-devel] [PATCH v3 22/39] windbg: some kernel structures, Mikhail Abakumov, 2018/12/06
- [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 <=
- [Qemu-devel] [PATCH v3 33/39] windbg: implement kd_api_read_physical_memory and kd_api_write_physical_memory, Mikhail Abakumov, 2018/12/06
- [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