Skip to content

Commit

Permalink
wutcrt: Make sure main is called with a 8 byte aligned stack pointer
Browse files Browse the repository at this point in the history
  • Loading branch information
Maschell committed Jul 27, 2022
1 parent 9d7289c commit b1142d5
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 17 deletions.
20 changes: 10 additions & 10 deletions libraries/wutcrt/crt0_rpl.s
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,11 @@
.section .crt0, "ax", @progbits
.global __rpl_start
__rpl_start:
stwu 1, -0x14(1)
stwu 1, -0x10(1)
mflr 0
stw 0, 0x18(1)
stw 3, 0xC(1)
stw 4, 0x10(1)
stw 0, 0x4(1)
stw 3, 0x8(1)
stw 4, 0xC(1)
cmpwi 3, 2
beq unload

Expand All @@ -20,17 +20,17 @@ load:
# rpl files use wutmalloc instead of the custom heap
bl __init_wut_malloc
bl __eabi
lwz 3, 0xC(1)
lwz 4, 0x10(1)
lwz 3, 0x8(1)
lwz 4, 0xC(1)
bl rpl_entry
addi 1, 1, 0x14
addi 1, 1, 0x10
blr

unload:
# Handle unload
lwz 3, 0xC(1)
lwz 4, 0x10(1)
lwz 3, 0x8(1)
lwz 4, 0xC(1)
bl rpl_entry
addi 1, 1, 0x14
addi 1, 1, 0x10
b exit

14 changes: 7 additions & 7 deletions libraries/wutcrt/crt0_rpx.s
Original file line number Diff line number Diff line change
Expand Up @@ -7,16 +7,16 @@
.section .crt0, "ax", @progbits
.global __rpx_start
__rpx_start:
stwu 1, -0x14(1)
stwu 1, -0x10(1)
mflr 0
stw 0, 0x18(1)
stw 3, 0xC(1)
stw 4, 0x10(1)
stw 0, 0x4(1)
stw 3, 0x8(1)
stw 4, 0xC(1)
bl __init_wut
lwz 3, 0xC(1)
lwz 4, 0x10(1)
lwz 3, 0x8(1)
lwz 4, 0xC(1)
bl main
addi 1, 1, 0x14
addi 1, 1, 0x10
b exit

# -----------------------------------
Expand Down

0 comments on commit b1142d5

Please sign in to comment.