summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorH. Peter Anvin <hpa@zytor.com>2010-11-13 18:00:20 (GMT)
committerH. Peter Anvin <hpa@zytor.com>2014-02-11 02:07:50 (GMT)
commit114668c956b44107585e6556fef01c52b131da7b (patch)
treeebea1d99dda02372dad5596d589573c895043a57
parent9af8df8066ab20357de58e7b2a3a3c9fe517e69b (diff)
downloadabc8000-114668c956b44107585e6556fef01c52b131da7b.zip
abc8000-114668c956b44107585e6556fef01c52b131da7b.tar.gz
abc8000-114668c956b44107585e6556fef01c52b131da7b.tar.bz2
abc8000-114668c956b44107585e6556fef01c52b131da7b.tar.xz
sysrom: clobber all registers around jumping to disk
Don't assume the boot program will follow the calling conventions. Explicitly clobber everything around the call.
-rw-r--r--data/sysrom/sdcard.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/data/sysrom/sdcard.c b/data/sysrom/sdcard.c
index e877716..40b4337 100644
--- a/data/sysrom/sdcard.c
+++ b/data/sysrom/sdcard.c
@@ -692,5 +692,10 @@ void disk_boot(void)
printf("Boot file checksum: 0x%08x\n", csum);
printf("Jumping to boot file...\n");
- ((void (*)(void))BOOT_ADDR)();
+
+ asm volatile("jsr %0\n"
+ : : "m" (*(const char *)BOOT_ADDR)
+ : "d0", "d1", "d2", "d3", "d4", "d5", "d6", "d7",
+ "a0", "a1", "a2", "a3", "a4", "a5", "a6",
+ "cc", "memory");
}