mirror of
https://gitlab.com/qemu-project/qemu
synced 2024-11-05 20:35:44 +00:00
target-arm: Use sextract32() in branch decode
In the decode of ARM B and BL insns, swap the order of the "append 2 implicit zeros to imm24" and the sign extend, and use the new sextract32() utility function to do the latter. This avoids a direct dependency on the undefined C behaviour of shifting into the sign bit of an integer. Signed-off-by: Peter Maydell <peter.maydell@linaro.org> Reviewed-by: Richard Henderson <rth@twiddle.net> Message-id: 1378391908-22137-2-git-send-email-peter.maydell@linaro.org
This commit is contained in:
parent
f5f6d38b74
commit
534df15609
1 changed files with 3 additions and 2 deletions
|
@ -28,6 +28,7 @@
|
|||
#include "disas/disas.h"
|
||||
#include "tcg-op.h"
|
||||
#include "qemu/log.h"
|
||||
#include "qemu/bitops.h"
|
||||
|
||||
#include "helper.h"
|
||||
#define GEN_HELPER 1
|
||||
|
@ -7957,8 +7958,8 @@ static void disas_arm_insn(CPUARMState * env, DisasContext *s)
|
|||
tcg_gen_movi_i32(tmp, val);
|
||||
store_reg(s, 14, tmp);
|
||||
}
|
||||
offset = (((int32_t)insn << 8) >> 8);
|
||||
val += (offset << 2) + 4;
|
||||
offset = sextract32(insn << 2, 0, 26);
|
||||
val += offset + 4;
|
||||
gen_jmp(s, val);
|
||||
}
|
||||
break;
|
||||
|
|
Loading…
Reference in a new issue