diff mbox

[v3,05/15] target/sh4: fix BS_STOP exit

Message ID 20170510182636.17791-6-aurelien@aurel32.net
State New
Headers show

Commit Message

Aurelien Jarno May 10, 2017, 6:26 p.m. UTC
When stopping the translation because the state has changed, goto_tb
should not be used as it might link TB with different flags.

Reviewed-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
---
 target/sh4/translate.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

Comments

Philippe Mathieu-Daudé May 12, 2017, 11:57 p.m. UTC | #1
On 05/10/2017 03:26 PM, Aurelien Jarno wrote:
> When stopping the translation because the state has changed, goto_tb
> should not be used as it might link TB with different flags.
>
> Reviewed-by: Richard Henderson <rth@twiddle.net>
> Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>

Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>

> ---
>  target/sh4/translate.c | 5 +++--
>  1 file changed, 3 insertions(+), 2 deletions(-)
>
> diff --git a/target/sh4/translate.c b/target/sh4/translate.c
> index 2e29936ad8..04bc18bf7c 100644
> --- a/target/sh4/translate.c
> +++ b/target/sh4/translate.c
> @@ -1901,8 +1901,9 @@ void gen_intermediate_code(CPUSH4State * env, struct TranslationBlock *tb)
>      } else {
>  	switch (ctx.bstate) {
>          case BS_STOP:
> -            /* gen_op_interrupt_restart(); */
> -            /* fall through */
> +            tcg_gen_movi_i32(cpu_pc, ctx.pc);
> +            tcg_gen_exit_tb(0);
> +            break;
>          case BS_NONE:
>              if (ctx.envflags) {
>                  gen_store_flags(ctx.envflags);
>
diff mbox

Patch

diff --git a/target/sh4/translate.c b/target/sh4/translate.c
index 2e29936ad8..04bc18bf7c 100644
--- a/target/sh4/translate.c
+++ b/target/sh4/translate.c
@@ -1901,8 +1901,9 @@  void gen_intermediate_code(CPUSH4State * env, struct TranslationBlock *tb)
     } else {
 	switch (ctx.bstate) {
         case BS_STOP:
-            /* gen_op_interrupt_restart(); */
-            /* fall through */
+            tcg_gen_movi_i32(cpu_pc, ctx.pc);
+            tcg_gen_exit_tb(0);
+            break;
         case BS_NONE:
             if (ctx.envflags) {
                 gen_store_flags(ctx.envflags);