changeset 175:00dd15cc5c87

- fixed ARM32-THUMB stack alignment issues (found on Cortex-m0, thanks Darren Whobrey!)
author cslag
date Thu, 09 Feb 2017 15:44:14 +0100
parents a8052efbde18
children ff0c8ee2bbc7
files ChangeLog dyncall/dyncall_call_arm32_thumb_gas.s
diffstat 2 files changed, 4 insertions(+), 7 deletions(-) [+]
line wrap: on
line diff
--- a/ChangeLog	Wed Feb 08 12:56:59 2017 +0100
+++ b/ChangeLog	Thu Feb 09 15:44:14 2017 +0100
@@ -8,6 +8,7 @@
     underway)
   o MIPS n64 ellipsis call fixes
   o ARM32 armhf ellipsis call fixes
+  o fixed ARM32-THUMB stack alignment issues (found on Cortex-m0, thanks Darren Whobrey!)
   o better C++ compiler support (for pointer conversions)
 dyncallback:
   o PPC64 single-precision float fixes for more than 13 float args (thanks Masanori!)
--- a/dyncall/dyncall_call_arm32_thumb_gas.s	Wed Feb 08 12:56:59 2017 +0100
+++ b/dyncall/dyncall_call_arm32_thumb_gas.s	Thu Feb 09 15:44:14 2017 +0100
@@ -36,17 +36,13 @@
 dcCall_arm32_thumb:
 
 	/* Prolog. This function never needs to spill inside its prolog, so just store the permanent registers. */
-	push	{%r4-%r7, %r14}	   	/* Frame ptr, permanent registers, link register -> save area on stack. */
+	/* Code below is not using high registers, so not storing them in prolog, which is more involved with thumb, anyways. */
+	push	{%r4-%r7, %r14}		/* Frame ptr, permanent registers, link register -> save area on stack. */
 	mov		%r7, %r13	/* Set frame ptr. */
+	sub		%r13, #4	/* Realign stack to 8 bytes (b/c we stored 5 regs = 20b). */
 
 	/* Call. */
 	mov		%r4, %r0	/* Move 'fptr' to r4 (1st argument is passed in r0). */
-
-	/* Disable 'thumb' address forcing... */
-
-	/* mov		%r0, #1	*/	/* Assure that LSB is set to 1 (THUMB call). - Not Required and not useful for interworking calls */
-	/* orr		%r4, %r0 */
-	
 	mov		%r5, %r1	/* Move 'args' to r5 (2nd argument is passed in r1). */
 	mov		%r6, %r2	/* Move 'size' to r6 (3rd argument is passed in r2). */