Mercurial > pub > dyncall > dyncall
comparison dyncall/dyncall_call_arm32_thumb_gas.s @ 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 | 523c45dfa8fb |
children | 351bb41d3bb1 |
comparison
equal
deleted
inserted
replaced
174:a8052efbde18 | 175:00dd15cc5c87 |
---|---|
34 /* Main dyncall call. */ | 34 /* Main dyncall call. */ |
35 .thumb_func | 35 .thumb_func |
36 dcCall_arm32_thumb: | 36 dcCall_arm32_thumb: |
37 | 37 |
38 /* Prolog. This function never needs to spill inside its prolog, so just store the permanent registers. */ | 38 /* Prolog. This function never needs to spill inside its prolog, so just store the permanent registers. */ |
39 push {%r4-%r7, %r14} /* Frame ptr, permanent registers, link register -> save area on stack. */ | 39 /* Code below is not using high registers, so not storing them in prolog, which is more involved with thumb, anyways. */ |
40 push {%r4-%r7, %r14} /* Frame ptr, permanent registers, link register -> save area on stack. */ | |
40 mov %r7, %r13 /* Set frame ptr. */ | 41 mov %r7, %r13 /* Set frame ptr. */ |
42 sub %r13, #4 /* Realign stack to 8 bytes (b/c we stored 5 regs = 20b). */ | |
41 | 43 |
42 /* Call. */ | 44 /* Call. */ |
43 mov %r4, %r0 /* Move 'fptr' to r4 (1st argument is passed in r0). */ | 45 mov %r4, %r0 /* Move 'fptr' to r4 (1st argument is passed in r0). */ |
44 | |
45 /* Disable 'thumb' address forcing... */ | |
46 | |
47 /* mov %r0, #1 */ /* Assure that LSB is set to 1 (THUMB call). - Not Required and not useful for interworking calls */ | |
48 /* orr %r4, %r0 */ | |
49 | |
50 mov %r5, %r1 /* Move 'args' to r5 (2nd argument is passed in r1). */ | 46 mov %r5, %r1 /* Move 'args' to r5 (2nd argument is passed in r1). */ |
51 mov %r6, %r2 /* Move 'size' to r6 (3rd argument is passed in r2). */ | 47 mov %r6, %r2 /* Move 'size' to r6 (3rd argument is passed in r2). */ |
52 | 48 |
53 cmp %r6, #16 /* Jump to call if no more than 4 arguments. */ | 49 cmp %r6, #16 /* Jump to call if no more than 4 arguments. */ |
54 ble call | 50 ble call |