[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH 2 08/39] windbg: implement windbg_on_load
From: |
Mikhail Abakumov |
Subject: |
[Qemu-devel] [PATCH 2 08/39] windbg: implement windbg_on_load |
Date: |
Wed, 05 Dec 2018 15:52:48 +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 2 00/39] Windbg supporting, Mikhail Abakumov, 2018/12/05
- [Qemu-devel] [PATCH 2 01/39] windbg: add empty windbgstub files, Mikhail Abakumov, 2018/12/05
- [Qemu-devel] [PATCH 2 02/39] windbg: add windbg's KD header file, Mikhail Abakumov, 2018/12/05
- [Qemu-devel] [PATCH 2 03/39] windbg: add -windbg option, Mikhail Abakumov, 2018/12/05
- [Qemu-devel] [PATCH 2 04/39] windbg: add helper features, Mikhail Abakumov, 2018/12/05
- [Qemu-devel] [PATCH 2 05/39] windbg: add WindbgState, Mikhail Abakumov, 2018/12/05
- [Qemu-devel] [PATCH 2 06/39] windbg: add chardev, Mikhail Abakumov, 2018/12/05
- [Qemu-devel] [PATCH 2 08/39] windbg: implement windbg_on_load,
Mikhail Abakumov <=
- [Qemu-devel] [PATCH 2 07/39] windbg: hook to wrmsr operation, Mikhail Abakumov, 2018/12/05
- [Qemu-devel] [PATCH 2 09/39] windbg: implement find_KPCR, Mikhail Abakumov, 2018/12/05
- [Qemu-devel] [PATCH 2 10/39] windbg: implement find_kdVersion, Mikhail Abakumov, 2018/12/05
- [Qemu-devel] [PATCH 2 11/39] windbg: add windbg_search_vmaddr, Mikhail Abakumov, 2018/12/05
- [Qemu-devel] [PATCH 2 12/39] windbg: implement find_kdDebuggerDataBlock, Mikhail Abakumov, 2018/12/05
- [Qemu-devel] [PATCH 2 13/39] windbg: parsing data stream, Mikhail Abakumov, 2018/12/05
- [Qemu-devel] [PATCH 2 14/39] windbg: send data and control packets, Mikhail Abakumov, 2018/12/05
- [Qemu-devel] [PATCH 2 15/39] windbg: handler of parsing context, Mikhail Abakumov, 2018/12/05
- [Qemu-devel] [PATCH 2 16/39] windbg: init DBGKD_ANY_WAIT_STATE_CHANGE, Mikhail Abakumov, 2018/12/05
- [Qemu-devel] [PATCH 2 17/39] windbg: generate ExceptionStateChange and LoadSymbolsStateChange, Mikhail Abakumov, 2018/12/05