[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH v2 42/43] windbg: implemented kd_api_fill_memory
From: |
Mihail Abakumov |
Subject: |
[Qemu-devel] [PATCH v2 42/43] windbg: implemented kd_api_fill_memory |
Date: |
Tue, 17 Oct 2017 16:12:48 +0300 |
User-agent: |
StGit/0.17.1-dirty |
Signed-off-by: Mihail Abakumov <address@hidden>
Signed-off-by: Pavel Dovgalyuk <address@hidden>
Signed-off-by: Dmitriy Koltunov <address@hidden>
---
include/exec/windbgstub-utils.h | 1 +
windbgstub-utils.c | 39 +++++++++++++++++++++++++++++++++++++++
windbgstub.c | 4 ++++
3 files changed, 44 insertions(+)
diff --git a/include/exec/windbgstub-utils.h b/include/exec/windbgstub-utils.h
index 6c587dadd8..0438ea44b6 100755
--- a/include/exec/windbgstub-utils.h
+++ b/include/exec/windbgstub-utils.h
@@ -110,6 +110,7 @@ void kd_api_get_version(CPUState *cpu, PacketData *pd);
void kd_api_read_msr(CPUState *cpu, PacketData *pd);
void kd_api_write_msr(CPUState *cpu, PacketData *pd);
void kd_api_search_memory(CPUState *cpu, PacketData *pd);
+void kd_api_fill_memory(CPUState *cpu, PacketData *pd);
void kd_api_unsupported(CPUState *cpu, PacketData *pd);
SizedBuf kd_gen_exception_sc(CPUState *cpu);
diff --git a/windbgstub-utils.c b/windbgstub-utils.c
index 8417de8fb1..444bb0474d 100755
--- a/windbgstub-utils.c
+++ b/windbgstub-utils.c
@@ -294,6 +294,45 @@ void kd_api_search_memory(CPUState *cpu, PacketData *pd)
}
}
+void kd_api_fill_memory(CPUState *cpu, PacketData *pd)
+{
+ DBGKD_FILL_MEMORY *m64c = &pd->m64.u.FillMemory;
+ uint32_t len = ldl_p(&m64c->Length);
+ target_ulong addr = ldq_p(&m64c->Address);
+ uint16_t pattern = ldl_p(&m64c->PatternLength);
+ uint16_t flags = ldl_p(&m64c->Flags);
+ int err, offset = 0;
+
+ uint8_t mem[pattern];
+ memcpy(mem, pd->extra, pattern);
+
+ pd->extra_size = 0;
+
+ switch (flags) {
+ case DBGKD_FILL_MEMORY_VIRTUAL:
+ while (offset < len) {
+ err = cpu_memory_rw_debug(cpu, addr + offset, mem,
+ MIN(pattern, len - offset), 1);
+ offset += pattern;
+ if (err) {
+ WINDBG_DEBUG("fill_memory: No physical page mapped: " FMT_ADDR,
+ addr);
+ }
+ }
+ break;
+
+ case DBGKD_FILL_MEMORY_PHYSICAL:
+ while (offset < len) {
+ cpu_physical_memory_rw(addr, mem, MIN(pattern, len - offset), 1);
+ offset += pattern;
+ }
+ break;
+
+ default:
+ break;
+ }
+}
+
void kd_api_unsupported(CPUState *cpu, PacketData *pd)
{
WINDBG_ERROR("Caught unimplemented api %s",
diff --git a/windbgstub.c b/windbgstub.c
index d35ff6ba96..b348028dfd 100755
--- a/windbgstub.c
+++ b/windbgstub.c
@@ -216,6 +216,10 @@ static void
windbg_process_manipulate_packet(ParsingContext *ctx)
kd_api_search_memory(cpu, &ctx->data);
break;
+ case DbgKdFillMemoryApi:
+ kd_api_fill_memory(cpu, &ctx->data);
+ break;
+
default:
kd_api_unsupported(cpu, &ctx->data);
break;
- [Qemu-devel] [PATCH v2 32/43] windbg: implemented windbg_set_dr7, (continued)
- [Qemu-devel] [PATCH v2 32/43] windbg: implemented windbg_set_dr7, Mihail Abakumov, 2017/10/17
- [Qemu-devel] [PATCH v2 33/43] windbg: implemented windbg_hw_breakpoint_insert and windbg_hw_breakpoint_remove, Mihail Abakumov, 2017/10/17
- [Qemu-devel] [PATCH v2 34/43] windbg: implemented kd_api_write_breakpoint and kd_api_restore_breakpoint, Mihail Abakumov, 2017/10/17
- [Qemu-devel] [PATCH v2 35/43] windbg: debug exception subscribing, Mihail Abakumov, 2017/10/17
- [Qemu-devel] [PATCH v2 36/43] windbg: implemented kd_api_continue, Mihail Abakumov, 2017/10/17
- [Qemu-devel] [PATCH v2 37/43] windbg: implemented kd_api_read_io_space and kd_api_write_io_space, Mihail Abakumov, 2017/10/17
- [Qemu-devel] [PATCH v2 38/43] windbg: implemented kd_api_read_physical_memory and kd_api_write_physical_memory, Mihail Abakumov, 2017/10/17
- [Qemu-devel] [PATCH v2 40/43] windbg: implemented kd_api_read_msr and kd_api_write_msr, Mihail Abakumov, 2017/10/17
- [Qemu-devel] [PATCH v2 39/43] windbg: implemented kd_api_get_version, Mihail Abakumov, 2017/10/17
- [Qemu-devel] [PATCH v2 41/43] windbg: implemented kd_api_search_memory, Mihail Abakumov, 2017/10/17
- [Qemu-devel] [PATCH v2 42/43] windbg: implemented kd_api_fill_memory,
Mihail Abakumov <=
- [Qemu-devel] [PATCH v2 43/43] windbg: implemented kd_api_query_memory, Mihail Abakumov, 2017/10/17
- Re: [Qemu-devel] [PATCH v2 00/43] Windbg supporting, no-reply, 2017/10/17
- Re: [Qemu-devel] [PATCH v2 00/43] Windbg supporting, no-reply, 2017/10/17
- Re: [Qemu-devel] [PATCH v2 00/43] Windbg supporting, Ladi Prosek, 2017/10/23