forked from len0rd/rockbox
Boot loader safety measures
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@5791 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
parent
b143652572
commit
f1530d8a82
2 changed files with 20 additions and 0 deletions
|
|
@ -45,7 +45,9 @@ int usb_screen(void)
|
|||
void start_iriver_fw(void)
|
||||
{
|
||||
asm(" move.w #0x2700,%sr");
|
||||
/* Reset the cookie for the crt0 crash check */
|
||||
asm(" move.l #0,%d0");
|
||||
asm(" move.l %d0,0x10017ffc");
|
||||
asm(" movec.l %d0,%vbr");
|
||||
asm(" move.l 0,%sp");
|
||||
asm(" lea.l 8,%a0");
|
||||
|
|
@ -110,6 +112,9 @@ int load_firmware(void)
|
|||
void start_firmware(void)
|
||||
{
|
||||
asm(" move.w #0x2700,%sr");
|
||||
/* Reset the cookie for the crt0 crash check */
|
||||
asm(" move.l #0,%d0");
|
||||
asm(" move.l %d0,0x10017ffc");
|
||||
asm(" move.l #0x30000000,%d0");
|
||||
asm(" movec.l %d0,%vbr");
|
||||
asm(" move.l 0x30000000,%sp");
|
||||
|
|
|
|||
|
|
@ -173,6 +173,21 @@ irq_handler:
|
|||
|
||||
|
||||
#ifdef BOOTLOADER
|
||||
/* The cookie is not reset. This must mean that the boot loader
|
||||
has crashed. Let's start the original firmware immediately. */
|
||||
lea 0x10017ffc,%a2
|
||||
move.l (%a2),%d0
|
||||
move.l #0xc0015a17,%d1
|
||||
cmp.l %d0,%d1
|
||||
bne .nocookie
|
||||
/* Clear the cookie again */
|
||||
move.l #0,(%a2)
|
||||
jmp 8
|
||||
|
||||
.nocookie:
|
||||
/* Set the cookie */
|
||||
move.l %d1,(%a2)
|
||||
|
||||
/* Set up the DRAM controller. The refresh is based on the 11.2896MHz
|
||||
clock (5.6448MHz bus frequency). We haven't yet started the PLL */
|
||||
move.l #0x80050000,%d0
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue