[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH v3 31/45] windbg: implemented windbg_set_dr
From: |
Mihail Abakumov |
Subject: |
[Qemu-devel] [PATCH v3 31/45] windbg: implemented windbg_set_dr |
Date: |
Tue, 21 Nov 2017 17:10:10 +0300 |
User-agent: |
StGit/0.17.1-dirty |
Defined useful macros for breakpoints.
Signed-off-by: Mihail Abakumov <address@hidden>
Signed-off-by: Pavel Dovgalyuk <address@hidden>
Signed-off-by: Dmitriy Koltunov <address@hidden>
---
target/i386/windbgstub.c | 50 +++++++++++++++++++++++++++++++++++++++++++++-
1 file changed, 49 insertions(+), 1 deletion(-)
diff --git a/target/i386/windbgstub.c b/target/i386/windbgstub.c
index c59d1401ad..14ad195107 100755
--- a/target/i386/windbgstub.c
+++ b/target/i386/windbgstub.c
@@ -14,6 +14,21 @@
#ifndef TARGET_X86_64
#include "exec/windbgstub-utils.h"
+#define IS_LOCAL_BP_ENABLED(dr7, index) (((dr7) >> ((index) * 2)) & 1)
+
+#define IS_GLOBAL_BP_ENABLED(dr7, index) (((dr7) >> ((index) * 2)) & 2)
+
+#define IS_BP_ENABLED(dr7, index) \
+ (IS_LOCAL_BP_ENABLED(dr7, index) | IS_GLOBAL_BP_ENABLED(dr7, index))
+
+#define BP_TYPE(dr7, index) \
+ ((int) ((dr7) >> (DR7_TYPE_SHIFT + ((index) * 4))) & 3)
+
+#define BP_LEN(dr7, index) ({ \
+ int _len = (((dr7) >> (DR7_LEN_SHIFT + ((index) * 4))) & 3); \
+ (_len == 2) ? 8 : _len + 1; \
+})
+
#ifdef TARGET_X86_64
# define OFFSET_SELF_PCR 0x18
# define OFFSET_VERS 0x108
@@ -273,9 +288,42 @@ typedef struct _CPU_KPROCESSOR_STATE {
CPU_KSPECIAL_REGISTERS SpecialRegisters;
} CPU_KPROCESSOR_STATE, *PCPU_KPROCESSOR_STATE;
-static void windbg_set_dr(CPUState *cpu, int index, target_ulong value)
+static int windbg_hw_breakpoint_insert(CPUState *cpu, int index)
+{
+ return 0;
+}
+
+static int windbg_hw_breakpoint_remove(CPUState *cpu, int index)
+{
+ return 0;
+}
+
+static void windbg_set_dr7(CPUState *cpu, target_ulong new_dr7)
{}
+static void windbg_set_dr(CPUState *cpu, int index, target_ulong value)
+{
+ CPUArchState *env = cpu->env_ptr;
+
+ switch (index) {
+ case 0 ... 3:
+ if (IS_BP_ENABLED(env->dr[7], index) && env->dr[index] != value) {
+ windbg_hw_breakpoint_remove(cpu, index);
+ env->dr[index] = value;
+ windbg_hw_breakpoint_insert(cpu, index);
+ } else {
+ env->dr[index] = value;
+ }
+ return;
+ case 6:
+ env->dr[6] = value | DR6_FIXED_1;
+ return;
+ case 7:
+ windbg_set_dr7(cpu, value);
+ return;
+ }
+}
+
static void windbg_set_sr(CPUState *cpu, int sr, uint16_t selector)
{
CPUArchState *env = cpu->env_ptr;
- [Qemu-devel] [PATCH v3 21/45] windbg: implemented windbg_process_manipulate_packet, (continued)
- [Qemu-devel] [PATCH v3 21/45] windbg: implemented windbg_process_manipulate_packet, Mihail Abakumov, 2017/11/21
- [Qemu-devel] [PATCH v3 24/45] windbg: implemented kd_api_get_context and kd_api_set_context, Mihail Abakumov, 2017/11/21
- [Qemu-devel] [PATCH v3 23/45] windbg: kernel's structures, Mihail Abakumov, 2017/11/21
- [Qemu-devel] [PATCH v3 26/45] windbg: implemented windbg_read_context, Mihail Abakumov, 2017/11/21
- [Qemu-devel] [PATCH v3 25/45] windbg: implemented kd_api_read_control_space and kd_api_write_control_space, Mihail Abakumov, 2017/11/21
- [Qemu-devel] [PATCH v3 27/45] windbg: implemented windbg_write_context, Mihail Abakumov, 2017/11/21
- [Qemu-devel] [PATCH v3 28/45] windbg: implemented windbg_read_ks_regs, Mihail Abakumov, 2017/11/21
- [Qemu-devel] [PATCH v3 29/45] windbg: implemented windbg_write_ks_regs, Mihail Abakumov, 2017/11/21
- [Qemu-devel] [PATCH v3 30/45] windbg: implemented windbg_set_sr, Mihail Abakumov, 2017/11/21
- [Qemu-devel] [PATCH v3 31/45] windbg: implemented windbg_set_dr,
Mihail Abakumov <=
- [Qemu-devel] [PATCH v3 32/45] windbg: implemented windbg_set_dr7, Mihail Abakumov, 2017/11/21
- [Qemu-devel] [PATCH v3 33/45] windbg: implemented windbg_hw_breakpoint_insert and windbg_hw_breakpoint_remove, Mihail Abakumov, 2017/11/21
- [Qemu-devel] [PATCH v3 34/45] windbg: implemented kd_api_write_breakpoint and kd_api_restore_breakpoint, Mihail Abakumov, 2017/11/21
- [Qemu-devel] [PATCH v3 35/45] windbg: debug exception subscribing, Mihail Abakumov, 2017/11/21
- [Qemu-devel] [PATCH v3 36/45] windbg: implemented kd_api_continue, Mihail Abakumov, 2017/11/21
- [Qemu-devel] [PATCH v3 37/45] windbg: implemented kd_api_read_io_space and kd_api_write_io_space, Mihail Abakumov, 2017/11/21
- [Qemu-devel] [PATCH v3 38/45] windbg: implemented kd_api_read_physical_memory and kd_api_write_physical_memory, Mihail Abakumov, 2017/11/21
- [Qemu-devel] [PATCH v3 39/45] windbg: implemented kd_api_get_version, Mihail Abakumov, 2017/11/21