summary refs log tree commit diff stats
path: root/hw/arm/boot.c
diff options
context:
space:
mode:
authorSylvain Garrigues <sylvain@sylvaingarrigues.com>2016-04-20 23:35:28 +0200
committerPeter Maydell <peter.maydell@linaro.org>2016-04-21 12:10:17 +0100
commitb4850e5ae9607f9f31932f693ca48f52619493d7 (patch)
treed9e018e39bb407020c78b06b6f60bbd94f94e858 /hw/arm/boot.c
parent81d9d1867f5210412ccd262b040cf579dc32ff55 (diff)
downloadfocaccia-qemu-b4850e5ae9607f9f31932f693ca48f52619493d7.tar.gz
focaccia-qemu-b4850e5ae9607f9f31932f693ca48f52619493d7.zip
hw/arm/boot: always clear r0 when booting kernels
The 32-bit ARM Linux kernel booting ABI requires that r0 is 0
when calling the kernel image. A bug in commit 10b8ec73e610e01
meant that for boards which use the write_board_setup hook (which
means "highbank", "midway", "raspi2" and "xilinx-zynq-a9") we
were incorrectly skipping the "clear r0" instruction in the
mini-bootloader. Use the right offset in the "add lr, pc, #n"
instruction so that we return from the board-setup code to the
correct place.

Signed-off-by: Sylvain Garrigues <sylvain@sylvaingarrigues.com>
[PMM: Expanded commit message]
Cc: qemu-stable@nongnu.org
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Diffstat (limited to 'hw/arm/boot.c')
-rw-r--r--hw/arm/boot.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/hw/arm/boot.c b/hw/arm/boot.c
index 5975fbfa8c..5876945575 100644
--- a/hw/arm/boot.c
+++ b/hw/arm/boot.c
@@ -68,7 +68,7 @@ static const ARMInsnFixup bootloader_aarch64[] = {
  */
 
 static const ARMInsnFixup bootloader[] = {
-    { 0xe28fe008 }, /* add     lr, pc, #8 */
+    { 0xe28fe004 }, /* add     lr, pc, #4 */
     { 0xe51ff004 }, /* ldr     pc, [pc, #-4] */
     { 0, FIXUP_BOARD_SETUP },
 #define BOOTLOADER_NO_BOARD_SETUP_OFFSET 3