qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH qom-cpu v6 0/4] target-i386: Clean up DR7 breakpoint handling
@ 2013-01-15  8:29 Andreas Färber
  2013-01-15  8:29 ` [Qemu-devel] [PATCH qom-cpu v6 1/4] target-i386: Define DR7 bit field constants Andreas Färber
                   ` (4 more replies)
  0 siblings, 5 replies; 7+ messages in thread
From: Andreas Färber @ 2013-01-15  8:29 UTC (permalink / raw)
  To: qemu-devel
  Cc: Peter Maydell, Eduardo Habkost, Jan Kiszka, Igor Mammedov,
	Andreas Färber, lig.fnst

Hello Guang,

Are you okay with this version?

Regards,
Andreas

v5 -> v6:
* Fix bisectability by deferring use of hw_{local,global}_breakpoint_enabled().
* Reword the commit messages for clarity.
* Squash more constant usage into first patch.
* Reorder DATA_RW and DATA_WR to match original switch cases.
* Untangle introduction of breakpoint helper functions from goto/if refactorings.
* Make hw_breakpoint_enabled() return bool.
* Keep IO_RW in place for patch readability.
* Keep reg variable name for patch readability.
* Move {bp,wp}_match inside loop to clarify scope and to avoid double false init.
* Make check_hw_breakpoints() return bool, change force_dr6_update arg to bool.

changes v4->v5:

- fix some not well formated changes.
- split functional and non-functional changes for cherry-picking
suggested by Andreas Färber <afaerber@suse.de>

changes v3->v4:

- fix wrong logic of hw_{global,local}_breakpoint_enabled usage
suggested by Peter Maydell <peter.maydell@linaro.org>

changes v2->v3:

- split hw_breakpoint_enabled into hw_{global,local}_breakpoint_enabled

changes v1->v2:

- add _TYPE_ to the name of dr7 bit field
- fix some coding styles
suggested by Peter Maydell <peter.maydell@linaro.org>

Cc: liguang <lig.fnst@cn.fujitsu.com>
Cc: Eduardo Habkost <ehabkost@redhat.com>
Cc: Igor Mammedov <imammedo@redhat.com>
Cc: Jan Kiszka <jan.kiszka@siemens.com>
Cc: Peter Maydell <peter.maydell@linaro.org>

liguang (4):
  target-i386: Define DR7 bit field constants
  target-i386: Introduce hw_{local,global}_breakpoint_enabled()
  target-i386: Avoid goto in hw_breakpoint_insert()
  target-i386: Use switch in check_hw_breakpoints()

 target-i386/cpu.h         |   23 ++++++++++--
 target-i386/helper.c      |   87 +++++++++++++++++++++++++++++----------------
 target-i386/machine.c     |    5 +--
 target-i386/misc_helper.c |    6 ++--
 target-i386/seg_helper.c  |    9 ++---
 5 Dateien geändert, 88 Zeilen hinzugefügt(+), 42 Zeilen entfernt(-)

-- 
1.7.10.4

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [Qemu-devel] [PATCH qom-cpu v6 1/4] target-i386: Define DR7 bit field constants
  2013-01-15  8:29 [Qemu-devel] [PATCH qom-cpu v6 0/4] target-i386: Clean up DR7 breakpoint handling Andreas Färber
@ 2013-01-15  8:29 ` Andreas Färber
  2013-01-15  8:29 ` [Qemu-devel] [PATCH qom-cpu v6 2/4] target-i386: Introduce hw_{local, global}_breakpoint_enabled() Andreas Färber
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 7+ messages in thread
From: Andreas Färber @ 2013-01-15  8:29 UTC (permalink / raw)
  To: qemu-devel; +Cc: Andreas Färber, lig.fnst

From: liguang <lig.fnst@cn.fujitsu.com>

Implicit use of dr7 bit field is a little hard to understand,
so define constants for them and use them consistently.

Signed-off-by: liguang <lig.fnst@cn.fujitsu.com>
Signed-off-by: Andreas Färber <afaerber@suse.de>
---
 target-i386/cpu.h         |    6 ++++++
 target-i386/helper.c      |   18 +++++++++---------
 target-i386/machine.c     |    5 +++--
 target-i386/misc_helper.c |    4 ++--
 target-i386/seg_helper.c  |    6 +++---
 5 Dateien geändert, 23 Zeilen hinzugefügt(+), 16 Zeilen entfernt(-)

diff --git a/target-i386/cpu.h b/target-i386/cpu.h
index e4a7c50..6682022 100644
--- a/target-i386/cpu.h
+++ b/target-i386/cpu.h
@@ -231,6 +231,12 @@
 #define DR7_TYPE_SHIFT  16
 #define DR7_LEN_SHIFT   18
 #define DR7_FIXED_1     0x00000400
+#define DR7_LOCAL_BP_MASK    0x55
+#define DR7_MAX_BP           4
+#define DR7_TYPE_BP_INST     0x0
+#define DR7_TYPE_DATA_WR     0x1
+#define DR7_TYPE_IO_RW       0x2
+#define DR7_TYPE_DATA_RW     0x3
 
 #define PG_PRESENT_BIT	0
 #define PG_RW_BIT	1
diff --git a/target-i386/helper.c b/target-i386/helper.c
index fa622e1..1fceb91 100644
--- a/target-i386/helper.c
+++ b/target-i386/helper.c
@@ -969,18 +969,18 @@ void hw_breakpoint_insert(CPUX86State *env, int index)
     int type, err = 0;
 
     switch (hw_breakpoint_type(env->dr[7], index)) {
-    case 0:
+    case DR7_TYPE_BP_INST:
         if (hw_breakpoint_enabled(env->dr[7], index))
             err = cpu_breakpoint_insert(env, env->dr[index], BP_CPU,
                                         &env->cpu_breakpoint[index]);
         break;
-    case 1:
+    case DR7_TYPE_DATA_WR:
         type = BP_CPU | BP_MEM_WRITE;
         goto insert_wp;
-    case 2:
+    case DR7_TYPE_IO_RW:
          /* No support for I/O watchpoints yet */
         break;
-    case 3:
+    case DR7_TYPE_DATA_RW:
         type = BP_CPU | BP_MEM_ACCESS;
     insert_wp:
         err = cpu_watchpoint_insert(env, env->dr[index],
@@ -997,15 +997,15 @@ void hw_breakpoint_remove(CPUX86State *env, int index)
     if (!env->cpu_breakpoint[index])
         return;
     switch (hw_breakpoint_type(env->dr[7], index)) {
-    case 0:
+    case DR7_TYPE_BP_INST:
         if (hw_breakpoint_enabled(env->dr[7], index))
             cpu_breakpoint_remove_by_ref(env, env->cpu_breakpoint[index]);
         break;
-    case 1:
-    case 3:
+    case DR7_TYPE_DATA_WR:
+    case DR7_TYPE_DATA_RW:
         cpu_watchpoint_remove_by_ref(env, env->cpu_watchpoint[index]);
         break;
-    case 2:
+    case DR7_TYPE_IO_RW:
         /* No support for I/O watchpoints yet */
         break;
     }
@@ -1018,7 +1018,7 @@ int check_hw_breakpoints(CPUX86State *env, int force_dr6_update)
     int hit_enabled = 0;
 
     dr6 = env->dr[6] & ~0xf;
-    for (reg = 0; reg < 4; reg++) {
+    for (reg = 0; reg < DR7_MAX_BP; reg++) {
         type = hw_breakpoint_type(env->dr[7], reg);
         if ((type == 0 && env->dr[reg] == env->eip) ||
             ((type & 1) && env->cpu_watchpoint[reg] &&
diff --git a/target-i386/machine.c b/target-i386/machine.c
index 8354572..8df6a6b 100644
--- a/target-i386/machine.c
+++ b/target-i386/machine.c
@@ -265,10 +265,11 @@ static int cpu_post_load(void *opaque, int version_id)
 
     cpu_breakpoint_remove_all(env, BP_CPU);
     cpu_watchpoint_remove_all(env, BP_CPU);
-    for (i = 0; i < 4; i++)
+    for (i = 0; i < DR7_MAX_BP; i++) {
         hw_breakpoint_insert(env, i);
-
+    }
     tlb_flush(env, 1);
+
     return 0;
 }
 
diff --git a/target-i386/misc_helper.c b/target-i386/misc_helper.c
index 719cacd..b3f4e4f 100644
--- a/target-i386/misc_helper.c
+++ b/target-i386/misc_helper.c
@@ -197,11 +197,11 @@ void helper_movl_drN_T0(CPUX86State *env, int reg, target_ulong t0)
         env->dr[reg] = t0;
         hw_breakpoint_insert(env, reg);
     } else if (reg == 7) {
-        for (i = 0; i < 4; i++) {
+        for (i = 0; i < DR7_MAX_BP; i++) {
             hw_breakpoint_remove(env, i);
         }
         env->dr[7] = t0;
-        for (i = 0; i < 4; i++) {
+        for (i = 0; i < DR7_MAX_BP; i++) {
             hw_breakpoint_insert(env, i);
         }
     } else {
diff --git a/target-i386/seg_helper.c b/target-i386/seg_helper.c
index c2a99ee..c40bd96 100644
--- a/target-i386/seg_helper.c
+++ b/target-i386/seg_helper.c
@@ -465,13 +465,13 @@ static void switch_tss(CPUX86State *env, int tss_selector,
 
 #ifndef CONFIG_USER_ONLY
     /* reset local breakpoints */
-    if (env->dr[7] & 0x55) {
-        for (i = 0; i < 4; i++) {
+    if (env->dr[7] & DR7_LOCAL_BP_MASK) {
+        for (i = 0; i < DR7_MAX_BP; i++) {
             if (hw_breakpoint_enabled(env->dr[7], i) == 0x1) {
                 hw_breakpoint_remove(env, i);
             }
         }
-        env->dr[7] &= ~0x55;
+        env->dr[7] &= ~DR7_LOCAL_BP_MASK;
     }
 #endif
 }
-- 
1.7.10.4

^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [Qemu-devel] [PATCH qom-cpu v6 2/4] target-i386: Introduce hw_{local, global}_breakpoint_enabled()
  2013-01-15  8:29 [Qemu-devel] [PATCH qom-cpu v6 0/4] target-i386: Clean up DR7 breakpoint handling Andreas Färber
  2013-01-15  8:29 ` [Qemu-devel] [PATCH qom-cpu v6 1/4] target-i386: Define DR7 bit field constants Andreas Färber
@ 2013-01-15  8:29 ` Andreas Färber
  2013-01-15  8:29 ` [Qemu-devel] [PATCH qom-cpu v6 3/4] target-i386: Avoid goto in hw_breakpoint_insert() Andreas Färber
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 7+ messages in thread
From: Andreas Färber @ 2013-01-15  8:29 UTC (permalink / raw)
  To: qemu-devel; +Cc: Andreas Färber, lig.fnst

From: liguang <lig.fnst@cn.fujitsu.com>

hw_breakpoint_enabled() returned a bit field indicating whether a local
breakpoint and/or global breakpoint was enabled. Avoid this number magic
by using explicit boolean helper functions hw_local_breakpoint_enabled()
and hw_global_breakpoint_enabled(), to aid readability.

Reuse them for the hw_breakpoint_enabled() implementation and change
its return type to bool.

While at it, fix Coding Style issues (missing braces).

Signed-off-by: liguang <lig.fnst@cn.fujitsu.com>
Signed-off-by: Andreas Färber <afaerber@suse.de>
---
 target-i386/cpu.h        |   15 +++++++++++++--
 target-i386/helper.c     |    9 ++++++---
 target-i386/seg_helper.c |    3 ++-
 3 Dateien geändert, 21 Zeilen hinzugefügt(+), 6 Zeilen entfernt(-)

diff --git a/target-i386/cpu.h b/target-i386/cpu.h
index 6682022..1e850a7 100644
--- a/target-i386/cpu.h
+++ b/target-i386/cpu.h
@@ -1014,9 +1014,20 @@ int cpu_x86_handle_mmu_fault(CPUX86State *env, target_ulong addr,
 #define cpu_handle_mmu_fault cpu_x86_handle_mmu_fault
 void cpu_x86_set_a20(CPUX86State *env, int a20_state);
 
-static inline int hw_breakpoint_enabled(unsigned long dr7, int index)
+static inline bool hw_local_breakpoint_enabled(unsigned long dr7, int index)
 {
-    return (dr7 >> (index * 2)) & 3;
+    return (dr7 >> (index * 2)) & 1;
+}
+
+static inline bool hw_global_breakpoint_enabled(unsigned long dr7, int index)
+{
+    return (dr7 >> (index * 2)) & 2;
+
+}
+static inline bool hw_breakpoint_enabled(unsigned long dr7, int index)
+{
+    return hw_global_breakpoint_enabled(dr7, index) ||
+           hw_local_breakpoint_enabled(dr7, index);
 }
 
 static inline int hw_breakpoint_type(unsigned long dr7, int index)
diff --git a/target-i386/helper.c b/target-i386/helper.c
index 1fceb91..ebdd6a5 100644
--- a/target-i386/helper.c
+++ b/target-i386/helper.c
@@ -970,9 +970,10 @@ void hw_breakpoint_insert(CPUX86State *env, int index)
 
     switch (hw_breakpoint_type(env->dr[7], index)) {
     case DR7_TYPE_BP_INST:
-        if (hw_breakpoint_enabled(env->dr[7], index))
+        if (hw_breakpoint_enabled(env->dr[7], index)) {
             err = cpu_breakpoint_insert(env, env->dr[index], BP_CPU,
                                         &env->cpu_breakpoint[index]);
+        }
         break;
     case DR7_TYPE_DATA_WR:
         type = BP_CPU | BP_MEM_WRITE;
@@ -998,8 +999,9 @@ void hw_breakpoint_remove(CPUX86State *env, int index)
         return;
     switch (hw_breakpoint_type(env->dr[7], index)) {
     case DR7_TYPE_BP_INST:
-        if (hw_breakpoint_enabled(env->dr[7], index))
+        if (hw_breakpoint_enabled(env->dr[7], index)) {
             cpu_breakpoint_remove_by_ref(env, env->cpu_breakpoint[index]);
+        }
         break;
     case DR7_TYPE_DATA_WR:
     case DR7_TYPE_DATA_RW:
@@ -1024,8 +1026,9 @@ int check_hw_breakpoints(CPUX86State *env, int force_dr6_update)
             ((type & 1) && env->cpu_watchpoint[reg] &&
              (env->cpu_watchpoint[reg]->flags & BP_WATCHPOINT_HIT))) {
             dr6 |= 1 << reg;
-            if (hw_breakpoint_enabled(env->dr[7], reg))
+            if (hw_breakpoint_enabled(env->dr[7], reg)) {
                 hit_enabled = 1;
+            }
         }
     }
     if (hit_enabled || force_dr6_update)
diff --git a/target-i386/seg_helper.c b/target-i386/seg_helper.c
index c40bd96..3247dee 100644
--- a/target-i386/seg_helper.c
+++ b/target-i386/seg_helper.c
@@ -467,7 +467,8 @@ static void switch_tss(CPUX86State *env, int tss_selector,
     /* reset local breakpoints */
     if (env->dr[7] & DR7_LOCAL_BP_MASK) {
         for (i = 0; i < DR7_MAX_BP; i++) {
-            if (hw_breakpoint_enabled(env->dr[7], i) == 0x1) {
+            if (hw_local_breakpoint_enabled(env->dr[7], i) &&
+                !hw_global_breakpoint_enabled(env->dr[7], i)) {
                 hw_breakpoint_remove(env, i);
             }
         }
-- 
1.7.10.4

^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [Qemu-devel] [PATCH qom-cpu v6 3/4] target-i386: Avoid goto in hw_breakpoint_insert()
  2013-01-15  8:29 [Qemu-devel] [PATCH qom-cpu v6 0/4] target-i386: Clean up DR7 breakpoint handling Andreas Färber
  2013-01-15  8:29 ` [Qemu-devel] [PATCH qom-cpu v6 1/4] target-i386: Define DR7 bit field constants Andreas Färber
  2013-01-15  8:29 ` [Qemu-devel] [PATCH qom-cpu v6 2/4] target-i386: Introduce hw_{local, global}_breakpoint_enabled() Andreas Färber
@ 2013-01-15  8:29 ` Andreas Färber
  2013-01-15  8:29 ` [Qemu-devel] [PATCH qom-cpu v6 4/4] target-i386: Use switch in check_hw_breakpoints() Andreas Färber
  2013-01-15  8:49 ` [Qemu-devel] [PATCH qom-cpu v6 0/4] target-i386: Clean up DR7 breakpoint handling li guang
  4 siblings, 0 replies; 7+ messages in thread
From: Andreas Färber @ 2013-01-15  8:29 UTC (permalink / raw)
  To: qemu-devel; +Cc: Andreas Färber, lig.fnst

From: liguang <lig.fnst@cn.fujitsu.com>

  "Go To Statement Considered Harmful" -- E. Dijkstra

To avoid an unnecessary goto within the switch statement, move
watchpoint insertion out of the switch statement. Improves readability.

While at it, fix Coding Style issues (missing braces, indentation).

Signed-off-by: liguang <lig.fnst@cn.fujitsu.com>
Signed-off-by: Andreas Färber <afaerber@suse.de>
---
 target-i386/helper.c |   16 ++++++++++------
 1 Datei geändert, 10 Zeilen hinzugefügt(+), 6 Zeilen entfernt(-)

diff --git a/target-i386/helper.c b/target-i386/helper.c
index ebdd6a5..a10b562 100644
--- a/target-i386/helper.c
+++ b/target-i386/helper.c
@@ -966,7 +966,7 @@ hwaddr cpu_get_phys_page_debug(CPUX86State *env, target_ulong addr)
 
 void hw_breakpoint_insert(CPUX86State *env, int index)
 {
-    int type, err = 0;
+    int type = 0, err = 0;
 
     switch (hw_breakpoint_type(env->dr[7], index)) {
     case DR7_TYPE_BP_INST:
@@ -977,20 +977,24 @@ void hw_breakpoint_insert(CPUX86State *env, int index)
         break;
     case DR7_TYPE_DATA_WR:
         type = BP_CPU | BP_MEM_WRITE;
-        goto insert_wp;
+        break;
     case DR7_TYPE_IO_RW:
-         /* No support for I/O watchpoints yet */
+        /* No support for I/O watchpoints yet */
         break;
     case DR7_TYPE_DATA_RW:
         type = BP_CPU | BP_MEM_ACCESS;
-    insert_wp:
+        break;
+    }
+
+    if (type != 0) {
         err = cpu_watchpoint_insert(env, env->dr[index],
                                     hw_breakpoint_len(env->dr[7], index),
                                     type, &env->cpu_watchpoint[index]);
-        break;
     }
-    if (err)
+
+    if (err) {
         env->cpu_breakpoint[index] = NULL;
+    }
 }
 
 void hw_breakpoint_remove(CPUX86State *env, int index)
-- 
1.7.10.4

^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [Qemu-devel] [PATCH qom-cpu v6 4/4] target-i386: Use switch in check_hw_breakpoints()
  2013-01-15  8:29 [Qemu-devel] [PATCH qom-cpu v6 0/4] target-i386: Clean up DR7 breakpoint handling Andreas Färber
                   ` (2 preceding siblings ...)
  2013-01-15  8:29 ` [Qemu-devel] [PATCH qom-cpu v6 3/4] target-i386: Avoid goto in hw_breakpoint_insert() Andreas Färber
@ 2013-01-15  8:29 ` Andreas Färber
  2013-01-15  8:49 ` [Qemu-devel] [PATCH qom-cpu v6 0/4] target-i386: Clean up DR7 breakpoint handling li guang
  4 siblings, 0 replies; 7+ messages in thread
From: Andreas Färber @ 2013-01-15  8:29 UTC (permalink / raw)
  To: qemu-devel; +Cc: Andreas Färber, lig.fnst

From: liguang <lig.fnst@cn.fujitsu.com>

Replace an if statement using magic numbers for breakpoint type with a
more explicit switch statement. This is to aid readability.

Change the return type and force_dr6_update argument type to bool.

While at it, fix Coding Style issues (missing braces).

Signed-off-by: liguang <lig.fnst@cn.fujitsu.com>
Signed-off-by: Andreas Färber <afaerber@suse.de>
---
 target-i386/cpu.h         |    2 +-
 target-i386/helper.c      |   44 ++++++++++++++++++++++++++++++++------------
 target-i386/misc_helper.c |    2 +-
 3 Dateien geändert, 34 Zeilen hinzugefügt(+), 14 Zeilen entfernt(-)

diff --git a/target-i386/cpu.h b/target-i386/cpu.h
index 1e850a7..4e091cd 100644
--- a/target-i386/cpu.h
+++ b/target-i386/cpu.h
@@ -1043,7 +1043,7 @@ static inline int hw_breakpoint_len(unsigned long dr7, int index)
 
 void hw_breakpoint_insert(CPUX86State *env, int index);
 void hw_breakpoint_remove(CPUX86State *env, int index);
-int check_hw_breakpoints(CPUX86State *env, int force_dr6_update);
+bool check_hw_breakpoints(CPUX86State *env, bool force_dr6_update);
 void breakpoint_handler(CPUX86State *env);
 
 /* will be suppressed */
diff --git a/target-i386/helper.c b/target-i386/helper.c
index a10b562..547c25e 100644
--- a/target-i386/helper.c
+++ b/target-i386/helper.c
@@ -1017,26 +1017,45 @@ void hw_breakpoint_remove(CPUX86State *env, int index)
     }
 }
 
-int check_hw_breakpoints(CPUX86State *env, int force_dr6_update)
+bool check_hw_breakpoints(CPUX86State *env, bool force_dr6_update)
 {
     target_ulong dr6;
-    int reg, type;
-    int hit_enabled = 0;
+    int reg;
+    bool hit_enabled = false;
 
     dr6 = env->dr[6] & ~0xf;
     for (reg = 0; reg < DR7_MAX_BP; reg++) {
-        type = hw_breakpoint_type(env->dr[7], reg);
-        if ((type == 0 && env->dr[reg] == env->eip) ||
-            ((type & 1) && env->cpu_watchpoint[reg] &&
-             (env->cpu_watchpoint[reg]->flags & BP_WATCHPOINT_HIT))) {
+        bool bp_match = false;
+        bool wp_match = false;
+
+        switch (hw_breakpoint_type(env->dr[7], reg)) {
+        case DR7_TYPE_BP_INST:
+            if (env->dr[reg] == env->eip) {
+                bp_match = true;
+            }
+            break;
+        case DR7_TYPE_DATA_WR:
+        case DR7_TYPE_DATA_RW:
+            if (env->cpu_watchpoint[reg] &&
+                env->cpu_watchpoint[reg]->flags & BP_WATCHPOINT_HIT) {
+                wp_match = true;
+            }
+            break;
+        case DR7_TYPE_IO_RW:
+            break;
+        }
+        if (bp_match || wp_match) {
             dr6 |= 1 << reg;
             if (hw_breakpoint_enabled(env->dr[7], reg)) {
-                hit_enabled = 1;
+                hit_enabled = true;
             }
         }
     }
-    if (hit_enabled || force_dr6_update)
+
+    if (hit_enabled || force_dr6_update) {
         env->dr[6] = dr6;
+    }
+
     return hit_enabled;
 }
 
@@ -1047,16 +1066,17 @@ void breakpoint_handler(CPUX86State *env)
     if (env->watchpoint_hit) {
         if (env->watchpoint_hit->flags & BP_CPU) {
             env->watchpoint_hit = NULL;
-            if (check_hw_breakpoints(env, 0))
+            if (check_hw_breakpoints(env, false)) {
                 raise_exception(env, EXCP01_DB);
-            else
+            } else {
                 cpu_resume_from_signal(env, NULL);
+            }
         }
     } else {
         QTAILQ_FOREACH(bp, &env->breakpoints, entry)
             if (bp->pc == env->eip) {
                 if (bp->flags & BP_CPU) {
-                    check_hw_breakpoints(env, 1);
+                    check_hw_breakpoints(env, true);
                     raise_exception(env, EXCP01_DB);
                 }
                 break;
diff --git a/target-i386/misc_helper.c b/target-i386/misc_helper.c
index b3f4e4f..b6d5740 100644
--- a/target-i386/misc_helper.c
+++ b/target-i386/misc_helper.c
@@ -110,7 +110,7 @@ void helper_into(CPUX86State *env, int next_eip_addend)
 void helper_single_step(CPUX86State *env)
 {
 #ifndef CONFIG_USER_ONLY
-    check_hw_breakpoints(env, 1);
+    check_hw_breakpoints(env, true);
     env->dr[6] |= DR6_BS;
 #endif
     raise_exception(env, EXCP01_DB);
-- 
1.7.10.4

^ permalink raw reply related	[flat|nested] 7+ messages in thread

* Re: [Qemu-devel] [PATCH qom-cpu v6 0/4] target-i386: Clean up DR7 breakpoint handling
  2013-01-15  8:29 [Qemu-devel] [PATCH qom-cpu v6 0/4] target-i386: Clean up DR7 breakpoint handling Andreas Färber
                   ` (3 preceding siblings ...)
  2013-01-15  8:29 ` [Qemu-devel] [PATCH qom-cpu v6 4/4] target-i386: Use switch in check_hw_breakpoints() Andreas Färber
@ 2013-01-15  8:49 ` li guang
  2013-01-15  9:18   ` Andreas Färber
  4 siblings, 1 reply; 7+ messages in thread
From: li guang @ 2013-01-15  8:49 UTC (permalink / raw)
  To: Andreas Färber
  Cc: Peter Maydell, Igor Mammedov, Jan Kiszka, qemu-devel,
	Eduardo Habkost

Thanks for your smooth work!

fine for me.


在 2013-01-15二的 09:29 +0100,Andreas Färber写道:
> Hello Guang,
> 
> Are you okay with this version?
> 
> Regards,
> Andreas
> 
> v5 -> v6:
> * Fix bisectability by deferring use of hw_{local,global}_breakpoint_enabled().
> * Reword the commit messages for clarity.
> * Squash more constant usage into first patch.
> * Reorder DATA_RW and DATA_WR to match original switch cases.
> * Untangle introduction of breakpoint helper functions from goto/if refactorings.
> * Make hw_breakpoint_enabled() return bool.
> * Keep IO_RW in place for patch readability.
> * Keep reg variable name for patch readability.
> * Move {bp,wp}_match inside loop to clarify scope and to avoid double false init.
> * Make check_hw_breakpoints() return bool, change force_dr6_update arg to bool.
> 
> changes v4->v5:
> 
> - fix some not well formated changes.
> - split functional and non-functional changes for cherry-picking
> suggested by Andreas Färber <afaerber@suse.de>
> 
> changes v3->v4:
> 
> - fix wrong logic of hw_{global,local}_breakpoint_enabled usage
> suggested by Peter Maydell <peter.maydell@linaro.org>
> 
> changes v2->v3:
> 
> - split hw_breakpoint_enabled into hw_{global,local}_breakpoint_enabled
> 
> changes v1->v2:
> 
> - add _TYPE_ to the name of dr7 bit field
> - fix some coding styles
> suggested by Peter Maydell <peter.maydell@linaro.org>
> 
> Cc: liguang <lig.fnst@cn.fujitsu.com>
> Cc: Eduardo Habkost <ehabkost@redhat.com>
> Cc: Igor Mammedov <imammedo@redhat.com>
> Cc: Jan Kiszka <jan.kiszka@siemens.com>
> Cc: Peter Maydell <peter.maydell@linaro.org>
> 
> liguang (4):
>   target-i386: Define DR7 bit field constants
>   target-i386: Introduce hw_{local,global}_breakpoint_enabled()
>   target-i386: Avoid goto in hw_breakpoint_insert()
>   target-i386: Use switch in check_hw_breakpoints()
> 
>  target-i386/cpu.h         |   23 ++++++++++--
>  target-i386/helper.c      |   87 +++++++++++++++++++++++++++++----------------
>  target-i386/machine.c     |    5 +--
>  target-i386/misc_helper.c |    6 ++--
>  target-i386/seg_helper.c  |    9 ++---
>  5 Dateien geändert, 88 Zeilen hinzugefügt(+), 42 Zeilen entfernt(-)
> 

-- 
regards!
li guang

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [Qemu-devel] [PATCH qom-cpu v6 0/4] target-i386: Clean up DR7 breakpoint handling
  2013-01-15  8:49 ` [Qemu-devel] [PATCH qom-cpu v6 0/4] target-i386: Clean up DR7 breakpoint handling li guang
@ 2013-01-15  9:18   ` Andreas Färber
  0 siblings, 0 replies; 7+ messages in thread
From: Andreas Färber @ 2013-01-15  9:18 UTC (permalink / raw)
  To: li guang
  Cc: Peter Maydell, Igor Mammedov, Jan Kiszka, qemu-devel,
	Eduardo Habkost

Am 15.01.2013 09:49, schrieb li guang:
> Thanks for your smooth work!
> 
> fine for me.

Thanks, applied to qom-cpu:
https://github.com/afaerber/qemu-cpu/commits/qom-cpu

Andreas

> 在 2013-01-15二的 09:29 +0100,Andreas Färber写道:
>> Hello Guang,
>>
>> Are you okay with this version?
>>
>> Regards,
>> Andreas
>>
>> v5 -> v6:
>> * Fix bisectability by deferring use of hw_{local,global}_breakpoint_enabled().
>> * Reword the commit messages for clarity.
>> * Squash more constant usage into first patch.
>> * Reorder DATA_RW and DATA_WR to match original switch cases.
>> * Untangle introduction of breakpoint helper functions from goto/if refactorings.
>> * Make hw_breakpoint_enabled() return bool.
>> * Keep IO_RW in place for patch readability.
>> * Keep reg variable name for patch readability.
>> * Move {bp,wp}_match inside loop to clarify scope and to avoid double false init.
>> * Make check_hw_breakpoints() return bool, change force_dr6_update arg to bool.
>>
>> changes v4->v5:
>>
>> - fix some not well formated changes.
>> - split functional and non-functional changes for cherry-picking
>> suggested by Andreas Färber <afaerber@suse.de>
>>
>> changes v3->v4:
>>
>> - fix wrong logic of hw_{global,local}_breakpoint_enabled usage
>> suggested by Peter Maydell <peter.maydell@linaro.org>
>>
>> changes v2->v3:
>>
>> - split hw_breakpoint_enabled into hw_{global,local}_breakpoint_enabled
>>
>> changes v1->v2:
>>
>> - add _TYPE_ to the name of dr7 bit field
>> - fix some coding styles
>> suggested by Peter Maydell <peter.maydell@linaro.org>
>>
>> Cc: liguang <lig.fnst@cn.fujitsu.com>
>> Cc: Eduardo Habkost <ehabkost@redhat.com>
>> Cc: Igor Mammedov <imammedo@redhat.com>
>> Cc: Jan Kiszka <jan.kiszka@siemens.com>
>> Cc: Peter Maydell <peter.maydell@linaro.org>
>>
>> liguang (4):
>>   target-i386: Define DR7 bit field constants
>>   target-i386: Introduce hw_{local,global}_breakpoint_enabled()
>>   target-i386: Avoid goto in hw_breakpoint_insert()
>>   target-i386: Use switch in check_hw_breakpoints()
>>
>>  target-i386/cpu.h         |   23 ++++++++++--
>>  target-i386/helper.c      |   87 +++++++++++++++++++++++++++++----------------
>>  target-i386/machine.c     |    5 +--
>>  target-i386/misc_helper.c |    6 ++--
>>  target-i386/seg_helper.c  |    9 ++---
>>  5 Dateien geändert, 88 Zeilen hinzugefügt(+), 42 Zeilen entfernt(-)
>>
> 


-- 
SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 Nürnberg, Germany
GF: Jeff Hawn, Jennifer Guild, Felix Imendörffer; HRB 16746 AG Nürnberg

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2013-01-15  9:18 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-01-15  8:29 [Qemu-devel] [PATCH qom-cpu v6 0/4] target-i386: Clean up DR7 breakpoint handling Andreas Färber
2013-01-15  8:29 ` [Qemu-devel] [PATCH qom-cpu v6 1/4] target-i386: Define DR7 bit field constants Andreas Färber
2013-01-15  8:29 ` [Qemu-devel] [PATCH qom-cpu v6 2/4] target-i386: Introduce hw_{local, global}_breakpoint_enabled() Andreas Färber
2013-01-15  8:29 ` [Qemu-devel] [PATCH qom-cpu v6 3/4] target-i386: Avoid goto in hw_breakpoint_insert() Andreas Färber
2013-01-15  8:29 ` [Qemu-devel] [PATCH qom-cpu v6 4/4] target-i386: Use switch in check_hw_breakpoints() Andreas Färber
2013-01-15  8:49 ` [Qemu-devel] [PATCH qom-cpu v6 0/4] target-i386: Clean up DR7 breakpoint handling li guang
2013-01-15  9:18   ` Andreas Färber

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).