Mercurial > pub > dyncall > dyncall
annotate dyncallback/dyncall_thunk.h @ 663:127b569978cc default tip
- another tweak handling clang trying to be too smart (see last commit)
author | Tassilo Philipp |
---|---|
date | Sun, 24 Mar 2024 13:52:44 +0100 |
parents | 0c8838766866 |
children |
rev | line source |
---|---|
0 | 1 /* |
2 | |
3 Package: dyncall | |
4 Library: dyncallback | |
5 File: dyncallback/dyncall_thunk.h | |
6 Description: Thunk - Interface | |
7 License: | |
8 | |
281 | 9 Copyright (c) 2007-2018 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 #ifndef DYNCALL_THUNK_H | |
28 #define DYNCALL_THUNK_H | |
29 | |
30 /** | |
31 ** dyncall thunks | |
32 ** | |
33 ** thunks are small-size hybrid code/data objects, created at run-time to | |
34 ** be used as function pointers with associated data and entry functions. | |
35 ** | |
36 ** The header contains code, that does load its address into a designated scratch | |
37 ** register and will jump to a thunk function. | |
38 ** | |
39 ** Thunk entry procedures are compiled functions, that are called as a result of | |
40 ** a thunk function. | |
41 ** There is one thunk entry currently for supporting callbacks. | |
42 ** | |
43 ** Thunk context register ( ::= an available scratch register in the calling convention): | |
44 ** | |
45 ** x86: eax | |
46 ** x64: rax | |
47 ** ppc: r2 | |
48 ** arm: r12 | |
49 ** arm64: x9 | |
101 | 50 ** mips: t4 |
653
0c8838766866
- riscv64 support for calls and callbacks (but lacking aggr and syscall support) - thanks Jun Jeon! :)
Tassilo Philipp
parents:
292
diff
changeset
|
51 ** riscv: t5 |
0 | 52 ** |
53 **/ | |
54 | |
292 | 55 #include "dyncall_macros.h" |
0 | 56 |
57 typedef struct DCThunk_ DCThunk; | |
58 | |
59 #ifdef __cplusplus | |
60 extern "C" { | |
61 #endif | |
62 | |
63 void dcbInitThunk(DCThunk* p, void (*entry)()); | |
64 | |
65 #if defined(DC__Arch_Intel_x86) | |
66 #include "dyncall_thunk_x86.h" | |
67 #elif defined (DC__Arch_AMD64) | |
68 #include "dyncall_thunk_x64.h" | |
69 #elif defined (DC__Arch_PPC32) | |
70 #include "dyncall_thunk_ppc32.h" | |
71 #elif defined (DC__Arch_PPC64) | |
72 #include "dyncall_thunk_ppc64.h" | |
143
170cde9e2a83
- arm arm/thumb cleanup, sharing more files, directly
cslag
parents:
116
diff
changeset
|
73 #elif defined (DC__Arch_ARM) |
170cde9e2a83
- arm arm/thumb cleanup, sharing more files, directly
cslag
parents:
116
diff
changeset
|
74 #include "dyncall_thunk_arm32.h" |
0 | 75 #elif defined (DC__Arch_MIPS) |
76 #include "dyncall_thunk_mips.h" | |
116 | 77 #elif defined (DC__Arch_MIPS64) |
78 #include "dyncall_thunk_mips64.h" | |
0 | 79 #elif defined (DC__Arch_Sparc) |
80 #include "dyncall_thunk_sparc32.h" | |
179 | 81 #elif defined (DC__Arch_Sparc64) |
0 | 82 #include "dyncall_thunk_sparc64.h" |
83 #elif defined (DC__Arch_ARM64) | |
84 #include "dyncall_thunk_arm64.h" | |
653
0c8838766866
- riscv64 support for calls and callbacks (but lacking aggr and syscall support) - thanks Jun Jeon! :)
Tassilo Philipp
parents:
292
diff
changeset
|
85 #elif defined (DC__Arch_RiscV64) |
0c8838766866
- riscv64 support for calls and callbacks (but lacking aggr and syscall support) - thanks Jun Jeon! :)
Tassilo Philipp
parents:
292
diff
changeset
|
86 #include "dyncall_thunk_riscv64.h" |
0 | 87 #endif |
88 | |
89 #ifdef __cplusplus | |
90 } | |
91 #endif | |
92 | |
93 | |
94 #endif /* DYNCALL_THUNK_H */ | |
101 | 95 |