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)
12 DECL_ALIGN2(name,alignment)
15 USE_CROSS_COMPILE_OFFSETS - if defined, force the cross compiler offsets to be used, otherwise
16 they will only be used if MONO_CROSS_COMPILE is defined
17 DISABLE_METADATA_OFFSETS - Disable the definition of offsets for structures defined in metadata/.
18 DISABLE_JIT_OFFSETS - Disable the definition of offsets for structures defined in mini/.
20 The last two are needed because metadata shouldn't include JIT offsets since the structures
21 are not defined, while the JIT shouldn't include metadata offsets, since some of them
22 are GC specific, and the JIT needs to remain GC agnostic.
26 HAS_CROSS_COMPILER_OFFSETS - if set, it means we found some cross offsets, it doesnt mean we'll use it.
27 USED_CROSS_COMPILER_OFFSETS - if set, it means we used the cross offsets
29 Environment defines (from config.h and CFLAGS):
31 MONO_GENERATING_OFFSETS - Set by an offsets generating tool to disable the usage of any (possibly non-existing) generated header.
32 MONO_OFFSETS_FILE - Name of the header file containing the offsets to be used.
37 #undef HAS_CROSS_COMPILER_OFFSETS
38 #undef USED_CROSS_COMPILER_OFFSETS
40 #if !defined (MONO_GENERATING_OFFSETS) && defined (MONO_OFFSETS_FILE)
41 #include MONO_OFFSETS_FILE
44 #ifndef USED_CROSS_COMPILER_OFFSETS
62 // Offsets for structures defined in metadata/
63 #ifndef DISABLE_METADATA_OFFSETS
64 DECL_OFFSET(MonoObject, vtable)
65 DECL_OFFSET(MonoObject, synchronisation)
67 DECL_OFFSET(MonoObjectHandlePayload, __raw)
69 DECL_OFFSET(MonoClass, interface_bitmap)
70 DECL_OFFSET(MonoClass, byval_arg)
71 DECL_OFFSET(MonoClass, cast_class)
72 DECL_OFFSET(MonoClass, element_class)
73 DECL_OFFSET(MonoClass, idepth)
74 DECL_OFFSET(MonoClass, instance_size)
75 DECL_OFFSET(MonoClass, interface_id)
76 DECL_OFFSET(MonoClass, max_interface_id)
77 DECL_OFFSET(MonoClass, parent)
78 DECL_OFFSET(MonoClass, rank)
79 DECL_OFFSET(MonoClass, sizes)
80 DECL_OFFSET(MonoClass, supertypes)
82 DECL_OFFSET(MonoVTable, klass)
83 DECL_OFFSET(MonoVTable, max_interface_id)
84 DECL_OFFSET(MonoVTable, interface_bitmap)
85 DECL_OFFSET(MonoVTable, vtable)
86 DECL_OFFSET(MonoVTable, rank)
87 DECL_OFFSET(MonoVTable, initialized)
88 DECL_OFFSET(MonoVTable, type)
89 DECL_OFFSET(MonoVTable, runtime_generic_context)
91 DECL_OFFSET(MonoDomain, stack_overflow_ex)
93 DECL_OFFSET(MonoDelegate, target)
94 DECL_OFFSET(MonoDelegate, method_ptr)
95 DECL_OFFSET(MonoDelegate, invoke_impl)
96 DECL_OFFSET(MonoDelegate, method)
97 DECL_OFFSET(MonoDelegate, method_code)
98 DECL_OFFSET(MonoDelegate, method_is_virtual)
99 DECL_OFFSET(MonoDelegate, extra_arg)
101 DECL_OFFSET(MonoInternalThread, tid)
102 DECL_OFFSET(MonoInternalThread, small_id)
103 DECL_OFFSET(MonoInternalThread, static_data)
104 DECL_OFFSET(MonoInternalThread, last)
106 DECL_OFFSET(MonoMulticastDelegate, delegates)
108 DECL_OFFSET(MonoTransparentProxy, rp)
109 DECL_OFFSET(MonoTransparentProxy, remote_class)
110 DECL_OFFSET(MonoTransparentProxy, custom_type_info)
112 DECL_OFFSET(MonoRealProxy, target_domain_id)
113 DECL_OFFSET(MonoRealProxy, context)
114 DECL_OFFSET(MonoRealProxy, unwrapped_server)
116 DECL_OFFSET(MonoRemoteClass, proxy_class)
118 DECL_OFFSET(MonoArray, vector)
119 DECL_OFFSET(MonoArray, max_length)
120 DECL_OFFSET(MonoArray, bounds)
122 DECL_OFFSET(MonoArrayBounds, lower_bound)
123 DECL_OFFSET(MonoArrayBounds, length)
125 DECL_OFFSET(MonoSafeHandle, handle)
127 DECL_OFFSET(MonoHandleRef, handle)
129 DECL_OFFSET(MonoComInteropProxy, com_object)
131 DECL_OFFSET(MonoString, length)
132 DECL_OFFSET(MonoString, chars)
134 DECL_OFFSET(MonoException, message)
136 DECL_OFFSET(MonoTypedRef, type)
137 DECL_OFFSET(MonoTypedRef, klass)
138 DECL_OFFSET(MonoTypedRef, value)
141 DECL_OFFSET(MonoThreadsSync, status)
142 DECL_OFFSET(MonoThreadsSync, nest)
145 DECL_OFFSET(SgenClientThreadInfo, in_critical_region)
146 DECL_OFFSET(SgenThreadInfo, tlab_next)
147 DECL_OFFSET(SgenThreadInfo, tlab_temp_end)
150 #endif //DISABLE METADATA OFFSETS
152 // Offsets for structures defined in mini/
153 #ifndef DISABLE_JIT_OFFSETS
154 DECL_OFFSET(MonoLMF, previous_lmf)
156 DECL_OFFSET(MonoMethodRuntimeGenericContext, class_vtable)
158 DECL_OFFSET(MonoJitTlsData, lmf)
159 DECL_OFFSET(MonoJitTlsData, class_cast_from)
160 DECL_OFFSET(MonoJitTlsData, class_cast_to)
161 DECL_OFFSET(MonoJitTlsData, handler_block_return_address)
162 DECL_OFFSET(MonoJitTlsData, restore_stack_prot)
164 DECL_OFFSET(MonoGSharedVtMethodRuntimeInfo, locals_size)
165 DECL_OFFSET(MonoGSharedVtMethodRuntimeInfo, entries) //XXX more to fix here
167 DECL_OFFSET(MonoContinuation, stack_used_size)
168 DECL_OFFSET(MonoContinuation, saved_stack)
169 DECL_OFFSET(MonoContinuation, return_sp)
170 DECL_OFFSET(MonoContinuation, lmf)
171 DECL_OFFSET(MonoContinuation, return_ip)
173 DECL_OFFSET(MonoDelegateTrampInfo, invoke_impl)
174 DECL_OFFSET(MonoDelegateTrampInfo, method_ptr)
176 // Architecture-specific offsets
177 // -----------------------------
179 #if defined(TARGET_X86)
180 DECL_OFFSET(MonoContext, eax)
181 DECL_OFFSET(MonoContext, ebx)
182 DECL_OFFSET(MonoContext, ecx)
183 DECL_OFFSET(MonoContext, edx)
184 DECL_OFFSET(MonoContext, edi)
185 DECL_OFFSET(MonoContext, esi)
186 DECL_OFFSET(MonoContext, esp)
187 DECL_OFFSET(MonoContext, ebp)
188 DECL_OFFSET(MonoContext, eip)
190 DECL_OFFSET(MonoLMF, method)
191 DECL_OFFSET(MonoLMF, lmf_addr)
192 DECL_OFFSET(MonoLMF, esp)
193 DECL_OFFSET(MonoLMF, ebx)
194 DECL_OFFSET(MonoLMF, edi)
195 DECL_OFFSET(MonoLMF, esi)
196 DECL_OFFSET(MonoLMF, ebp)
197 DECL_OFFSET(MonoLMF, eip)
198 #elif defined(TARGET_AMD64)
199 DECL_OFFSET(MonoContext, gregs)
200 DECL_OFFSET(MonoContext, fregs)
202 DECL_OFFSET(MonoLMF, rsp)
203 DECL_OFFSET(MonoLMF, rbp)
204 DECL_OFFSET(MonoLMF, rip)
206 DECL_OFFSET(DynCallArgs, res)
208 DECL_OFFSET(MonoLMFTramp, ctx)
209 DECL_OFFSET(MonoLMFTramp, lmf_addr)
210 #elif defined(TARGET_ARM)
211 DECL_OFFSET(MonoLMF, sp)
212 DECL_OFFSET(MonoLMF, fp)
213 DECL_OFFSET(MonoLMF, ip)
214 DECL_OFFSET(MonoLMF, iregs)
215 DECL_OFFSET(MonoLMF, fregs)
216 DECL_OFFSET(DynCallArgs, fpregs)
217 DECL_OFFSET(DynCallArgs, has_fpregs)
218 DECL_OFFSET(SeqPointInfo, ss_tramp_addr)
219 #elif defined(TARGET_ARM64)
220 DECL_OFFSET(MonoLMF, pc)
221 DECL_OFFSET(MonoLMF, gregs)
222 DECL_OFFSET(DynCallArgs, regs)
223 DECL_OFFSET(DynCallArgs, fpregs)
224 DECL_OFFSET(DynCallArgs, n_fpargs)
225 DECL_OFFSET(DynCallArgs, n_fpret)
228 // Shared architecture offfsets
229 // ----------------------------
231 #if defined(TARGET_ARM) || defined(TARGET_ARM64)
232 DECL_OFFSET (MonoContext, pc)
233 DECL_OFFSET (MonoContext, regs)
234 DECL_OFFSET (MonoContext, fregs)
236 DECL_OFFSET(MonoLMF, lmf_addr)
238 DECL_OFFSET(SeqPointInfo, ss_trigger_page)
240 DECL_OFFSET(DynCallArgs, res)
241 DECL_OFFSET(DynCallArgs, res2)
244 #if defined(TARGET_ARM)
245 DECL_OFFSET(MonoLMF, method)
246 DECL_OFFSET(GSharedVtCallInfo, stack_usage)
247 DECL_OFFSET(GSharedVtCallInfo, vret_arg_reg)
248 DECL_OFFSET(GSharedVtCallInfo, ret_marshal)
249 DECL_OFFSET(GSharedVtCallInfo, vret_slot)
250 DECL_OFFSET(GSharedVtCallInfo, gsharedvt_in)
253 #if defined(TARGET_ARM64)
254 DECL_OFFSET (MonoContext, has_fregs)
256 DECL_OFFSET(GSharedVtCallInfo, stack_usage)
257 DECL_OFFSET(GSharedVtCallInfo, gsharedvt_in)
258 DECL_OFFSET(GSharedVtCallInfo, ret_marshal)
259 DECL_OFFSET(GSharedVtCallInfo, vret_slot)
262 #if defined(TARGET_AMD64) || defined(TARGET_ARM64)
263 DECL_OFFSET(SeqPointInfo, ss_tramp_addr)
266 #if defined(TARGET_AMD64) || defined(TARGET_ARM) || defined(TARGET_ARM64)
267 DECL_OFFSET(SeqPointInfo, bp_addrs)
270 #ifdef ENABLE_INTERPRETER
271 DECL_OFFSET(InterpMethodArguments, ilen)
272 DECL_OFFSET(InterpMethodArguments, iargs)
273 DECL_OFFSET(InterpMethodArguments, flen)
274 DECL_OFFSET(InterpMethodArguments, fargs)
275 DECL_OFFSET(InterpMethodArguments, retval)
276 DECL_OFFSET(InterpMethodArguments, is_float_ret)
279 #endif //DISABLE_JIT_OFFSETS
281 #endif //USED_CROSS_COMPILER_OFFSETS
289 #undef USE_CROSS_COMPILE_OFFSETS