target/ppc: fix single-step exception regression
PATCH v2 1/1 target/ppc: fix single-step exception regression
Commit 6086c75 (target/ppc: Replace POWERPC_EXCP_BRANCH with DISAS_NORETURN) broke the generation of exceptions when CPU_SINGLE_STEP or CPU_BRANCH_STEP were set, due to nip always being reset to the address of the current instruction.
This fix leaves nip untouched when generating the exception.
---
v2:
- Removed incorrect nip update from ppc_tr_tb_stop()
target/ppc/translate.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-)
target/ppc/translate.c +2 -3
@@ -4646,8 +4646,7 @@ static void gen_lookup_and_goto_ptr(DisasContext *ctx)if (sse &GDBSTUB_SINGLE_STEP ) {gen_debug_exception (ctx); }else if (sse & (CPU_SINGLE_STEP |CPU_BRANCH_STEP )) { -uint32_t excp =gen_prep_dbgex (ctx); -gen_exception (ctx, excp); +gen_helper_raise_exception (cpu_env,tcg_constant_i32 (gen_prep_dbgex (ctx))); }else {tcg_gen_exit_tb (NULL ,0 ); }
@@ -9128,7 +9127,7 @@ static void ppc_tr_tb_stop(DisasContextBase *dcbase, CPUState *cs) }/* else CPU_SINGLE_STEP... */ if (nip <=0x100 || nip >0xf00 ) { -gen_exception (ctx,gen_prep_dbgex (ctx)); +gen_helper_raise_exception (cpu_env,tcg_constant_i32 (gen_prep_dbgex (ctx)));return ; } }
Signature · 1 line
2.25.1
Quoted 6 lines · Luis Pires
Commit 6086c75 (target/ppc: Replace
POWERPC_EXCP_BRANCHwithDISAS_NORETURN) broke the generation of exceptions whenCPU_SINGLE_STEPorCPU_BRANCH_STEPwere set, due to nip always being reset to the address of the current instruction.
This fix leaves nip untouched when generating the exception.
Quoted 8 lines
Signed-off-by Luis Pires<[email protected]>Reported-by Matheus Ferst<[email protected]>---
v2:
- Removed incorrect nip update fromppc_tr_tb_stop()target/ppc/translate.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-)
r~
David Gibson
AppliedQuoted 8 lines · Luis Pires
Commit 6086c75 (target/ppc: Replace
POWERPC_EXCP_BRANCHwithDISAS_NORETURN) broke the generation of exceptions whenCPU_SINGLE_STEPorCPU_BRANCH_STEPwere set, due to nip always being reset to the address of the current instruction.
This fix leaves nip untouched when generating the exception.Signed-off-by Luis Pires <[email protected]>Reported-by Matheus Ferst <[email protected]>
Applied to ppc-for-6.1, thanks.
Quoted 30 lines
---
v2:
- Removed incorrect nip update fromppc_tr_tb_stop()target/ppc/translate.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-)target/ppc/translate.c +2
-3@@ -4646,8 +4646,7 @@ static void gen_lookup_and_goto_ptr(DisasContext *ctx)if (sse &GDBSTUB_SINGLE_STEP ) {gen_debug_exception (ctx); }else if (sse & (CPU_SINGLE_STEP |CPU_BRANCH_STEP )) { -uint32_t excp =gen_prep_dbgex (ctx); -gen_exception (ctx, excp); +gen_helper_raise_exception (cpu_env,tcg_constant_i32 (gen_prep_dbgex (ctx))); }else {tcg_gen_exit_tb (NULL ,0 ); }@@ -9128,7 +9127,7 @@ static void ppc_tr_tb_stop(DisasContextBase *dcbase, CPUState *cs) }/* else CPU_SINGLE_STEP... */ if (nip <=0x100 || nip >0xf00 ) { -gen_exception (ctx,gen_prep_dbgex (ctx)); +gen_helper_raise_exception (cpu_env,tcg_constant_i32 (gen_prep_dbgex (ctx)));return ; } }
Signature · 4 lines
David Gibson | I'll have my music baroque, and my code david AT gibson.dropbear.id.au | minimalist, thank you. NOT _the_ _other_ | _way_ _around_! http://www.ozlabs.org/~dgibson