From a05c40fa30ae2221000af3ad2dc88fabc8898788 Mon Sep 17 00:00:00 2001 From: Maschell Date: Wed, 27 Jul 2022 21:08:58 +0200 Subject: [PATCH] wutcrt: Make sure main is called with a 8 byte aligned stack pointer --- libraries/wutcrt/crt0_rpl.s | 20 ++++++++++---------- libraries/wutcrt/crt0_rpx.s | 14 +++++++------- 2 files changed, 17 insertions(+), 17 deletions(-) diff --git a/libraries/wutcrt/crt0_rpl.s b/libraries/wutcrt/crt0_rpl.s index 2af4969af..b54ea5a29 100644 --- a/libraries/wutcrt/crt0_rpl.s +++ b/libraries/wutcrt/crt0_rpl.s @@ -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 @@ -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 diff --git a/libraries/wutcrt/crt0_rpx.s b/libraries/wutcrt/crt0_rpx.s index 42b4bb2b8..b547b7df1 100644 --- a/libraries/wutcrt/crt0_rpx.s +++ b/libraries/wutcrt/crt0_rpx.s @@ -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 # -----------------------------------