From 9f3259d770b17964a266303c9ee57e0625b431eb Mon Sep 17 00:00:00 2001 From: Corwin Date: Wed, 17 May 2023 19:52:06 +0100 Subject: [PATCH 1/3] fix alignment of thumb functions defined in assembly --- agb/src/asm_include.s | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/agb/src/asm_include.s b/agb/src/asm_include.s index 1682792c..a4902e04 100644 --- a/agb/src/asm_include.s +++ b/agb/src/asm_include.s @@ -17,7 +17,7 @@ .macro agb_thumb_func functionName:req .section .iwram.\functionName, "ax", %progbits .thumb -.align 2 +.align 1 .global \functionName .type \functionName, %function .func \functionName From e1426d8ef7a4d6ca00187e3d5a0b8958398c55f1 Mon Sep 17 00:00:00 2001 From: Corwin Date: Wed, 17 May 2023 23:25:27 +0100 Subject: [PATCH 2/3] correct non thumb-interwork return --- agb/src/save/asm_routines.s | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/agb/src/save/asm_routines.s b/agb/src/save/asm_routines.s index 91128bf4..ac96ce9c 100644 --- a/agb/src/save/asm_routines.s +++ b/agb/src/save/asm_routines.s @@ -31,7 +31,9 @@ agb_thumb_func agb_rs__WramVerifyBuf @ Returns from the function successfully movs r0, #1 0: @ Jumps to here return the function unsuccessfully, because r0 contains 0 at this point - pop {r4-r5, pc} + pop {r4-r5} + pop {r1} + bx r1 agb_thumb_end agb_rs__WramVerifyBuf From df696a1093d625bf3403324d1fd25b257c132170 Mon Sep 17 00:00:00 2001 From: Corwin Date: Thu, 18 May 2023 12:06:30 +0100 Subject: [PATCH 3/3] align after section --- agb/src/agbabi/memcpy.s | 3 ++- agb/src/agbabi/memset.s | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/agb/src/agbabi/memcpy.s b/agb/src/agbabi/memcpy.s index 08baab52..056df5d0 100644 --- a/agb/src/agbabi/memcpy.s +++ b/agb/src/agbabi/memcpy.s @@ -14,9 +14,9 @@ .include "src/agbabi/macros.inc" .arm - .align 2 .section .iwram.__aeabi_memcpy, "ax", %progbits + .align 2 .global __agbabi_memcpy __agbabi_memcpy: .global __aeabi_memcpy @@ -115,6 +115,7 @@ __agbabi_memcpy1: bx lr .section .iwram.memcpy, "ax", %progbits + .align 2 .global memcpy memcpy: push {r0, lr} diff --git a/agb/src/agbabi/memset.s b/agb/src/agbabi/memset.s index be51ced2..d4f481e5 100644 --- a/agb/src/agbabi/memset.s +++ b/agb/src/agbabi/memset.s @@ -16,9 +16,9 @@ */ .arm - .align 2 .section .iwram.__aeabi_memset, "ax", %progbits + .align 2 .global __aeabi_memclr __aeabi_memclr: mov r2, #0 @@ -109,6 +109,7 @@ __agbabi_wordset4: bx lr .section .iwram.memset, "ax", %progbits + .align 2 .global memset memset: mov r3, r1