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,30 +27,31 @@ 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 file read_payload:
mov r0, r7 ; Read file
adr r1, bytes_read mov r0, r7
ldr r2, =payload_addr adr r1, bytes_read
mov r3, payload_maxsize ldr r2, =payload_addr
ldr r6, [r7] ldr r3, =payload_maxsize
ldr r6, [r6, #0x28] ldr r6, [r7]
blx r6 ldr r6, [r6, #0x28]
blx r6
; Copy the low TID (in UTF-16) of the wanted firm to the 5th byte of the payload ; Copy the low TID (in UTF-16) of the wanted firm to the 5th byte of the payload
add r0, r8, 0x1A add r0, r8, 0x1A