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>2010-11-13 18:04:48 (GMT)
commitbf3e836913deaeed84b6074c049bfd1a7a407119 (patch)
treee8b6862693c40a0dd413c3c374b2b4bbb4def7d3
parentc300ae6318c7f083ca429264c26f3ea312ae5110 (diff)
downloadabc8000-old-bf3e836913deaeed84b6074c049bfd1a7a407119.zip
abc8000-old-bf3e836913deaeed84b6074c049bfd1a7a407119.tar.gz
abc8000-old-bf3e836913deaeed84b6074c049bfd1a7a407119.tar.bz2
abc8000-old-bf3e836913deaeed84b6074c049bfd1a7a407119.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 cbbc090..868e861 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");
}