From 63d40e1a556f64dce3ff66a13562bcdc43504959 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alex=20Benn=C3=A9e?= Date: Sat, 3 Mar 2018 22:32:59 -0500 Subject: [PATCH] target/arm/translate: make DISAS_UPDATE match declared semantics DISAS_UPDATE should be used when the wider CPU state other than just the PC has been updated and we should therefore exit the TCG runtime and return to the main execution loop rather assuming DISAS_JUMP would do that. Backports commit e8d5230221851e8933811f1579fd13371f576955 from qemu --- qemu/target/arm/translate-a64.c | 14 +++++++------- qemu/target/arm/translate.c | 6 +++--- qemu/target/arm/translate.h | 2 +- 3 files changed, 11 insertions(+), 11 deletions(-) diff --git a/qemu/target/arm/translate-a64.c b/qemu/target/arm/translate-a64.c index fa2a0861..a998f21a 100644 --- a/qemu/target/arm/translate-a64.c +++ b/qemu/target/arm/translate-a64.c @@ -11609,16 +11609,9 @@ tb_end: case DISAS_NEXT: gen_goto_tb(dc, 1, dc->pc); break; - default: - case DISAS_UPDATE: - gen_a64_set_pc_im(dc, dc->pc); - /* fall through */ case DISAS_JUMP: tcg_gen_lookup_and_goto_ptr(tcg_ctx, tcg_ctx->cpu_pc); break; - case DISAS_EXIT: - tcg_gen_exit_tb(tcg_ctx, 0); - break; case DISAS_TB_JUMP: case DISAS_EXC: case DISAS_SWI: @@ -11642,6 +11635,13 @@ tb_end: */ tcg_gen_exit_tb(tcg_ctx, 0); break; + case DISAS_UPDATE: + gen_a64_set_pc_im(dc, dc->pc); + /* fall through */ + case DISAS_EXIT: + default: + tcg_gen_exit_tb(tcg_ctx, 0); + break; } } diff --git a/qemu/target/arm/translate.c b/qemu/target/arm/translate.c index c07e9c56..7f28c55b 100644 --- a/qemu/target/arm/translate.c +++ b/qemu/target/arm/translate.c @@ -12329,12 +12329,12 @@ tb_end: case DISAS_NEXT: gen_goto_tb(dc, 1, dc->pc); break; - case DISAS_UPDATE: - gen_set_pc_im(dc, dc->pc); - /* fall through */ case DISAS_JUMP: gen_goto_ptr(dc); break; + case DISAS_UPDATE: + gen_set_pc_im(dc, dc->pc); + /* fall through */ default: /* indicate that the hash table must be used to find the next TB */ tcg_gen_exit_tb(tcg_ctx, 0); diff --git a/qemu/target/arm/translate.h b/qemu/target/arm/translate.h index 8bb27190..9fa246a9 100644 --- a/qemu/target/arm/translate.h +++ b/qemu/target/arm/translate.h @@ -156,7 +156,7 @@ static inline void gen_intermediate_code_a64(ARMCPU *cpu, TranslationBlock *tb) { } -static inline void gen_a64_set_pc_im(uint64_t val) +static inline void gen_a64_set_pc_im(DisasContext *s, uint64_t val) { } #endif