Do the same with the reboot patch

This commit is contained in:
Aurora 2016-10-14 19:13:33 +02:00
parent d5e74b91c7
commit fc994285f9

View File

@ -1,7 +1,8 @@
.arm.little .arm.little
payload_addr equ 0x23F00000 ; Brahma payload address. payload_addr equ 0x23F00000 ; Brahma payload address
payload_maxsize equ 0x100000 ; Maximum size for the payload (maximum that CakeBrah supports). payload_maxsize equ 0x100000 ; Maximum size for the payload (maximum that CakeBrah supports)
sd_notmounted equ 0xC8804465 ; Error code returned when SD is not mounted
.create "build/reboot.bin", 0 .create "build/reboot.bin", 0
.arm .arm
@ -26,27 +27,28 @@ payload_maxsize equ 0x100000 ; Maximum size for the payload (maximum that CakeB
bne pxi_wait_recv bne pxi_wait_recv
adr r1, sd_fname adr r1, sd_fname
mov r4, #0
open_payload: open_payload:
; Open file ; Open file
cmp r4, #2 ; Panic if both payloads don't exist
beq svcBreak
add r0, r7, #8 add r0, r7, #8
mov r2, #1 mov r2, #1
ldr r6, [fopen] ldr r6, [fopen]
orr r6, 1 orr r6, 1
blx r6 blx r6
cmp r0, #0 cmp r0, #0
adrne r1, nand_fname beq read_payload
addne r4, #1 ldr r2, =sd_notmounted
bne open_payload cmp r0, r2
bne svcBreak
adr r1, nand_fname
b open_payload
read_payload:
; Read file ; Read file
mov r0, r7 mov r0, r7
adr r1, bytes_read adr r1, bytes_read
ldr r2, =payload_addr ldr r2, =payload_addr
mov r3, payload_maxsize ldr r3, =payload_maxsize
ldr r6, [r7] ldr r6, [r7]
ldr r6, [r6, #0x28] ldr r6, [r6, #0x28]
blx r6 blx r6