Mercurial > pub > dyncall > dyncall
annotate dyncall/dyncall_call_arm32_arm_armhf.S @ 164:2d330a60c44f
- removed unused, redundant asm file
author | cslag |
---|---|
date | Thu, 05 Jan 2017 10:17:37 +0100 |
parents | 12729fd52ab7 |
children | f5577f6bf97a |
rev | line source |
---|---|
0 | 1 /* |
2 | |
3 Package: dyncall | |
4 Library: dyncall | |
5 File: dyncall/dyncall_call_arm32_arm_armhf.S | |
6 Description: Call Kernel for ARM 32-bit ARM Architecture - Hard Float | |
7 License: | |
8 | |
146
0ab08c1541f0
- fixed armhf ellipsis calls, were ignoring spill area
cslag
parents:
50
diff
changeset
|
9 Copyright (c) 2007-2016 Daniel Adler <dadler@uni-goettingen.de>, |
0 | 10 Tassilo Philipp <tphilipp@potion-studios.com> |
11 | |
12 Permission to use, copy, modify, and distribute this software for any | |
13 purpose with or without fee is hereby granted, provided that the above | |
14 copyright notice and this permission notice appear in all copies. | |
15 | |
16 THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES | |
17 WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF | |
18 MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR | |
19 ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES | |
20 WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN | |
21 ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF | |
22 OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. | |
23 | |
24 */ | |
25 | |
26 | |
27 | |
28 #include "../portasm/portasm-arm.S" | |
29 | |
30 /* ============================================================================ | |
31 DynCall Call Kernel for ARM 32-bit ARM Architecture Hard-Float | |
32 ---------------------------------------------------------------------------- | |
33 C Interface: | |
34 dcCall_arm32_armhf (DCpointer target, DCpointer argv, DCsize size, DCfloat* regdata); | |
35 | |
36 This Call Kernel was tested on Raspberry Pi/Raspbian (Debian) | |
37 */ | |
38 | |
39 .text | |
40 .code 32 /* ARM mode */ | |
41 .arch armv6 | |
42 .fpu vfp | |
43 | |
36 | 44 /* |
45 1st arg / r0 = funptr | |
46 2st arg / r1 = ptr to int args | |
47 3st arg / r2 = size | |
48 4st arg / r3 = ptr to float args | |
49 */ | |
0 | 50 GLOBAL_C(dcCall_arm32_armhf) |
51 ENTRY_C(dcCall_arm32_armhf) | |
52 | |
53 /* Prolog. This function never needs to spill inside its prolog, so just store the permanent registers. */ | |
148
12729fd52ab7
- performance improvement and more correct handling of arm32 armhf calls, not copying bogus data just to reserve spill area space
cslag
parents:
146
diff
changeset
|
54 mov r12 , r13 /* Stack ptr (r13) -> temporary (r12). */ |
12729fd52ab7
- performance improvement and more correct handling of arm32 armhf calls, not copying bogus data just to reserve spill area space
cslag
parents:
146
diff
changeset
|
55 stmdb r13!, {r4-r5, r11, r12, r14} /* Permanent registers and stack pointer (now in r12), etc... -> save area on stack (except counter). */ |
0 | 56 |
148
12729fd52ab7
- performance improvement and more correct handling of arm32 armhf calls, not copying bogus data just to reserve spill area space
cslag
parents:
146
diff
changeset
|
57 mov r11, r12 /* Set frame ptr. */ |
12729fd52ab7
- performance improvement and more correct handling of arm32 armhf calls, not copying bogus data just to reserve spill area space
cslag
parents:
146
diff
changeset
|
58 mov r4, r0 /* r4 = fptr */ |
12729fd52ab7
- performance improvement and more correct handling of arm32 armhf calls, not copying bogus data just to reserve spill area space
cslag
parents:
146
diff
changeset
|
59 add r5, r1, #16 /* r5 = stack args (after intreg ones) */ |
12729fd52ab7
- performance improvement and more correct handling of arm32 armhf calls, not copying bogus data just to reserve spill area space
cslag
parents:
146
diff
changeset
|
60 |
0 | 61 /* Load 16 single-precision registers (= 8 double-precision registers). */ |
148
12729fd52ab7
- performance improvement and more correct handling of arm32 armhf calls, not copying bogus data just to reserve spill area space
cslag
parents:
146
diff
changeset
|
62 fldmiad r3, {d0-d7} |
0 | 63 |
148
12729fd52ab7
- performance improvement and more correct handling of arm32 armhf calls, not copying bogus data just to reserve spill area space
cslag
parents:
146
diff
changeset
|
64 /* prep stack parameter area (includes room for spill area, callee spills if needed) */ |
12729fd52ab7
- performance improvement and more correct handling of arm32 armhf calls, not copying bogus data just to reserve spill area space
cslag
parents:
146
diff
changeset
|
65 sub r13, r13, r2 |
12729fd52ab7
- performance improvement and more correct handling of arm32 armhf calls, not copying bogus data just to reserve spill area space
cslag
parents:
146
diff
changeset
|
66 and r13, r13, #-8 /* align 8-byte. */ |
0 | 67 |
148
12729fd52ab7
- performance improvement and more correct handling of arm32 armhf calls, not copying bogus data just to reserve spill area space
cslag
parents:
146
diff
changeset
|
68 sub r2, r2, #16 /* loop counters for stack params to copy */ |
12729fd52ab7
- performance improvement and more correct handling of arm32 armhf calls, not copying bogus data just to reserve spill area space
cslag
parents:
146
diff
changeset
|
69 mov r3, #0 |
0 | 70 armhf_pushArgs: |
148
12729fd52ab7
- performance improvement and more correct handling of arm32 armhf calls, not copying bogus data just to reserve spill area space
cslag
parents:
146
diff
changeset
|
71 cmp r2, r3 |
12729fd52ab7
- performance improvement and more correct handling of arm32 armhf calls, not copying bogus data just to reserve spill area space
cslag
parents:
146
diff
changeset
|
72 ble armhf_call |
12729fd52ab7
- performance improvement and more correct handling of arm32 armhf calls, not copying bogus data just to reserve spill area space
cslag
parents:
146
diff
changeset
|
73 ldr r0, [r5, +r3] /* load word into r0 ... */ |
12729fd52ab7
- performance improvement and more correct handling of arm32 armhf calls, not copying bogus data just to reserve spill area space
cslag
parents:
146
diff
changeset
|
74 str r0, [r13, +r3] /* ... then push onto stack */ |
12729fd52ab7
- performance improvement and more correct handling of arm32 armhf calls, not copying bogus data just to reserve spill area space
cslag
parents:
146
diff
changeset
|
75 add r3, r3, #4 |
12729fd52ab7
- performance improvement and more correct handling of arm32 armhf calls, not copying bogus data just to reserve spill area space
cslag
parents:
146
diff
changeset
|
76 b armhf_pushArgs |
0 | 77 |
78 armhf_call: | |
148
12729fd52ab7
- performance improvement and more correct handling of arm32 armhf calls, not copying bogus data just to reserve spill area space
cslag
parents:
146
diff
changeset
|
79 ldmia r1, {r0-r3} /* Load first 4 arguments for new call into r0-r3. */ |
12729fd52ab7
- performance improvement and more correct handling of arm32 armhf calls, not copying bogus data just to reserve spill area space
cslag
parents:
146
diff
changeset
|
80 /* 'blx %r4' workaround for ARMv4t: */ |
12729fd52ab7
- performance improvement and more correct handling of arm32 armhf calls, not copying bogus data just to reserve spill area space
cslag
parents:
146
diff
changeset
|
81 mov r14, r15 /* Branch return address(r15) -> link register (r14) -- r15 always points to address of current + 2 instructions (= Epilog code). */ |
12729fd52ab7
- performance improvement and more correct handling of arm32 armhf calls, not copying bogus data just to reserve spill area space
cslag
parents:
146
diff
changeset
|
82 bx r4 /* Call (ARM/THUMB), available for ARMv4t. */ |
0 | 83 |
84 /* Epilog. */ | |
148
12729fd52ab7
- performance improvement and more correct handling of arm32 armhf calls, not copying bogus data just to reserve spill area space
cslag
parents:
146
diff
changeset
|
85 ldmdb r11, {r4-r5, r11, r13, r15} /* Restore permanent registers (ignore temporary (r12), restore stack ptr and program counter).@@@db not needed since we rewrite r13? */ |
0 | 86 |