[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH 2 36/39] windbg: implement kd_api_search_memory
From: |
Mikhail Abakumov |
Subject: |
[Qemu-devel] [PATCH 2 36/39] windbg: implement kd_api_search_memory |
Date: |
Wed, 05 Dec 2018 15:55:24 +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 | 1 +
windbgstub-utils.c | 17 +++++++++++++++++
windbgstub.c | 4 ++++
3 files changed, 22 insertions(+)
diff --git a/include/exec/windbgstub-utils.h b/include/exec/windbgstub-utils.h
index 74e3b9a0da..4eb976260b 100644
--- a/include/exec/windbgstub-utils.h
+++ b/include/exec/windbgstub-utils.h
@@ -83,6 +83,7 @@ void kd_api_write_physical_memory(CPUState *cs, PacketData
*pd);
void kd_api_get_version(CPUState *cs, PacketData *pd);
void kd_api_read_msr(CPUState *cs, PacketData *pd);
void kd_api_write_msr(CPUState *cs, PacketData *pd);
+void kd_api_search_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 602dcf0be8..848d52046b 100644
--- a/windbgstub-utils.c
+++ b/windbgstub-utils.c
@@ -417,6 +417,23 @@ void kd_api_write_physical_memory(CPUState *cs, PacketData
*pd)
stl_p(&mem->ActualBytesWritten, len);
}
+void kd_api_search_memory(CPUState *cs, PacketData *pd)
+{
+ DBGKD_SEARCH_MEMORY *m64c = &pd->m64.u.SearchMemory;
+ int s_len = MAX(ldq_p(&m64c->SearchLength), 1);
+ int p_len = MIN(ldl_p(&m64c->PatternLength), pd->extra_size);
+ target_ulong addr = ldq_p(&m64c->SearchAddress);
+ InitedAddr find =
+ windbg_search_vmaddr(cs, addr, addr + s_len, pd->extra, p_len);
+ pd->extra_size = 0;
+ if (find.is_init) {
+ stl_p(&m64c->FoundAddress, find.addr);
+ pd->m64.ReturnStatus = STATUS_SUCCESS;
+ } else {
+ pd->m64.ReturnStatus = STATUS_NO_MORE_ENTRIES;
+ }
+}
+
void kd_api_clear_all_internal_breakpoints(CPUState *cs, PacketData *pd)
{
}
diff --git a/windbgstub.c b/windbgstub.c
index 109a52b663..a50de68db5 100644
--- a/windbgstub.c
+++ b/windbgstub.c
@@ -224,6 +224,10 @@ static void windbg_process_manipulate_packet(WindbgState
*state)
kd_api_write_msr(cs, data);
break;
+ case DbgKdSearchMemoryApi:
+ kd_api_search_memory(cs, data);
+ break;
+
case DbgKdClearAllInternalBreakpointsApi:
kd_api_clear_all_internal_breakpoints(cs, data);
return;
- [Qemu-devel] [PATCH 2 26/39] windbg: implement kd_api_get_context and kd_api_set_context, (continued)
- [Qemu-devel] [PATCH 2 26/39] windbg: implement kd_api_get_context and kd_api_set_context, Mikhail Abakumov, 2018/12/05
- [Qemu-devel] [PATCH 2 27/39] windbg: implement kd_api_get_context_ex and kd_api_set_context_ex, Mikhail Abakumov, 2018/12/05
- [Qemu-devel] [PATCH 2 28/39] windbg: implement kd_api_read_control_space and kd_api_write_control_space, Mikhail Abakumov, 2018/12/05
- [Qemu-devel] [PATCH 2 29/39] windbg: implement kd_api_write_breakpoint and kd_api_restore_breakpoint, Mikhail Abakumov, 2018/12/05
- [Qemu-devel] [PATCH 2 30/39] windbg: debug exception subscribing, Mikhail Abakumov, 2018/12/05
- [Qemu-devel] [PATCH 2 31/39] windbg: implement kd_api_continue, Mikhail Abakumov, 2018/12/05
- [Qemu-devel] [PATCH 2 33/39] windbg: implement kd_api_read_physical_memory and kd_api_write_physical_memory, Mikhail Abakumov, 2018/12/05
- [Qemu-devel] [PATCH 2 32/39] windbg: implement kd_api_read_io_space and kd_api_write_io_space, Mikhail Abakumov, 2018/12/05
- [Qemu-devel] [PATCH 2 34/39] windbg: implement kd_api_get_version, Mikhail Abakumov, 2018/12/05
- [Qemu-devel] [PATCH 2 36/39] windbg: implement kd_api_search_memory,
Mikhail Abakumov <=
- [Qemu-devel] [PATCH 2 35/39] windbg: implement kd_api_read_msr and kd_api_write_msr, Mikhail Abakumov, 2018/12/05
- [Qemu-devel] [PATCH 2 37/39] windbg: implement kd_api_fill_memory, Mikhail Abakumov, 2018/12/05
- [Qemu-devel] [PATCH 2 38/39] windbg: implement kd_api_query_memory, Mikhail Abakumov, 2018/12/05
- [Qemu-devel] [PATCH 2 39/39] windbg: maintainers, Mikhail Abakumov, 2018/12/05
- Re: [Qemu-devel] [PATCH 2 00/39] Windbg supporting, no-reply, 2018/12/05
- Re: [Qemu-devel] [PATCH 2 00/39] Windbg supporting, no-reply, 2018/12/05
- Re: [Qemu-devel] [PATCH 2 00/39] Windbg supporting, no-reply, 2018/12/05