aboutsummaryrefslogtreecommitdiff
path: root/target-i386/helper.c
diff options
context:
space:
mode:
authorliguang <lig.fnst@cn.fujitsu.com>2013-01-15 08:01:07 +0100
committerAndreas Färber <afaerber@suse.de>2013-01-15 09:14:48 +0100
commit5902564ac983d67d7d898356971698b50b8f0b91 (patch)
treec0be48fad1310fd7cf2daf0fafba0b132ba7236f /target-i386/helper.c
parent428065ce50643a56bff043501809b62b035f0b17 (diff)
target-i386: Introduce hw_{local,global}_breakpoint_enabled()
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>
Diffstat (limited to 'target-i386/helper.c')
-rw-r--r--target-i386/helper.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/target-i386/helper.c b/target-i386/helper.c
index 1fceb91d34..ebdd6a563a 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)