Mercurial > pub > dyncall > dyncall
comparison dyncallback/dyncall_callback_arm64.S @ 371:451299d50c1a
- windows arm64 support (dyncall, dyncallback, cmake support for armasm64), thanks Bernhard Urban-Forster!
- minor cleanups
author | Tassilo Philipp |
---|---|
date | Fri, 25 Dec 2020 18:07:39 +0100 |
parents | f5577f6bf97a |
children | cab0031c6691 |
comparison
equal
deleted
inserted
replaced
370:fa78490381f3 | 371:451299d50c1a |
---|---|
4 Library: dyncallback | 4 Library: dyncallback |
5 File: dyncallback/dyncall_callback_arm64.S | 5 File: dyncallback/dyncall_callback_arm64.S |
6 Description: Callback Thunk - Implementation for ARM64 / ARMv8 / AAPCS64 | 6 Description: Callback Thunk - Implementation for ARM64 / ARMv8 / AAPCS64 |
7 License: | 7 License: |
8 | 8 |
9 Copyright (c) 2015-2018 Daniel Adler <dadler@uni-goettingen.de>, | 9 Copyright (c) 2015-2020 Daniel Adler <dadler@uni-goettingen.de>, |
10 Tassilo Philipp <tphilipp@potion-studios.com> | 10 Tassilo Philipp <tphilipp@potion-studios.com> |
11 | 11 |
12 Permission to use, copy, modify, and distribute this software for any | 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 | 13 purpose with or without fee is hereby granted, provided that the above |
14 copyright notice and this permission notice appear in all copies. | 14 copyright notice and this permission notice appear in all copies. |
20 WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN | 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 | 21 ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF |
22 OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. | 22 OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. |
23 | 23 |
24 */ | 24 */ |
25 | |
26 #include "../portasm/portasm-arm64.S" | |
27 BEGIN_ASM | |
28 | |
25 // struct DCCallback | 29 // struct DCCallback |
26 // type off size | 30 // type off size |
27 // ---------|------|------ | 31 // ---------|------|------ |
28 // DCThunk | 0 | 32 | 32 // DCThunk | 0 | 32 |
29 // handler | 32 | 8 | 33 // handler | 32 | 8 |
30 // userdata | 40 | 8 | 34 // userdata | 40 | 8 |
31 | 35 |
32 #include "../portasm/portasm-arm.S" | 36 TEXTAREA |
33 | 37 |
34 .align 4 | |
35 GLOBAL_C(dcCallbackThunkEntry) | 38 GLOBAL_C(dcCallbackThunkEntry) |
36 ENTRY_C(dcCallbackThunkEntry) | 39 ENTRY_C(dcCallbackThunkEntry) |
40 ALIGN(4) | |
37 | 41 |
38 // input: | 42 // input: |
39 // x9: DCCallback* pcb | 43 // x9: DCCallback* pcb |
40 // x0..x7 ?? GP regs | 44 // x0..x7 ?? GP regs |
41 // d0..d7 ?? FP/SIMD regs | 45 // d0..d7 ?? FP/SIMD regs |
69 stp x4, x5, [x11, #32] | 73 stp x4, x5, [x11, #32] |
70 stp x6, x7, [x11, #48] | 74 stp x6, x7, [x11, #48] |
71 | 75 |
72 stp d0, d1, [x11, #64] | 76 stp d0, d1, [x11, #64] |
73 stp d2, d3, [x11, #80] | 77 stp d2, d3, [x11, #80] |
74 stp d4, d5, [x11, #96] | 78 stp d4, d5, [x11, #96] |
75 stp d6, d7, [x11, #112] | 79 stp d6, d7, [x11, #112] |
76 | 80 |
77 eor x12, x12, x12 | 81 eor x12, x12, x12 |
78 stp x10,x12,[x11, #128] // sp=sp, i=0, f=0 | 82 stp x10,x12,[x11, #128] // sp=sp, i=0, f=0 |
79 | 83 |
80 str x12, [x11, #144] // s=0, reserved=0 | 84 str x12, [x11, #144] // s=0, reserved=0 |
95 ldr x11, [x9 , #32] | 99 ldr x11, [x9 , #32] |
96 blr x11 | 100 blr x11 |
97 | 101 |
98 and w0, w0, #255 | 102 and w0, w0, #255 |
99 cmp w0, 'f' | 103 cmp w0, 'f' |
100 b.eq .retf | 104 b.eq LABELUSE(retf) |
101 cmp w0, 'd' | 105 cmp w0, 'd' |
102 b.eq .retf | 106 b.eq LABELUSE(retf) |
103 | 107 |
104 .reti: | 108 LABELDEF(reti) |
105 ldr x0, [x29, #184] | 109 ldr x0, [x29, #184] |
106 b .ret | 110 b LABELUSE(ret) |
107 .retf: | 111 LABELDEF(retf) |
108 ldr d0, [x29, #184] | 112 ldr d0, [x29, #184] |
109 .ret: | 113 LABELDEF(ret) |
110 ldp x29, x30, [sp], #208 | 114 ldp x29, x30, [sp], #208 |
111 ret | 115 ret |
116 | |
117 | |
118 END_PROC | |
119 END_ASM | |
120 |