From 179a3aacdf8eb16977ee5596df7f84a7d0828b3a Mon Sep 17 00:00:00 2001 From: Richard Henderson Date: Thu, 25 Feb 2021 14:04:16 -0500 Subject: [PATCH] target/arm: Add DISAS_UPDATE_NOCHAIN Add an option that writes back the PC, like DISAS_UPDATE_EXIT, but does not exit back to the main loop. Backports commit 329833286d7a1b0ef8c7daafe13c6ae32429694e from qemu --- qemu/target/arm/translate-a64.c | 3 +++ qemu/target/arm/translate.c | 4 ++++ qemu/target/arm/translate.h | 2 ++ 3 files changed, 9 insertions(+) diff --git a/qemu/target/arm/translate-a64.c b/qemu/target/arm/translate-a64.c index 5bb3e2b4..903809b0 100644 --- a/qemu/target/arm/translate-a64.c +++ b/qemu/target/arm/translate-a64.c @@ -14626,6 +14626,9 @@ static void aarch64_tr_tb_stop(DisasContextBase *dcbase, CPUState *cpu) case DISAS_EXIT: tcg_gen_exit_tb(tcg_ctx, NULL, 0); break; + case DISAS_UPDATE_NOCHAIN: + gen_a64_set_pc_im(dc, dc->base.pc_next); + /* fall through */ case DISAS_JUMP: tcg_gen_lookup_and_goto_ptr(tcg_ctx); break; diff --git a/qemu/target/arm/translate.c b/qemu/target/arm/translate.c index 9e275c44..e0d2e3ec 100644 --- a/qemu/target/arm/translate.c +++ b/qemu/target/arm/translate.c @@ -9165,6 +9165,7 @@ static void arm_tr_tb_stop(DisasContextBase *dcbase, CPUState *cpu) case DISAS_NEXT: case DISAS_TOO_MANY: case DISAS_UPDATE_EXIT: + case DISAS_UPDATE_NOCHAIN: gen_set_pc_im(dc, dc->base.pc_next); /* fall through */ default: @@ -9188,6 +9189,9 @@ static void arm_tr_tb_stop(DisasContextBase *dcbase, CPUState *cpu) case DISAS_TOO_MANY: gen_goto_tb(dc, 1, dc->base.pc_next); break; + case DISAS_UPDATE_NOCHAIN: + gen_set_pc_im(dc, dc->base.pc_next); + /* fall through */ case DISAS_JUMP: gen_goto_ptr(dc); break; diff --git a/qemu/target/arm/translate.h b/qemu/target/arm/translate.h index 5783ca7a..e75809b9 100644 --- a/qemu/target/arm/translate.h +++ b/qemu/target/arm/translate.h @@ -176,6 +176,8 @@ static inline void disas_set_insn_syndrome(DisasContext *s, uint32_t syn) * return from cpu_tb_exec. */ #define DISAS_EXIT DISAS_TARGET_9 +/* CPU state was modified dynamically; no need to exit, but do not chain. */ +#define DISAS_UPDATE_NOCHAIN DISAS_TARGET_10 #ifdef TARGET_AARCH64 void a64_translate_init(struct uc_struct *uc);