diff options
author | Richard Henderson <rth@twiddle.net> | 2015-09-15 11:45:08 -0700 |
---|---|---|
committer | Eduardo Habkost <ehabkost@redhat.com> | 2015-10-23 12:59:27 -0200 |
commit | 93d00d0fbe4711061834730fb70525d167b6f908 (patch) | |
tree | 32e7d5e9545ff139ca92912129eae886cb28d438 /target-i386/bpt_helper.c | |
parent | e265e3e48049fbece9eaf536aa00ca41aa3c54d0 (diff) |
target-i386: Introduce cpu_x86_update_dr7
This moves the last of the iteration over breakpoints into
the bpt_helper.c file. This also allows us to make several
breakpoint functions static.
Signed-off-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
Diffstat (limited to 'target-i386/bpt_helper.c')
-rw-r--r-- | target-i386/bpt_helper.c | 29 |
1 files changed, 18 insertions, 11 deletions
diff --git a/target-i386/bpt_helper.c b/target-i386/bpt_helper.c index c071c24782..f14788a1e9 100644 --- a/target-i386/bpt_helper.c +++ b/target-i386/bpt_helper.c @@ -21,7 +21,8 @@ #include "exec/helper-proto.h" -void hw_breakpoint_insert(CPUX86State *env, int index) +#ifndef CONFIG_USER_ONLY +static void hw_breakpoint_insert(CPUX86State *env, int index) { CPUState *cs = CPU(x86_env_get_cpu(env)); int type = 0, err = 0; @@ -55,7 +56,7 @@ void hw_breakpoint_insert(CPUX86State *env, int index) } } -void hw_breakpoint_remove(CPUX86State *env, int index) +static void hw_breakpoint_remove(CPUX86State *env, int index) { CPUState *cs; @@ -79,6 +80,20 @@ void hw_breakpoint_remove(CPUX86State *env, int index) } } +void cpu_x86_update_dr7(CPUX86State *env, uint32_t new_dr7) +{ + int i; + + for (i = 0; i < DR7_MAX_BP; i++) { + hw_breakpoint_remove(env, i); + } + env->dr[7] = new_dr7; + for (i = 0; i < DR7_MAX_BP; i++) { + hw_breakpoint_insert(env, i); + } +} +#endif + static bool check_hw_breakpoints(CPUX86State *env, bool force_dr6_update) { target_ulong dr6; @@ -161,20 +176,12 @@ void helper_single_step(CPUX86State *env) void helper_movl_drN_T0(CPUX86State *env, int reg, target_ulong t0) { #ifndef CONFIG_USER_ONLY - int i; - if (reg < 4) { hw_breakpoint_remove(env, reg); env->dr[reg] = t0; hw_breakpoint_insert(env, reg); } else if (reg == 7) { - for (i = 0; i < DR7_MAX_BP; i++) { - hw_breakpoint_remove(env, i); - } - env->dr[7] = t0; - for (i = 0; i < DR7_MAX_BP; i++) { - hw_breakpoint_insert(env, i); - } + cpu_x86_update_dr7(env, t0); } else { env->dr[reg] = t0; } |