PPC: Fix for the gdb single step problem on an rfi instruction
PATCH 1/1 PPC: Fix for the gdb single step problem on an rfi instruction
When using gdb to single step a ppc interrupt routine, the execution flow passes the rfi instruction without actually returning from the interrupt. The patch fixes this by avoiding to update the nip when the debug exception is raised and a previous POWERPC_EXCP_SYNC was set. The latter is the case only, if code for rfi or a related instruction was generated.
---
target-ppc/translate.c +1 -1
@@ -287,7 +287,7 @@ static inline void gen_debug_exception(DisasContext *ctx) {TCGv_i32 t0; -if (ctx->exception !=POWERPC_EXCP_BRANCH ) +if (ctx->exception !=POWERPC_EXCP_BRANCH && ctx->exception !=POWERPC_EXCP_SYNC )gen_update_nip (ctx, ctx->nip); t0 =tcg_const_i32 (EXCP_DEBUG );gen_helper_raise_exception (t0);
Hello,
I've had this problem recently and your patch does fix the issue, thanks!
Regards,
Elie
Quoted 23 lines · Sebastian Bauer
When using gdb to single step a ppc interrupt routine, the execution flow passes the rfi instruction without actually returning from the interrupt. The patch fixes this by avoiding to update the nip when the debug exception is raised and a previous
POWERPC_EXCP_SYNCwas set. The latter is the case only, if code for rfi or a related instruction was generated.Signed-off-by Sebastian Bauer <[email protected]>---
target-ppc/translate.c +1
-1@@ -287,7 +287,7 @@ static inline void gen_debug_exception(DisasContext *ctx) {TCGv_i32 t0; -if (ctx->exception !=POWERPC_EXCP_BRANCH ) +if (ctx->exception !=POWERPC_EXCP_BRANCH && ctx->exception !=POWERPC_EXCP_SYNC )gen_update_nip (ctx, ctx->nip); t0 =tcg_const_i32 (EXCP_DEBUG );gen_helper_raise_exception (t0);
Hi!
Quoted 1 line · Elie Richa
I've had this problem recently and your patch does fix the issue, thanks!
I like to bump this as this was not in the latest ppc patch queue. Is there anything wrong with that patch?
TIA
Best,
Sebastian
Quoted 26 lines · Sebastian Bauer
Quoted 25 lines
When using gdb to single step a ppc interrupt routine, the execution flow passes the rfi instruction without actually returning from the interrupt. The patch fixes this by avoiding to update the nip when the debug exception is raised and a previous
POWERPC_EXCP_SYNCwas set. The latter is the case only, if code for rfi or a related instruction was generated.Signed-off-by Sebastian Bauer <[email protected]>---
target-ppc/translate.c +1
-1@@ -287,7 +287,7 @@ static inline void gen_debug_exception(DisasContext *ctx) {TCGv_i32 t0; -if (ctx->exception !=POWERPC_EXCP_BRANCH ) +if (ctx->exception !=POWERPC_EXCP_BRANCH && ctx->exception !=POWERPC_EXCP_SYNC )gen_update_nip (ctx, ctx->nip);t0 =
tcg_const_i32(EXCP_DEBUG);gen_helper_raise_exception(t0);
Quoted 13 lines · Sebastian Bauer
When using gdb to single step a ppc interrupt routine, the execution flow passes the rfi instruction without actually returning from the interrupt. The patch fixes this by avoiding to update the nip when the debug exception is raised and a previous
POWERPC_EXCP_SYNCwas set. The latter is the case only, if code for rfi or a related instruction was generated.Signed-off-by Sebastian Bauer <[email protected]>---
target-ppc/translate.c +0
-0
target-ppc/translate.c static inline void · line 293
Quoted 8 lines
target-ppc/translate.c +1
-1@@ -287,7 +287,7 @@ static inline void gen_debug_exception(DisasContext *ctx) {TCGv_i32 t0; -if (ctx->exception !=POWERPC_EXCP_BRANCH ) +if (ctx->exception !=POWERPC_EXCP_BRANCH && ctx->exception !=POWERPC_EXCP_SYNC )gen_update_nip (ctx, ctx->nip);
I fixed the patch up to align with the coding style rules:
target-ppc/translate.c +3 -1
@@ -298,8 +298,10 @@ static inline void gen_debug_exception(DisasContext *ctx) {TCGv_i32 t0; -if (ctx->exception !=POWERPC_EXCP_BRANCH ) +if ((ctx->exception !=POWERPC_EXCP_BRANCH ) && + (ctx->exception !=POWERPC_EXCP_SYNC )) {gen_update_nip (ctx, ctx->nip); + } t0 =tcg_const_i32 (EXCP_DEBUG );gen_helper_raise_exception (t0);tcg_temp_free_i32 (t0);
Otherwise, applied to ppc-next now. Thanks a lot! And sorry for the late reply again. Please send your next patch CC'ed to [email protected] - that makes it a lot easier for to not lose track of it :).
Alex