sept: be more forgiving about entrypoint

This commit is contained in:
Michael Scire 2020-12-07 03:20:01 -08:00
parent 15396dbbc2
commit 121c981bb4

View file

@ -13,7 +13,7 @@
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
.section .text.start, "ax", %progbits .section .text.start, "ax", %progbits
.arm .arm
.align 5 .align 5
@ -24,34 +24,34 @@ _start:
mov r0, #0x0 mov r0, #0x0
ldr r1, =0x7000E400 ldr r1, =0x7000E400
str r0, [r1, #0x50] str r0, [r1, #0x50]
/* Tell pk1ldr normal reboot, no error */ /* Tell pk1ldr normal reboot, no error */
str r0, [r1, #0x1B4] str r0, [r1, #0x1B4]
str r0, [r1, #0x840] str r0, [r1, #0x840]
/* Cleanup SVC handler address. */ /* Cleanup SVC handler address. */
ldr r0, =0x40004C30 ldr r0, =0x40004C30
ldr r1, =0x6000F208 ldr r1, =0x6000F208
str r0, [r1] str r0, [r1]
/* Disable RCM forcefully */ /* Disable RCM forcefully */
mov r0, #0x4 mov r0, #0x4
ldr r1, =0x15DC ldr r1, =0x15DC
ldr r2, =0xE020 ldr r2, =0xE020
bl ipatch_word bl ipatch_word
/* Patch BCT signature check */ /* Patch BCT signature check */
mov r0, #0x5 mov r0, #0x5
ldr r1, =0x4AEE ldr r1, =0x4AEE
ldr r2, =0xE05B ldr r2, =0xE05B
bl ipatch_word bl ipatch_word
/* Patch bootloader read */ /* Patch bootloader read */
mov r0, #0x6 mov r0, #0x6
ldr r1, =0x4E88 ldr r1, =0x4E88
ldr r2, =0xE018 ldr r2, =0xE018
bl ipatch_word bl ipatch_word
ldr r0, =__main_phys_start__ ldr r0, =__main_phys_start__
ldr r1, =__main_start__ ldr r1, =__main_start__
mov r2, #0x0 mov r2, #0x0
@ -62,17 +62,17 @@ _start:
add r2, r2, #0x4 add r2, r2, #0x4
cmp r2, r3 cmp r2, r3
bne copy_panic_payload bne copy_panic_payload
/* Jump back to bootrom start. */ /* Jump back to bootrom start. */
ldr r0, =0x101010 ldr r0, =0x101010
bx r0 bx r0
/* Unused, but forces inclusion in binary. */ /* Unused, but forces inclusion in binary. */
b main b main
.section .text.ipatch_word, "ax", %progbits .section .text.ipatch_word, "ax", %progbits
.arm .arm
.align 5 .align 5
@ -86,15 +86,15 @@ ipatch_word:
orr r1, r1, r2 orr r1, r1, r2
str r1, [r3, r0] str r1, [r3, r0]
bx lr bx lr
.section .text.jump_to_main, "ax", %progbits .section .text.jump_to_main, "ax", %progbits
.arm .arm
.align 5 .align 5
.global jump_to_main .global jump_to_main
.type jump_to_main, %function .type jump_to_main, %function
jump_to_main: jump_to_main:
/* Insert 0x40 of NOPs, for version compatibility. */ /* Insert 0x240 of NOPs, for version compatibility. */
.rept 16 .rept (0x240/4)
nop nop
.endr .endr
/* Just jump to main */ /* Just jump to main */