From 43d6e73feac8cafdb473f752a582b75ec9ac296f Mon Sep 17 00:00:00 2001 From: Peter Maydell Date: Fri, 2 Mar 2018 14:47:01 -0500 Subject: [PATCH] arm: Move gen_set_condexec() and gen_set_pc_im() up in the file Move the utility routines gen_set_condexec() and gen_set_pc_im() up in the file, as we will want to use them from a function placed earlier in the file than their current location. Backports commit 4d5e8c969a74c86124fc2284ea603cc6dd3c5dfa from qemu --- qemu/target/arm/translate.c | 37 +++++++++++++++++++------------------ 1 file changed, 19 insertions(+), 18 deletions(-) diff --git a/qemu/target/arm/translate.c b/qemu/target/arm/translate.c index af8d44c0..0a8e8b33 100644 --- a/qemu/target/arm/translate.c +++ b/qemu/target/arm/translate.c @@ -915,6 +915,25 @@ static const uint8_t table_logic_cc[16] = { 1, /* mvn */ }; +static inline void gen_set_condexec(DisasContext *s) +{ + TCGContext *tcg_ctx = s->uc->tcg_ctx; + + if (s->condexec_mask) { + uint32_t val = (s->condexec_cond << 4) | (s->condexec_mask >> 1); + TCGv_i32 tmp = tcg_temp_new_i32(tcg_ctx); + tcg_gen_movi_i32(tcg_ctx, tmp, val); + store_cpu_field(tcg_ctx, tmp, condexec_bits); + } +} + +static inline void gen_set_pc_im(DisasContext *s, target_ulong val) +{ + TCGContext *tcg_ctx = s->uc->tcg_ctx; + + tcg_gen_movi_i32(tcg_ctx, tcg_ctx->cpu_R[15], val); +} + /* Set PC and Thumb state from an immediate address. */ static inline void gen_bx_im(DisasContext *s, uint32_t addr) { @@ -1101,12 +1120,6 @@ DO_GEN_ST(8, MO_UB) DO_GEN_ST(16, MO_UW) DO_GEN_ST(32, MO_UL) -static inline void gen_set_pc_im(DisasContext *s, target_ulong val) -{ - TCGContext *tcg_ctx = s->uc->tcg_ctx; - tcg_gen_movi_i32(tcg_ctx, tcg_ctx->cpu_R[15], val); -} - static inline void gen_hvc(DisasContext *s, int imm16) { TCGContext *tcg_ctx = s->uc->tcg_ctx; @@ -1142,18 +1155,6 @@ static inline void gen_smc(DisasContext *s) s->is_jmp = DISAS_SMC; } -static inline void -gen_set_condexec (DisasContext *s) -{ - if (s->condexec_mask) { - TCGContext *tcg_ctx = s->uc->tcg_ctx; - uint32_t val = (s->condexec_cond << 4) | (s->condexec_mask >> 1); - TCGv_i32 tmp = tcg_temp_new_i32(tcg_ctx); - tcg_gen_movi_i32(tcg_ctx, tmp, val); - store_cpu_field(tcg_ctx, tmp, condexec_bits); - } -} - static void gen_exception_internal_insn(DisasContext *s, int offset, int excp) { gen_set_condexec(s);