All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] target/ppc: fix single-step exception regression
@ 2021-06-01 18:02 Luis Pires
  2021-06-01 20:27 ` Richard Henderson
  0 siblings, 1 reply; 5+ messages in thread
From: Luis Pires @ 2021-06-01 18:02 UTC (permalink / raw)
  To: qemu-devel
  Cc: richard.henderson, groug, Luis Pires, qemu-ppc, matheus.ferst, david

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.

Signed-off-by: Luis Pires <luis.pires@eldorado.org.br>
Reported-by: Matheus Ferst <matheus.ferst@eldorado.org.br>
---
 target/ppc/translate.c | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/target/ppc/translate.c b/target/ppc/translate.c
index ea200f9637..0dd04696a6 100644
--- a/target/ppc/translate.c
+++ b/target/ppc/translate.c
@@ -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,11 @@ 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));
+            if (is_jmp == DISAS_EXIT || is_jmp == DISAS_CHAIN) {
+                /* We have not updated nip yet, so do it now */
+                gen_update_nip(ctx, nip);
+            }
+            gen_helper_raise_exception(cpu_env, tcg_constant_i32(gen_prep_dbgex(ctx)));
             return;
         }
     }
-- 
2.25.1



^ permalink raw reply related	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2021-06-02 17:17 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-06-01 18:02 [PATCH] target/ppc: fix single-step exception regression Luis Pires
2021-06-01 20:27 ` Richard Henderson
2021-06-02  8:55   ` David Gibson
2021-06-02 15:50     ` Richard Henderson
2021-06-02 17:13       ` Luis Fernando Fujita Pires

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.