[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PULL 02/28] target-arm: Use sextract32() in branch decode
From: |
Peter Maydell |
Subject: |
[Qemu-devel] [PULL 02/28] target-arm: Use sextract32() in branch decode |
Date: |
Tue, 10 Sep 2013 19:51:56 +0100 |
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 <address@hidden>
Reviewed-by: Richard Henderson <address@hidden>
Message-id: address@hidden
---
target-arm/translate.c | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/target-arm/translate.c b/target-arm/translate.c
index 4f4a0a9..8bcfaf3 100644
--- a/target-arm/translate.c
+++ b/target-arm/translate.c
@@ -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;
--
1.7.9.5
- [Qemu-devel] [PULL 07/28] abitypes.h: Remove incorrect ARM ABI_LLONG_ALIGNMENT, (continued)
- [Qemu-devel] [PULL 07/28] abitypes.h: Remove incorrect ARM ABI_LLONG_ALIGNMENT, Peter Maydell, 2013/09/10
- [Qemu-devel] [PULL 14/28] target-arm: Disable 32 bit CPUs in 64 bit linux-user builds, Peter Maydell, 2013/09/10
- [Qemu-devel] [PULL 27/28] linux-user: Add AArch64 support, Peter Maydell, 2013/09/10
- [Qemu-devel] [PULL 22/28] linux-user: Add signal handling for AArch64, Peter Maydell, 2013/09/10
- [Qemu-devel] [PULL 16/28] target-arm: Add AArch64 translation stub, Peter Maydell, 2013/09/10
- [Qemu-devel] [PULL 03/28] target-arm: Avoid "1 << 31" undefined behaviour, Peter Maydell, 2013/09/10
- [Qemu-devel] [PULL 01/28] target-arm: Make '-cpu any' available in linux-user mode only, Peter Maydell, 2013/09/10
- [Qemu-devel] [PULL 13/28] target-arm: Add new AArch64CPUInfo base class and subclasses, Peter Maydell, 2013/09/10
- [Qemu-devel] [PULL 09/28] target-arm: Extract the disas struct to a header file, Peter Maydell, 2013/09/10
- [Qemu-devel] [PULL 11/28] target-arm: Fix target_ulong/uint32_t confusions, Peter Maydell, 2013/09/10
- [Qemu-devel] [PULL 02/28] target-arm: Use sextract32() in branch decode,
Peter Maydell <=
- [Qemu-devel] [PULL 12/28] target-arm: Pass DisasContext* to gen_set_pc_im(), Peter Maydell, 2013/09/10
- [Qemu-devel] [PULL 17/28] target-arm: Add AArch64 gdbstub support, Peter Maydell, 2013/09/10
- [Qemu-devel] [PULL 05/28] target-arm: Implement qmp query-cpu-definitions, Peter Maydell, 2013/09/10
- [Qemu-devel] [PULL 04/28] target-arm: fix ARMv7M stack alignment on reset, Peter Maydell, 2013/09/10
- [Qemu-devel] [PULL 08/28] target-arm: Abstract out load/store from a vaddr in AArch32, Peter Maydell, 2013/09/10
- [Qemu-devel] [PULL 15/28] target-arm: Prepare translation for AArch64 code, Peter Maydell, 2013/09/10