mirror of
https://github.com/switchbrew/libnx.git
synced 2025-08-07 08:39:24 +02:00
Fixing bugs
This commit is contained in:
parent
b2dcf4e405
commit
a35cdc698b
@ -1,7 +1,8 @@
|
|||||||
.section ".crt0","ax"
|
.section ".crt0","ax"
|
||||||
.global _start, _sysexit, main
|
.global _start, _sysexit, main
|
||||||
|
|
||||||
_start:
|
_start:
|
||||||
bl startup
|
bl startup
|
||||||
|
|
||||||
.word 0x454d4f48
|
.word 0x454d4f48
|
||||||
.word 0x57455242
|
.word 0x57455242
|
||||||
@ -11,12 +12,13 @@ startup:
|
|||||||
sub x30, x30, #4
|
sub x30, x30, #4
|
||||||
|
|
||||||
// clear .bss
|
// clear .bss
|
||||||
ldr x0, =__bss_start__
|
ldr x0, =__bss_start__
|
||||||
ldr x1, =__bss_end__
|
ldr x1, =__bss_end__
|
||||||
sub x1, x1, x0
|
sub x1, x1, x0 // calculate size
|
||||||
add x1, x1, #7
|
add x1, x1, #7 // round up to 8
|
||||||
bic x1, x1, #7
|
bic x1, x1, #7
|
||||||
mov x2, #0
|
mov x2, #0
|
||||||
|
add x0, x0, x30 // relocate ptr
|
||||||
|
|
||||||
bss_loop:
|
bss_loop:
|
||||||
str x2, [x0], #8
|
str x2, [x0], #8
|
||||||
@ -24,24 +26,26 @@ bss_loop:
|
|||||||
bne bss_loop
|
bne bss_loop
|
||||||
|
|
||||||
// relocate .got
|
// relocate .got
|
||||||
ldr x0, =__got_start__
|
ldr x0, =__got_start__
|
||||||
ldr x1, =__got_end__
|
ldr x1, =__got_end__
|
||||||
sub x1, x1, x0
|
sub x1, x1, x0 // calculate size
|
||||||
add x1, x1, #3
|
add x1, x1, #3 // round up to 4
|
||||||
bic x1, x1, #3
|
bic x1, x1, #3
|
||||||
|
add x0, x0, x30 // relocate ptr
|
||||||
|
|
||||||
got_loop:
|
got_loop:
|
||||||
ldr x2, [x0]
|
ldr x2, [x0]
|
||||||
add x2, x2, x30
|
ldr x3, [x2]
|
||||||
str x2, [x0], #8
|
add x3, x3, x30
|
||||||
|
str x3, [x2], #8
|
||||||
subs x1, x1, #8
|
subs x1, x1, #8
|
||||||
bne got_loop
|
bne got_loop
|
||||||
|
|
||||||
mov x0, #0 // argc
|
mov x0, #0 // argc
|
||||||
mov x1, #0 // argv
|
mov x1, #0 // argv
|
||||||
|
|
||||||
ldr x3, =main
|
ldr x3, =main
|
||||||
blr x3
|
blr x3
|
||||||
|
|
||||||
_sysexit:
|
_sysexit:
|
||||||
svc 0x7
|
svc 0x7
|
||||||
|
Loading…
Reference in New Issue
Block a user