Merge pull request #2820 from kumpera/license-change-rebased
[mono.git] / mono / mini / mini-arm64-gsharedvt.h
1 #ifndef __MINI_ARM64_GSHAREDVT_H__
2 #define __MINI_ARM64_GSHAREDVT_H__
3
4 /* Argument marshallings for calls between gsharedvt and normal code */
5 typedef enum {
6         GSHAREDVT_ARG_NONE = 0,
7         GSHAREDVT_ARG_BYVAL_TO_BYREF = 1,
8         GSHAREDVT_ARG_BYVAL_TO_BYREF_HFAR4 = 2,
9         GSHAREDVT_ARG_BYREF_TO_BYVAL = 3,
10         GSHAREDVT_ARG_BYREF_TO_BYVAL_HFAR4 = 4,
11         GSHAREDVT_ARG_BYREF_TO_BYREF = 5
12 } GSharedVtArgMarshal;
13
14 /* For arguments passed on the stack on ios */
15 typedef enum {
16         GSHAREDVT_ARG_SIZE_NONE = 0,
17         GSHAREDVT_ARG_SIZE_I1 = 1,
18         GSHAREDVT_ARG_SIZE_U1 = 2,
19         GSHAREDVT_ARG_SIZE_I2 = 3,
20         GSHAREDVT_ARG_SIZE_U2 = 4,
21         GSHAREDVT_ARG_SIZE_I4 = 5,
22         GSHAREDVT_ARG_SIZE_U4 = 6,
23 } GSharedVtArgSize;
24
25 /* Return value marshalling for calls between gsharedvt and normal code */
26 typedef enum {
27         GSHAREDVT_RET_NONE = 0,
28         GSHAREDVT_RET_I8 = 1,
29         GSHAREDVT_RET_I1 = 2,
30         GSHAREDVT_RET_U1 = 3,
31         GSHAREDVT_RET_I2 = 4,
32         GSHAREDVT_RET_U2 = 5,
33         GSHAREDVT_RET_I4 = 6,
34         GSHAREDVT_RET_U4 = 7,
35         GSHAREDVT_RET_R8 = 8,
36         GSHAREDVT_RET_R4 = 9,
37         GSHAREDVT_RET_IREGS_1 = 10,
38         GSHAREDVT_RET_IREGS_2 = 11,
39         GSHAREDVT_RET_IREGS_3 = 12,
40         GSHAREDVT_RET_IREGS_4 = 13,
41         GSHAREDVT_RET_IREGS_5 = 14,
42         GSHAREDVT_RET_IREGS_6 = 15,
43         GSHAREDVT_RET_IREGS_7 = 16,
44         GSHAREDVT_RET_IREGS_8 = 17,
45         GSHAREDVT_RET_HFAR8_1 = 18,
46         GSHAREDVT_RET_HFAR8_2 = 19,
47         GSHAREDVT_RET_HFAR8_3 = 20,
48         GSHAREDVT_RET_HFAR8_4 = 21,
49         GSHAREDVT_RET_HFAR4_1 = 22,
50         GSHAREDVT_RET_HFAR4_2 = 23,
51         GSHAREDVT_RET_HFAR4_3 = 24,
52         GSHAREDVT_RET_HFAR4_4 = 25,
53         GSHAREDVT_RET_NUM = 26
54 } GSharedVtRetMarshal;
55
56 typedef struct {
57         /* Method address to call */
58         gpointer addr;
59         /* The trampoline reads this, so keep the size explicit */
60         int ret_marshal;
61         /* If ret_marshal != NONE, this is the reg of the vret arg, else -1 */
62         /* Equivalent of vret_arg_slot in x86 implementation. */
63         int vret_arg_reg;
64         /* The stack slot where the return value will be stored */
65         int vret_slot;
66         int stack_usage, map_count;
67         /* If not -1, then make a virtual call using this vtable offset */
68         int vcall_offset;
69         /* If 1, make an indirect call to the address in the rgctx reg */
70         int calli;
71         /* Whenever this is a in or an out call */
72         int gsharedvt_in;
73         /* Maps stack slots/registers in the caller to the stack slots/registers in the callee */
74         int map [MONO_ZERO_LEN_ARRAY];
75 } GSharedVtCallInfo;
76
77 /* Number of argument registers (r0..r8) */
78 #define NUM_GSHAREDVT_ARG_GREGS 9
79 #define NUM_GSHAREDVT_ARG_FREGS 8
80
81 gpointer
82 mono_arm_start_gsharedvt_call (GSharedVtCallInfo *info, gpointer *caller, gpointer *callee, gpointer mrgctx_reg);
83
84 #endif /* __MINI_ARM64_GSHAREDVT_H__ */