target/arm: Pass in pc to thumb_insn_is_16bit

This function is used in two different contexts, and it will be
clearer if the function is given the address to which it applies.

Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Message-id: 20190807045335.1361-2-richard.henderson@linaro.org
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
This commit is contained in:
Richard Henderson 2019-08-15 09:46:42 +01:00 committed by Peter Maydell
parent 8bd587c106
commit 331b1ca616
1 changed files with 7 additions and 7 deletions

View File

@ -9246,11 +9246,11 @@ static void disas_arm_insn(DisasContext *s, unsigned int insn)
} }
} }
static bool thumb_insn_is_16bit(DisasContext *s, uint32_t insn) static bool thumb_insn_is_16bit(DisasContext *s, uint32_t pc, uint32_t insn)
{ {
/* Return true if this is a 16 bit instruction. We must be precise /*
* about this (matching the decode). We assume that s->pc still * Return true if this is a 16 bit instruction. We must be precise
* points to the first 16 bits of the insn. * about this (matching the decode).
*/ */
if ((insn >> 11) < 0x1d) { if ((insn >> 11) < 0x1d) {
/* Definitely a 16-bit instruction */ /* Definitely a 16-bit instruction */
@ -9270,7 +9270,7 @@ static bool thumb_insn_is_16bit(DisasContext *s, uint32_t insn)
return false; return false;
} }
if ((insn >> 11) == 0x1e && s->pc - s->page_start < TARGET_PAGE_SIZE - 3) { if ((insn >> 11) == 0x1e && pc - s->page_start < TARGET_PAGE_SIZE - 3) {
/* 0b1111_0xxx_xxxx_xxxx : BL/BLX prefix, and the suffix /* 0b1111_0xxx_xxxx_xxxx : BL/BLX prefix, and the suffix
* is not on the next page; we merge this into a 32-bit * is not on the next page; we merge this into a 32-bit
* insn. * insn.
@ -11809,7 +11809,7 @@ static bool insn_crosses_page(CPUARMState *env, DisasContext *s)
*/ */
uint16_t insn = arm_lduw_code(env, s->pc, s->sctlr_b); uint16_t insn = arm_lduw_code(env, s->pc, s->sctlr_b);
return !thumb_insn_is_16bit(s, insn); return !thumb_insn_is_16bit(s, s->pc, insn);
} }
static void arm_tr_init_disas_context(DisasContextBase *dcbase, CPUState *cs) static void arm_tr_init_disas_context(DisasContextBase *dcbase, CPUState *cs)
@ -12108,7 +12108,7 @@ static void thumb_tr_translate_insn(DisasContextBase *dcbase, CPUState *cpu)
} }
insn = arm_lduw_code(env, dc->pc, dc->sctlr_b); insn = arm_lduw_code(env, dc->pc, dc->sctlr_b);
is_16bit = thumb_insn_is_16bit(dc, insn); is_16bit = thumb_insn_is_16bit(dc, dc->pc, insn);
dc->pc += 2; dc->pc += 2;
if (!is_16bit) { if (!is_16bit) {
uint32_t insn2 = arm_lduw_code(env, dc->pc, dc->sctlr_b); uint32_t insn2 = arm_lduw_code(env, dc->pc, dc->sctlr_b);