[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PULL 16/24] target/ppc: Drop exit checks for singlestep_enabled
From: |
Richard Henderson |
Subject: |
[PULL 16/24] target/ppc: Drop exit checks for singlestep_enabled |
Date: |
Sat, 16 Oct 2021 11:15:06 -0700 |
GDB single-stepping is now handled generically.
Reuse gen_debug_exception to handle architectural debug exceptions.
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
---
target/ppc/translate.c | 38 ++++++++------------------------------
1 file changed, 8 insertions(+), 30 deletions(-)
diff --git a/target/ppc/translate.c b/target/ppc/translate.c
index 9ca78ee156..c3c6cb9589 100644
--- a/target/ppc/translate.c
+++ b/target/ppc/translate.c
@@ -42,7 +42,6 @@
#define CPU_SINGLE_STEP 0x1
#define CPU_BRANCH_STEP 0x2
-#define GDBSTUB_SINGLE_STEP 0x4
/* Include definitions for instructions classes and implementations flags */
/* #define PPC_DEBUG_DISAS */
@@ -333,7 +332,7 @@ static uint32_t gen_prep_dbgex(DisasContext *ctx)
static void gen_debug_exception(DisasContext *ctx)
{
- gen_helper_raise_exception(cpu_env, tcg_constant_i32(EXCP_DEBUG));
+ gen_helper_raise_exception(cpu_env, tcg_constant_i32(gen_prep_dbgex(ctx)));
ctx->base.is_jmp = DISAS_NORETURN;
}
@@ -4309,15 +4308,8 @@ static inline bool use_goto_tb(DisasContext *ctx,
target_ulong dest)
static void gen_lookup_and_goto_ptr(DisasContext *ctx)
{
- int sse = ctx->singlestep_enabled;
- if (unlikely(sse)) {
- if (sse & GDBSTUB_SINGLE_STEP) {
- gen_debug_exception(ctx);
- } else if (sse & (CPU_SINGLE_STEP | CPU_BRANCH_STEP)) {
- gen_helper_raise_exception(cpu_env,
tcg_constant_i32(gen_prep_dbgex(ctx)));
- } else {
- tcg_gen_exit_tb(NULL, 0);
- }
+ if (unlikely(ctx->singlestep_enabled)) {
+ gen_debug_exception(ctx);
} else {
tcg_gen_lookup_and_goto_ptr();
}
@@ -8563,17 +8555,11 @@ static void ppc_tr_init_disas_context(DisasContextBase
*dcbase, CPUState *cs)
ctx->singlestep_enabled = 0;
if ((hflags >> HFLAGS_SE) & 1) {
ctx->singlestep_enabled |= CPU_SINGLE_STEP;
+ ctx->base.max_insns = 1;
}
if ((hflags >> HFLAGS_BE) & 1) {
ctx->singlestep_enabled |= CPU_BRANCH_STEP;
}
- if (unlikely(ctx->base.singlestep_enabled)) {
- ctx->singlestep_enabled |= GDBSTUB_SINGLE_STEP;
- }
-
- if (ctx->singlestep_enabled & (CPU_SINGLE_STEP | GDBSTUB_SINGLE_STEP)) {
- ctx->base.max_insns = 1;
- }
}
static void ppc_tr_tb_start(DisasContextBase *db, CPUState *cs)
@@ -8642,7 +8628,6 @@ static void ppc_tr_tb_stop(DisasContextBase *dcbase,
CPUState *cs)
DisasContext *ctx = container_of(dcbase, DisasContext, base);
DisasJumpType is_jmp = ctx->base.is_jmp;
target_ulong nip = ctx->base.pc_next;
- int sse;
if (is_jmp == DISAS_NORETURN) {
/* We have already exited the TB. */
@@ -8650,8 +8635,8 @@ static void ppc_tr_tb_stop(DisasContextBase *dcbase,
CPUState *cs)
}
/* Honor single stepping. */
- sse = ctx->singlestep_enabled & (CPU_SINGLE_STEP | GDBSTUB_SINGLE_STEP);
- if (unlikely(sse)) {
+ if (unlikely(ctx->singlestep_enabled & CPU_SINGLE_STEP)
+ && (nip <= 0x100 || nip > 0xf00)) {
switch (is_jmp) {
case DISAS_TOO_MANY:
case DISAS_EXIT_UPDATE:
@@ -8665,15 +8650,8 @@ static void ppc_tr_tb_stop(DisasContextBase *dcbase,
CPUState *cs)
g_assert_not_reached();
}
- if (sse & GDBSTUB_SINGLE_STEP) {
- gen_debug_exception(ctx);
- return;
- }
- /* else CPU_SINGLE_STEP... */
- if (nip <= 0x100 || nip > 0xf00) {
- gen_helper_raise_exception(cpu_env,
tcg_constant_i32(gen_prep_dbgex(ctx)));
- return;
- }
+ gen_debug_exception(ctx);
+ return;
}
switch (is_jmp) {
--
2.25.1
- [PULL 17/24] target/riscv: Remove dead code after exception, (continued)
- [PULL 17/24] target/riscv: Remove dead code after exception, Richard Henderson, 2021/10/16
- [PULL 02/24] target/alpha: Drop checks for singlestep_enabled, Richard Henderson, 2021/10/16
- [PULL 06/24] target/arm: Drop checks for singlestep_enabled, Richard Henderson, 2021/10/16
- [PULL 15/24] target/openrisc: Drop checks for singlestep_enabled, Richard Henderson, 2021/10/16
- [PULL 20/24] target/s390x: Drop check for singlestep_enabled, Richard Henderson, 2021/10/16
- [PULL 24/24] Revert "cpu: Move cpu_common_props to hw/core/cpu.c", Richard Henderson, 2021/10/16
- [PULL 08/24] target/i386: Check CF_NO_GOTO_TB for dc->jmp_opt, Richard Henderson, 2021/10/16
- [PULL 22/24] target/tricore: Drop check for singlestep_enabled, Richard Henderson, 2021/10/16
- [PULL 03/24] target/avr: Drop checks for singlestep_enabled, Richard Henderson, 2021/10/16
- [PULL 13/24] target/mips: Fix single stepping, Richard Henderson, 2021/10/16
- [PULL 16/24] target/ppc: Drop exit checks for singlestep_enabled,
Richard Henderson <=
- [PULL 19/24] target/rx: Drop checks for singlestep_enabled, Richard Henderson, 2021/10/16
- [PULL 23/24] target/xtensa: Drop check for singlestep_enabled, Richard Henderson, 2021/10/16
- [PULL 21/24] target/sh4: Drop check for singlestep_enabled, Richard Henderson, 2021/10/16
- Re: [PULL 00/24] tcg patch queue, Richard Henderson, 2021/10/16