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 {
|
|
100 DCCallVM mInterface; /* This CallVM interface. */
|
|
101 DCpointer mpCallFunc; /* Function to call. */
|
|
102 DCRegCount_x64 mRegCount; /* Number of int/sse registers used for parameter passing. */
|
|
103 DCRegData_x64 mRegData; /* Parameters to be passed via registers. */
|
|
104 DCVecHead mVecHead; /* Parameters to be pushed onto stack. */
|
|
105 } DCCallVM_x64;
|
|
106
|
|
107 #endif /* DYNCALL_CALLVM_X64_H */
|
|
108
|