[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PULL 04/28] target-arm: fix ARMv7M stack alignment on rese
From: |
Peter Maydell |
Subject: |
[Qemu-devel] [PULL 04/28] target-arm: fix ARMv7M stack alignment on reset |
Date: |
Tue, 10 Sep 2013 19:51:58 +0100 |
From: Sebastian Ottlik <address@hidden>
When the initial SP is loaded from the vector table on ARMv7M systems the two
least significant bits are ignored as the stack is always aligned at a four byte
boundary (see ARM DDI 0403C, B1.4.1 and B1.5.5). So far QEMU did not ignore
these bits leading to a stack alignment inconsitent with real hardware for
binaries that rely on this behaviour. This patch fixes this issue by masking the
two least significant bits when loading the SP.
Signed-off-by: Sebastian Ottlik <address@hidden>
Reviewed-by: Peter Maydell <address@hidden>
Message-id: address@hidden
Signed-off-by: Peter Maydell <address@hidden>
---
target-arm/cpu.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/target-arm/cpu.c b/target-arm/cpu.c
index 827e28e..09206b5 100644
--- a/target-arm/cpu.c
+++ b/target-arm/cpu.c
@@ -108,7 +108,7 @@ static void arm_cpu_reset(CPUState *s)
modified flash and reset itself. However images
loaded via -kernel have not been copied yet, so load the
values directly from there. */
- env->regs[13] = ldl_p(rom);
+ env->regs[13] = ldl_p(rom) & 0xFFFFFFFC;
pc = ldl_p(rom + 4);
env->thumb = pc & 1;
env->regs[15] = pc & ~1;
--
1.7.9.5
- [Qemu-devel] [PULL 16/28] target-arm: Add AArch64 translation stub, (continued)
- [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, 2013/09/10
- [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 <=
- [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