4 This is a parameterized header. It's supposed/ok to be included multiple times.
6 Input defines: (those to be defined by the includer file)
9 DECL_OFFSET(struct,field)
10 DECL_OFFSET2(struct,field,offset)
11 DECL_ALIGN2(name,alignment)
14 USE_CROSS_COMPILE_OFFSETS - if defined, force the cross compiler offsets to be used, otherwise
15 they will only be used if MONO_CROSS_COMPILE is defined
16 DISABLE_METADATA_OFFSETS - Disable the definition of offsets for structures defined in metadata/.
17 DISABLE_JIT_OFFSETS - Disable the definition of offsets for structures defined in mini/.
19 The last two are needed because metadata shouldn't include JIT offsets since the structures
20 are not defined, while the JIT shouldn't include metadata offsets, since some of them
21 are GC specific, and the JIT needs to remain GC agnostic.
25 HAS_CROSS_COMPILER_OFFSETS - if set, it means we found some cross offsets, it doesnt mean we'll use it.
26 USED_CROSS_COMPILER_OFFSETS - if set, it means we used the cross offsets
28 Environment defines (from config.h and CFLAGS):
30 MONO_GENERATING_OFFSETS - Set by an offsets generating tool to disable the usage of any (possibly non-existing) generated header.
31 MONO_OFFSETS_FILE - Name of the header file containing the offsets to be used.
36 #undef HAS_CROSS_COMPILER_OFFSETS
37 #undef USED_CROSS_COMPILER_OFFSETS
39 #if !defined (MONO_GENERATING_OFFSETS) && defined (MONO_OFFSETS_FILE)
40 #include MONO_OFFSETS_FILE
43 #ifndef USED_CROSS_COMPILER_OFFSETS
53 // Offsets for structures defined in metadata/
54 #ifndef DISABLE_METADATA_OFFSETS
55 DECL_OFFSET(MonoObject
, vtable
)
56 DECL_OFFSET(MonoObject
, synchronisation
)
58 DECL_OFFSET(MonoClass
, interface_bitmap
)
59 DECL_OFFSET(MonoClass
, _byval_arg
)
60 DECL_OFFSET(MonoClass
, cast_class
)
61 DECL_OFFSET(MonoClass
, element_class
)
62 DECL_OFFSET(MonoClass
, idepth
)
63 DECL_OFFSET(MonoClass
, instance_size
)
64 DECL_OFFSET(MonoClass
, interface_id
)
65 DECL_OFFSET(MonoClass
, max_interface_id
)
66 DECL_OFFSET(MonoClass
, parent
)
67 DECL_OFFSET(MonoClass
, rank
)
68 DECL_OFFSET(MonoClass
, sizes
)
69 DECL_OFFSET(MonoClass
, supertypes
)
71 DECL_OFFSET(MonoVTable
, klass
)
72 DECL_OFFSET(MonoVTable
, max_interface_id
)
73 DECL_OFFSET(MonoVTable
, interface_bitmap
)
74 DECL_OFFSET(MonoVTable
, vtable
)
75 DECL_OFFSET(MonoVTable
, rank
)
76 DECL_OFFSET(MonoVTable
, initialized
)
77 DECL_OFFSET(MonoVTable
, type
)
78 DECL_OFFSET(MonoVTable
, runtime_generic_context
)
80 DECL_OFFSET(MonoDomain
, stack_overflow_ex
)
82 DECL_OFFSET(MonoDelegate
, target
)
83 DECL_OFFSET(MonoDelegate
, method_ptr
)
84 DECL_OFFSET(MonoDelegate
, invoke_impl
)
85 DECL_OFFSET(MonoDelegate
, method
)
86 DECL_OFFSET(MonoDelegate
, method_code
)
87 DECL_OFFSET(MonoDelegate
, method_is_virtual
)
88 DECL_OFFSET(MonoDelegate
, extra_arg
)
90 DECL_OFFSET(MonoInternalThread
, tid
)
91 DECL_OFFSET(MonoInternalThread
, small_id
)
92 DECL_OFFSET(MonoInternalThread
, static_data
)
93 DECL_OFFSET(MonoInternalThread
, last
)
95 DECL_OFFSET(MonoMulticastDelegate
, delegates
)
97 DECL_OFFSET(MonoTransparentProxy
, rp
)
98 DECL_OFFSET(MonoTransparentProxy
, remote_class
)
99 DECL_OFFSET(MonoTransparentProxy
, custom_type_info
)
101 DECL_OFFSET(MonoRealProxy
, target_domain_id
)
102 DECL_OFFSET(MonoRealProxy
, context
)
103 DECL_OFFSET(MonoRealProxy
, unwrapped_server
)
105 DECL_OFFSET(MonoRemoteClass
, proxy_class
)
107 DECL_OFFSET(MonoArray
, vector
)
108 DECL_OFFSET(MonoArray
, max_length
)
109 DECL_OFFSET(MonoArray
, bounds
)
111 DECL_OFFSET(MonoArrayBounds
, lower_bound
)
112 DECL_OFFSET(MonoArrayBounds
, length
)
114 DECL_OFFSET(MonoSafeHandle
, handle
)
116 DECL_OFFSET(MonoHandleRef
, handle
)
118 DECL_OFFSET(MonoComInteropProxy
, com_object
)
120 DECL_OFFSET(MonoString
, length
)
121 DECL_OFFSET(MonoString
, chars
)
123 DECL_OFFSET(MonoException
, message
)
125 DECL_OFFSET(MonoTypedRef
, type
)
126 DECL_OFFSET(MonoTypedRef
, klass
)
127 DECL_OFFSET(MonoTypedRef
, value
)
130 DECL_OFFSET(MonoThreadsSync
, status
)
131 DECL_OFFSET(MonoThreadsSync
, nest
)
133 DECL_OFFSET(MonoProfilerCallContext
, method
)
134 DECL_OFFSET(MonoProfilerCallContext
, return_value
)
135 DECL_OFFSET(MonoProfilerCallContext
, args
)
138 DECL_OFFSET(SgenClientThreadInfo
, in_critical_region
)
139 DECL_OFFSET(SgenThreadInfo
, tlab_next
)
140 DECL_OFFSET(SgenThreadInfo
, tlab_temp_end
)
143 #endif //DISABLE METADATA OFFSETS
145 // Offsets for structures defined in mini/
146 #ifndef DISABLE_JIT_OFFSETS
147 DECL_SIZE(MonoMethodRuntimeGenericContext
)
149 DECL_SIZE(MonoTypedRef
)
150 DECL_SIZE(CallContext
)
151 DECL_SIZE(MonoContext
)
153 DECL_OFFSET(MonoLMF
, previous_lmf
)
155 DECL_OFFSET(MonoMethodRuntimeGenericContext
, class_vtable
)
157 DECL_OFFSET(MonoJitTlsData
, lmf
)
158 DECL_OFFSET(MonoJitTlsData
, class_cast_from
)
159 DECL_OFFSET(MonoJitTlsData
, class_cast_to
)
161 DECL_OFFSET(MonoGSharedVtMethodRuntimeInfo
, locals_size
)
162 DECL_OFFSET(MonoGSharedVtMethodRuntimeInfo
, entries
) //XXX more to fix here
164 DECL_OFFSET(MonoContinuation
, stack_used_size
)
165 DECL_OFFSET(MonoContinuation
, saved_stack
)
166 DECL_OFFSET(MonoContinuation
, return_sp
)
167 DECL_OFFSET(MonoContinuation
, lmf
)
168 DECL_OFFSET(MonoContinuation
, return_ip
)
170 DECL_OFFSET(MonoDelegateTrampInfo
, method
)
171 DECL_OFFSET(MonoDelegateTrampInfo
, invoke_impl
)
172 DECL_OFFSET(MonoDelegateTrampInfo
, method_ptr
)
174 // Architecture-specific offsets
175 // -----------------------------
177 #if defined(TARGET_WASM)
178 DECL_OFFSET(MonoContext
, wasm_ip
)
179 DECL_OFFSET(MonoContext
, wasm_bp
)
180 DECL_OFFSET(MonoContext
, wasm_sp
)
181 DECL_OFFSET(MonoContext
, llvm_exc_reg
)
183 DECL_OFFSET(MonoLMF
, lmf_addr
)
185 #elif defined(TARGET_X86)
186 DECL_OFFSET(MonoContext
, eax
)
187 DECL_OFFSET(MonoContext
, ebx
)
188 DECL_OFFSET(MonoContext
, ecx
)
189 DECL_OFFSET(MonoContext
, edx
)
190 DECL_OFFSET(MonoContext
, edi
)
191 DECL_OFFSET(MonoContext
, esi
)
192 DECL_OFFSET(MonoContext
, esp
)
193 DECL_OFFSET(MonoContext
, ebp
)
194 DECL_OFFSET(MonoContext
, eip
)
196 DECL_OFFSET(MonoLMF
, method
)
197 DECL_OFFSET(MonoLMF
, lmf_addr
)
198 DECL_OFFSET(MonoLMF
, esp
)
199 DECL_OFFSET(MonoLMF
, ebx
)
200 DECL_OFFSET(MonoLMF
, edi
)
201 DECL_OFFSET(MonoLMF
, esi
)
202 DECL_OFFSET(MonoLMF
, ebp
)
203 DECL_OFFSET(MonoLMF
, eip
)
204 #elif defined(TARGET_AMD64)
205 DECL_OFFSET(MonoContext
, gregs
)
206 DECL_OFFSET(MonoContext
, fregs
)
208 DECL_OFFSET(MonoLMF
, rsp
)
209 DECL_OFFSET(MonoLMF
, rbp
)
211 DECL_OFFSET(DynCallArgs
, res
)
213 DECL_OFFSET(MonoLMFTramp
, ctx
)
214 DECL_OFFSET(MonoLMFTramp
, lmf_addr
)
215 #elif defined(TARGET_ARM)
216 DECL_OFFSET(MonoLMF
, sp
)
217 DECL_OFFSET(MonoLMF
, fp
)
218 DECL_OFFSET(MonoLMF
, ip
)
219 DECL_OFFSET(MonoLMF
, iregs
)
220 DECL_OFFSET(MonoLMF
, fregs
)
221 DECL_OFFSET(DynCallArgs
, fpregs
)
222 DECL_OFFSET(DynCallArgs
, has_fpregs
)
223 DECL_OFFSET(DynCallArgs
, regs
)
224 DECL_OFFSET(DynCallArgs
, n_stackargs
)
225 DECL_OFFSET(SeqPointInfo
, ss_tramp_addr
)
226 #elif defined(TARGET_ARM64)
227 DECL_OFFSET(MonoLMF
, pc
)
228 DECL_OFFSET(MonoLMF
, gregs
)
229 DECL_OFFSET(DynCallArgs
, regs
)
230 DECL_OFFSET(DynCallArgs
, fpregs
)
231 DECL_OFFSET(DynCallArgs
, n_stackargs
)
232 DECL_OFFSET(DynCallArgs
, n_fpargs
)
233 DECL_OFFSET(DynCallArgs
, n_fpret
)
236 // Shared architecture offfsets
237 // ----------------------------
239 #if defined(TARGET_ARM) || defined(TARGET_ARM64)
240 DECL_OFFSET (MonoContext
, pc
)
241 DECL_OFFSET (MonoContext
, regs
)
242 DECL_OFFSET (MonoContext
, fregs
)
244 DECL_OFFSET(MonoLMF
, lmf_addr
)
246 DECL_OFFSET(SeqPointInfo
, ss_trigger_page
)
248 DECL_OFFSET(DynCallArgs
, res
)
249 DECL_OFFSET(DynCallArgs
, res2
)
252 #if defined(TARGET_ARM)
253 DECL_OFFSET(MonoLMF
, method
)
254 DECL_OFFSET(GSharedVtCallInfo
, stack_usage
)
255 DECL_OFFSET(GSharedVtCallInfo
, vret_arg_reg
)
256 DECL_OFFSET(GSharedVtCallInfo
, ret_marshal
)
257 DECL_OFFSET(GSharedVtCallInfo
, vret_slot
)
258 DECL_OFFSET(GSharedVtCallInfo
, gsharedvt_in
)
261 #if defined(TARGET_ARM64)
262 DECL_OFFSET (MonoContext
, has_fregs
)
264 DECL_OFFSET(GSharedVtCallInfo
, stack_usage
)
265 DECL_OFFSET(GSharedVtCallInfo
, gsharedvt_in
)
266 DECL_OFFSET(GSharedVtCallInfo
, ret_marshal
)
267 DECL_OFFSET(GSharedVtCallInfo
, vret_slot
)
270 #if defined(TARGET_AMD64) || defined(TARGET_ARM64)
271 DECL_OFFSET(SeqPointInfo
, ss_tramp_addr
)
274 #if defined(TARGET_AMD64) || defined(TARGET_ARM) || defined(TARGET_ARM64)
275 DECL_OFFSET(SeqPointInfo
, bp_addrs
)
278 #if defined(TARGET_AMD64) || defined(TARGET_ARM) || defined(TARGET_ARM64)
279 DECL_OFFSET(CallContext
, gregs
)
280 DECL_OFFSET(CallContext
, fregs
)
281 DECL_OFFSET(CallContext
, stack_size
)
282 DECL_OFFSET(CallContext
, stack
)
285 #if defined(TARGET_X86)
286 DECL_OFFSET(GSharedVtCallInfo
, stack_usage
)
287 DECL_OFFSET(GSharedVtCallInfo
, vret_slot
)
288 DECL_OFFSET(GSharedVtCallInfo
, vret_arg_slot
)
289 DECL_OFFSET(GSharedVtCallInfo
, ret_marshal
)
290 DECL_OFFSET(GSharedVtCallInfo
, gsharedvt_in
)
293 DECL_OFFSET(MonoFtnDesc
, arg
)
294 DECL_OFFSET(MonoFtnDesc
, addr
)
296 #endif //DISABLE_JIT_OFFSETS
298 #endif //USED_CROSS_COMPILER_OFFSETS
305 #undef USE_CROSS_COMPILE_OFFSETS