comparison dyncall/dyncall_callvm_x64.h @ 0:3e629dc19168

initial from svn dyncall-1745
author Daniel Adler
date Thu, 19 Mar 2015 22:24:28 +0100
parents
children 67961454902b
comparison
equal deleted inserted replaced
-1:000000000000 0:3e629dc19168
1 /*
2
3 Package: dyncall
4 Library: dyncall
5 File: dyncall/dyncall_callvm_x64.h
6 Description:
7 License:
8
9 Copyright (c) 2007-2015 Daniel Adler <dadler@uni-goettingen.de>,
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_call_x64.h"
46 #include "dyncall_callvm.h"
47 #include "dyncall_vector.h"
48
49
50 #if defined(DC_WINDOWS)
51
52 typedef long long int64; /* llp64 */
53
54 #define numIntRegs 4
55 #define numFloatRegs 4
56 #define DCRegCount_x64 DCRegCount_x64_u
57 #define DCRegData_x64 DCRegData_x64_u
58
59 #elif defined(DC_UNIX)
60
61 typedef long int64; /* lp64 */
62
63 #define numIntRegs 6
64 #define numFloatRegs 8
65 #define DCRegCount_x64 DCRegCount_x64_s
66 #define DCRegData_x64 DCRegData_x64_s
67
68 #else
69
70 #error Unsupported OS.
71
72 #endif
73
74 typedef union
75 {
76 int i;
77 int f;
78 } DCRegCount_x64_u;
79
80 typedef struct
81 {
82 int i;
83 int f;
84 } DCRegCount_x64_s;
85
86 typedef union
87 {
88 int64 i[numIntRegs ];
89 double f[numFloatRegs];
90 } DCRegData_x64_u;
91
92 typedef struct
93 {
94 int64 i[numIntRegs ];
95 double f[numFloatRegs];
96 } DCRegData_x64_s;
97
98
99 typedef struct
100 {
101 DCCallVM mInterface; /* This CallVM interface. */
102 DCpointer mpCallFunc; /* Function to call. */
103 DCRegCount_x64 mRegCount; /* Number of int/sse registers used for parameter passing. */
104 DCRegData_x64 mRegData; /* Parameters to be passed via registers. */
105 DCVecHead mVecHead; /* Parameters to be pushed onto stack. */
106 } DCCallVM_x64;
107
108 DCCallVM* dcNewCallVM_x64(DCsize size);
109
110
111 #endif /* DYNCALL_CALLVM_X64_H */
112