qemu-devel
[Top][All Lists]
Advanced

[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
 }




reply via email to

[Prev in Thread] Current Thread [Next in Thread]