[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH 35/41] target/i386: Use cpu_breakpoint_test in breakpoint_handler
From: |
Richard Henderson |
Subject: |
[PATCH 35/41] target/i386: Use cpu_breakpoint_test in breakpoint_handler |
Date: |
Sat, 10 Jul 2021 08:31:37 -0700 |
The loop is performing a simple boolean test for the existence
of a BP_CPU breakpoint at EIP. Plus it gets the iteration wrong,
if we happen to have a BP_GDB breakpoint at the same address.
We have a function for this: cpu_breakpoint_test.
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
Reviewed-by: Eduardo Habkost <ehabkost@redhat.com>
Message-Id: <20210620062317.1399034-1-richard.henderson@linaro.org>
---
target/i386/tcg/sysemu/bpt_helper.c | 12 +++---------
1 file changed, 3 insertions(+), 9 deletions(-)
diff --git a/target/i386/tcg/sysemu/bpt_helper.c
b/target/i386/tcg/sysemu/bpt_helper.c
index 9bdf7e170b..f1fb479ad9 100644
--- a/target/i386/tcg/sysemu/bpt_helper.c
+++ b/target/i386/tcg/sysemu/bpt_helper.c
@@ -210,7 +210,6 @@ void breakpoint_handler(CPUState *cs)
{
X86CPU *cpu = X86_CPU(cs);
CPUX86State *env = &cpu->env;
- CPUBreakpoint *bp;
if (cs->watchpoint_hit) {
if (cs->watchpoint_hit->flags & BP_CPU) {
@@ -222,14 +221,9 @@ void breakpoint_handler(CPUState *cs)
}
}
} else {
- QTAILQ_FOREACH(bp, &cs->breakpoints, entry) {
- if (bp->pc == env->eip) {
- if (bp->flags & BP_CPU) {
- check_hw_breakpoints(env, true);
- raise_exception(env, EXCP01_DB);
- }
- break;
- }
+ if (cpu_breakpoint_test(cs, env->eip, BP_CPU)) {
+ check_hw_breakpoints(env, true);
+ raise_exception(env, EXCP01_DB);
}
}
}
--
2.25.1
- [PATCH 24/41] target/ppc: Use translator_use_goto_tb, (continued)
- [PATCH 24/41] target/ppc: Use translator_use_goto_tb, Richard Henderson, 2021/07/10
- [PATCH 27/41] target/s390x: Use translator_use_goto_tb, Richard Henderson, 2021/07/10
- [PATCH 25/41] target/riscv: Use translator_use_goto_tb, Richard Henderson, 2021/07/10
- [PATCH 29/41] target/sh4: Use translator_use_goto_tb, Richard Henderson, 2021/07/10
- [PATCH 26/41] target/rx: Use translator_use_goto_tb, Richard Henderson, 2021/07/10
- [PATCH 31/41] target/tricore: Use translator_use_goto_tb, Richard Henderson, 2021/07/10
- [PATCH 33/41] target/xtensa: Use translator_use_goto_tb, Richard Henderson, 2021/07/10
- [PATCH 28/41] target/s390x: Remove use_exit_tb, Richard Henderson, 2021/07/10
- [PATCH 30/41] target/sparc: Use translator_use_goto_tb, Richard Henderson, 2021/07/10
- [PATCH 34/41] tcg: Fix prologue disassembly, Richard Henderson, 2021/07/10
- [PATCH 35/41] target/i386: Use cpu_breakpoint_test in breakpoint_handler,
Richard Henderson <=
- [PATCH 32/41] target/tricore: Use tcg_gen_lookup_and_goto_ptr, Richard Henderson, 2021/07/10
- [PATCH 36/41] accel/tcg: Move helper_lookup_tb_ptr to cpu-exec.c, Richard Henderson, 2021/07/10
- [PATCH 37/41] accel/tcg: Move tb_lookup to cpu-exec.c, Richard Henderson, 2021/07/10
- [PATCH 39/41] accel/tcg: Log tb->cflags with -d exec, Richard Henderson, 2021/07/10
- [PATCH 38/41] accel/tcg: Split out log_cpu_exec, Richard Henderson, 2021/07/10
- [PATCH 40/41] tcg: Remove TCG_TARGET_HAS_goto_ptr, Richard Henderson, 2021/07/10
- [PATCH 41/41] cpu: Add breakpoint tracepoints, Richard Henderson, 2021/07/10
- Re: [PATCH 00/41] tcg patch queue, Peter Maydell, 2021/07/10
- Re: [PATCH 00/41] tcg patch queue, Peter Maydell, 2021/07/12