[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH v3 08/39] windbg: implement windbg_on_load
From: |
Mikhail Abakumov |
Subject: |
[Qemu-devel] [PATCH v3 08/39] windbg: implement windbg_on_load |
Date: |
Thu, 06 Dec 2018 14:59:23 +0300 |
User-agent: |
StGit/0.17.1-dirty |
Define addresses that must be found on loading stage.
Signed-off-by: Mikhail Abakumov <address@hidden>
Signed-off-by: Pavel Dovgalyuk <address@hidden>
---
target/i386/windbgstub.c | 48 +++++++++++++++++++++++++++++++++++++++++++++-
1 file changed, 47 insertions(+), 1 deletion(-)
diff --git a/target/i386/windbgstub.c b/target/i386/windbgstub.c
index e55054c63d..1c1631d7c1 100644
--- a/target/i386/windbgstub.c
+++ b/target/i386/windbgstub.c
@@ -12,11 +12,57 @@
#include "qemu/osdep.h"
#include "exec/windbgstub-utils.h"
+static InitedAddr KPCR;
+#ifdef TARGET_X86_64
+static InitedAddr kdDebuggerDataBlock;
+#else /* TARGET_I386 */
+static InitedAddr kdVersion;
+#endif /* TARGET_I386 */
+
+static bool find_KPCR(CPUState *cs)
+{
+ return KPCR.is_init;
+}
+
+#ifdef TARGET_X86_64
+static bool find_kdDebuggerDataBlock(CPUState *cs)
+{
+ return kdDebuggerDataBlock.is_init;
+}
+#else /* TARGET_I386 */
+static bool find_kdVersion(CPUState *cs)
+{
+ return kdVersion.is_init;
+}
+#endif /* TARGET_I386 */
+
bool windbg_on_load(void)
{
- return false;
+ CPUState *cs = qemu_get_cpu(0);
+
+ if (!find_KPCR(cs)) {
+ return false;
+ }
+
+#ifdef TARGET_X86_64
+ if (!find_kdDebuggerDataBlock(cs)) {
+ return false;
+ }
+#else
+ if (!find_kdVersion(cs)) {
+ return false;
+ }
+#endif
+
+ return true;
}
void windbg_on_reset(void)
{
+ KPCR.is_init = false;
+#ifdef TARGET_X86_64
+ kdDebuggerDataBlock.is_init = false;
+#else
+ kdVersion.is_init = false;
+#endif
}
- [Qemu-devel] [PATCH v3 00/39] Windbg supporting, Mikhail Abakumov, 2018/12/06
- [Qemu-devel] [PATCH v3 01/39] windbg: add empty windbgstub files, Mikhail Abakumov, 2018/12/06
- [Qemu-devel] [PATCH v3 02/39] windbg: add windbg's KD header file, Mikhail Abakumov, 2018/12/06
- [Qemu-devel] [PATCH v3 03/39] windbg: add -windbg option, Mikhail Abakumov, 2018/12/06
- [Qemu-devel] [PATCH v3 04/39] windbg: add helper features, Mikhail Abakumov, 2018/12/06
- [Qemu-devel] [PATCH v3 05/39] windbg: add WindbgState, Mikhail Abakumov, 2018/12/06
- [Qemu-devel] [PATCH v3 06/39] windbg: add chardev, Mikhail Abakumov, 2018/12/06
- [Qemu-devel] [PATCH v3 07/39] windbg: hook to wrmsr operation, Mikhail Abakumov, 2018/12/06
- [Qemu-devel] [PATCH v3 08/39] windbg: implement windbg_on_load,
Mikhail Abakumov <=
- [Qemu-devel] [PATCH v3 09/39] windbg: implement find_KPCR, Mikhail Abakumov, 2018/12/06
- [Qemu-devel] [PATCH v3 10/39] windbg: implement find_kdVersion, Mikhail Abakumov, 2018/12/06
- [Qemu-devel] [PATCH v3 11/39] windbg: add windbg_search_vmaddr, Mikhail Abakumov, 2018/12/06
- [Qemu-devel] [PATCH v3 12/39] windbg: implement find_kdDebuggerDataBlock, Mikhail Abakumov, 2018/12/06
- [Qemu-devel] [PATCH v3 13/39] windbg: parsing data stream, Mikhail Abakumov, 2018/12/06
- [Qemu-devel] [PATCH v3 14/39] windbg: send data and control packets, Mikhail Abakumov, 2018/12/06
- [Qemu-devel] [PATCH v3 15/39] windbg: handler of parsing context, Mikhail Abakumov, 2018/12/06
- [Qemu-devel] [PATCH v3 16/39] windbg: init DBGKD_ANY_WAIT_STATE_CHANGE, Mikhail Abakumov, 2018/12/06
- [Qemu-devel] [PATCH v3 17/39] windbg: generate ExceptionStateChange and LoadSymbolsStateChange, Mikhail Abakumov, 2018/12/06
- [Qemu-devel] [PATCH v3 18/39] windbg: implement windbg_process_control_packet, Mikhail Abakumov, 2018/12/06