Skip to content

Commit 622de53

Browse files
racerxdldeadprogram
authored andcommitted
nintendoswitch: simplified assembly code
1 parent 6cd9e3c commit 622de53

File tree

1 file changed

+3
-20
lines changed

1 file changed

+3
-20
lines changed

targets/nintendoswitch.s

Lines changed: 3 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -51,9 +51,8 @@ start:
5151
mov x5, x0
5252
mov x4, x1
5353

54-
// Save lr, context pointer, main thread handler
55-
adrp x0, _aslr_base
56-
str x6, [x0, #:lo12:_aslr_base]
54+
// Save ASLR Base to use later
55+
mov x0, x6
5756

5857
// clear .bss
5958
adrp x5, __bss_start
@@ -70,26 +69,10 @@ bssloop:
7069

7170
run:
7271
// process .dynamic section
73-
adrp x0, _aslr_base
74-
ldr x0, [x0, #:lo12:_aslr_base]
72+
// ASLR base on x0
7573
adrp x1, _DYNAMIC
7674
add x1, x1, #:lo12:_DYNAMIC
7775
bl __dynamic_loader
7876

79-
// set LR to svcExitProcess if it's null
80-
adrp x3, exit
81-
add x3, x3, #:lo12:exit
82-
cmp x30, xzr
83-
csel x30, x3, x30, eq
84-
8577
// call entrypoint
86-
mov x3, sp
87-
sub sp, sp, 0x10
88-
stp x29, x30, [sp]
8978
b main
90-
91-
.section .data.horizon
92-
.align 8
93-
.global _aslr_base // Placeholder for ASLR Base Address
94-
_aslr_base:
95-
.dword 0

0 commit comments

Comments
 (0)