# HG changeset patch # User cslag # Date 1486651454 -3600 # Node ID 00dd15cc5c8799531f0549604d6f44140187318e # Parent a8052efbde18af506196b1a5030e5aa65ace0e90 - fixed ARM32-THUMB stack alignment issues (found on Cortex-m0, thanks Darren Whobrey!) diff -r a8052efbde18 -r 00dd15cc5c87 ChangeLog --- 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!) diff -r a8052efbde18 -r 00dd15cc5c87 dyncall/dyncall_call_arm32_thumb_gas.s --- 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). */