From 805e0ba7b25b9a022be342ac7fda669aae12bba3 Mon Sep 17 00:00:00 2001 From: Richard Henderson Date: Fri, 16 Feb 2018 16:10:26 -0500 Subject: [PATCH] target-i386: Move hw_*breakpoint_* functions They're only used from bpt_helper.c now. Backports commit 696ad9e4b27a49a9706010d00b31b17fe1f0d569 from qemu --- qemu/target-i386/bpt_helper.c | 29 ++++++++++++++++++++++++++++- qemu/target-i386/cpu.h | 27 --------------------------- 2 files changed, 28 insertions(+), 28 deletions(-) diff --git a/qemu/target-i386/bpt_helper.c b/qemu/target-i386/bpt_helper.c index 180a3755..e4605093 100644 --- a/qemu/target-i386/bpt_helper.c +++ b/qemu/target-i386/bpt_helper.c @@ -21,6 +21,33 @@ #include "exec/helper-proto.h" #ifndef CONFIG_USER_ONLY +static inline bool hw_local_breakpoint_enabled(unsigned long dr7, int index) +{ + 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) +{ + return (dr7 >> (DR7_TYPE_SHIFT + (index * 4))) & 3; +} + +static inline int hw_breakpoint_len(unsigned long dr7, int index) +{ + int len = ((dr7 >> (DR7_LEN_SHIFT + (index * 4))) & 3); + return (len == 2) ? 8 : len + 1; +} + static void hw_breakpoint_insert(CPUX86State *env, int index) { CPUState *cs = CPU(x86_env_get_cpu(env)); @@ -115,7 +142,6 @@ void cpu_x86_update_dr7(CPUX86State *env, uint32_t new_dr7) } } } -#endif static bool check_hw_breakpoints(CPUX86State *env, bool force_dr6_update) { @@ -186,6 +212,7 @@ void breakpoint_handler(CPUState *cs) } } } +#endif void helper_single_step(CPUX86State *env) { diff --git a/qemu/target-i386/cpu.h b/qemu/target-i386/cpu.h index d0a10ef0..93cb5310 100644 --- a/qemu/target-i386/cpu.h +++ b/qemu/target-i386/cpu.h @@ -1131,33 +1131,6 @@ void x86_stl_phys(CPUState *cs, hwaddr addr, uint32_t val); void x86_stq_phys(CPUState *cs, hwaddr addr, uint64_t val); #endif -static inline bool hw_local_breakpoint_enabled(unsigned long dr7, int index) -{ - 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) -{ - return (dr7 >> (DR7_TYPE_SHIFT + (index * 4))) & 3; -} - -static inline int hw_breakpoint_len(unsigned long dr7, int index) -{ - int len = ((dr7 >> (DR7_LEN_SHIFT + (index * 4))) & 3); - return (len == 2) ? 8 : len + 1; -} - void breakpoint_handler(CPUState *cs); /* will be suppressed */