Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

wutcrt: Make sure main is called with a 8 byte aligned stack pointer #248

Merged
merged 1 commit into from
Jul 27, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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, 0x14(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, 0x14(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