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