mirror of
https://github.com/wiiu-env/wut.git
synced 2025-01-06 13:58:18 +01:00
wutcrt: Setup a proper stack frame for _start.
This commit is contained in:
parent
699aa5ca99
commit
1c3d26ab1b
@ -5,9 +5,11 @@
|
||||
|
||||
.global _start
|
||||
_start:
|
||||
stwu 1, -0x8(1)
|
||||
stw 3, 0(1)
|
||||
stw 4, 4(1)
|
||||
stwu 1, -0x14(1)
|
||||
mflr 0
|
||||
stw 0, 0x18(1)
|
||||
stw 3, 0xC(1)
|
||||
stw 4, 0x10(1)
|
||||
cmpwi 3, 2
|
||||
beq unload
|
||||
|
||||
@ -15,17 +17,18 @@ load:
|
||||
# Load
|
||||
bl __init_wut
|
||||
bl __eabi
|
||||
lwz 3, 0(1)
|
||||
lwz 4, 4(1)
|
||||
lwz 3, 0xC(1)
|
||||
lwz 4, 0x10(1)
|
||||
bl rpl_main
|
||||
addi 1, 1, 0x8
|
||||
addi 1, 1, 0x14
|
||||
blr
|
||||
|
||||
unload:
|
||||
# Handle unload
|
||||
lwz 3, 0(1)
|
||||
lwz 4, 4(1)
|
||||
lwz 3, 0xC(1)
|
||||
lwz 4, 0x10(1)
|
||||
bl rpl_main
|
||||
bl __fini_wut
|
||||
addi 1, 1, 0x8
|
||||
addi 1, 1, 0x14
|
||||
b exit
|
||||
|
||||
|
@ -5,15 +5,15 @@
|
||||
|
||||
.global _start
|
||||
_start:
|
||||
stwu 1, -0x8(1)
|
||||
stw 3, 0(1)
|
||||
stw 4, 4(1)
|
||||
stwu 1, -0x14(1)
|
||||
mflr 0
|
||||
stw 0, 0x18(1)
|
||||
stw 3, 0xC(1)
|
||||
stw 4, 0x10(1)
|
||||
bl __init_wut
|
||||
lwz 3, 0(1)
|
||||
lwz 4, 4(1)
|
||||
lwz 3, 0xC(1)
|
||||
lwz 4, 0x10(1)
|
||||
bl main
|
||||
bl __fini_wut
|
||||
# Calling __fini is leading to crashes!
|
||||
# bl __fini
|
||||
addi 1, 1, 0x8
|
||||
addi 1, 1, 0x14
|
||||
b exit
|
||||
|
Loading…
Reference in New Issue
Block a user