Mercurial > pub > dyncall > dyncall
annotate dyncall/dyncall_callvm_x64.h @ 533:71c884e610f0
- integration of patches from Raphael Luba, Thekla, Inc.:
* integration of aggregate-by-value (struct, union) support patch for x64 (win and sysv)
* windows/x64 asm additions to specify how stack unwinds (help for debuggers, exception handling, etc.)
* see Changelog for details
- new calling convention modes for thiscalls (platform agnostic, was specific before)
* new signature character for platform agnostic thiscalls ('*' / DC_SIGCHAR_CC_THISCALL)
- dcCallF(), dcVCallF(), dcArgF() and dcVArgF():
* added support for aggregates-by-value (wasn't part of patch)
* change that those functions don't implicitly call dcReset() anymore, which was unflexible (breaking change)
- added macros to feature test implementation for aggregate-by-value and syscall support
- changed libdyncall_s.lib and libdyncallback_s.lib order in callback test makefiles, as some toolchains are picky about order
- doc:
* man page updates to describe aggregate interface
* manual overview changes to highlight platforms with aggregate-by-value support
- test/plain: replaced tests w/ old/stale sctruct interface with new aggregate one
author | Tassilo Philipp |
---|---|
date | Thu, 21 Apr 2022 13:35:47 +0200 |
parents | ad5f9803f52f |
children |
rev | line source |
---|---|
0 | 1 /* |
2 | |
3 Package: dyncall | |
4 Library: dyncall | |
5 File: dyncall/dyncall_callvm_x64.h | |
6 Description: | |
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 | |
28 /* | |
29 | |
30 dyncall callvm for x64 architecture | |
31 | |
32 SUPPORTED CALLING CONVENTIONS | |
33 MS Windows x64 calling convention, AMD64 SystemV ABI | |
34 | |
35 REVISION | |
36 2007/12/11 initial | |
37 | |
38 */ | |
39 | |
40 | |
41 #ifndef DYNCALL_CALLVM_X64_H | |
42 #define DYNCALL_CALLVM_X64_H | |
43 | |
44 #include "dyncall_macros.h" | |
45 #include "dyncall_callvm.h" | |
46 #include "dyncall_vector.h" | |
47 | |
48 | |
49 #if defined(DC_WINDOWS) | |
50 | |
51 typedef long long int64; /* llp64 */ | |
52 | |
53 #define numIntRegs 4 | |
54 #define numFloatRegs 4 | |
55 #define DCRegCount_x64 DCRegCount_x64_u | |
56 #define DCRegData_x64 DCRegData_x64_u | |
57 | |
58 #elif defined(DC_UNIX) | |
59 | |
60 typedef long int64; /* lp64 */ | |
61 | |
62 #define numIntRegs 6 | |
63 #define numFloatRegs 8 | |
64 #define DCRegCount_x64 DCRegCount_x64_s | |
65 #define DCRegData_x64 DCRegData_x64_s | |
66 | |
67 #else | |
68 | |
69 #error Unsupported OS. | |
70 | |
71 #endif | |
72 | |
73 typedef union | |
74 { | |
75 int i; | |
76 int f; | |
77 } DCRegCount_x64_u; | |
78 | |
79 typedef struct | |
80 { | |
81 int i; | |
82 int f; | |
83 } DCRegCount_x64_s; | |
84 | |
85 typedef union | |
86 { | |
87 int64 i[numIntRegs ]; | |
88 double f[numFloatRegs]; | |
89 } DCRegData_x64_u; | |
90 | |
91 typedef struct | |
92 { | |
93 int64 i[numIntRegs ]; | |
94 double f[numFloatRegs]; | |
95 } DCRegData_x64_s; | |
96 | |
97 | |
98 typedef struct | |
99 { | |
533
71c884e610f0
- integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents:
366
diff
changeset
|
100 DCCallVM mInterface; /* this CallVM interface */ |
71c884e610f0
- integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents:
366
diff
changeset
|
101 DCpointer mpCallFunc; /* function to call */ |
71c884e610f0
- integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents:
366
diff
changeset
|
102 DCint mAggrReturnReg; /* reg index for aggregate ret value (if hidden argument) */ |
71c884e610f0
- integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents:
366
diff
changeset
|
103 #if defined(DC_WINDOWS) |
71c884e610f0
- integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents:
366
diff
changeset
|
104 DCpointer mpAggrVecCopies; /* ptr to copies of aggrs passed via hidden ptr (end of vector) */ |
71c884e610f0
- integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents:
366
diff
changeset
|
105 #endif |
71c884e610f0
- integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents:
366
diff
changeset
|
106 DCRegCount_x64 mRegCount; /* number of int/sse registers used for parameter passing */ |
71c884e610f0
- integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents:
366
diff
changeset
|
107 DCRegData_x64 mRegData; /* parameters to be passed via registers */ |
71c884e610f0
- integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents:
366
diff
changeset
|
108 DCVecHead mVecHead; /* parameters to be pushed onto stack */ |
0 | 109 } DCCallVM_x64; |
110 | |
111 #endif /* DYNCALL_CALLVM_X64_H */ | |
112 |