1 2 /** 3 \file 4 This is a parameterized header. It's supposed/ok to be included multiple times. 5 6 Input defines: (those to be defined by the includer file) 7 8 Required: 9 DECL_OFFSET(struct,field) 10 DECL_OFFSET2(struct,field,offset) 11 DECL_ALIGN(name,type) 12 DECL_ALIGN2(name,alignment) 13 14 Optional: 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/. 19 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. 23 24 Output defines: 25 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 28 29 Environment defines (from config.h and CFLAGS): 30 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. 33 34 */ 35 36 37 #undef HAS_CROSS_COMPILER_OFFSETS 38 #undef USED_CROSS_COMPILER_OFFSETS 39 40 #if !defined (MONO_GENERATING_OFFSETS) && defined (MONO_OFFSETS_FILE) 41 #include MONO_OFFSETS_FILE 42 #endif 43 44 #ifndef USED_CROSS_COMPILER_OFFSETS 45 46 DECL_ALIGN(gint8) 47 DECL_ALIGN(gint16) 48 DECL_ALIGN(gint32) 49 DECL_ALIGN(gint64) 50 DECL_ALIGN(float) 51 DECL_ALIGN(double) 52 DECL_ALIGN(gpointer) 53 54 DECL_SIZE(gint8) 55 DECL_SIZE(gint16) 56 DECL_SIZE(gint32) 57 DECL_SIZE(gint64) 58 DECL_SIZE(float) 59 DECL_SIZE(double) 60 DECL_SIZE(gpointer) 61 62 // Offsets for structures defined in metadata/ 63 #ifndef DISABLE_METADATA_OFFSETS 64 DECL_OFFSET(MonoObject, vtable) 65 DECL_OFFSET(MonoObject, synchronisation) 66 67 DECL_OFFSET(MonoObjectHandlePayload, __raw) 68 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) 81 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) 90 91 DECL_OFFSET(MonoDomain, stack_overflow_ex) 92 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) 100 101 DECL_OFFSET(MonoInternalThread, tid) 102 DECL_OFFSET(MonoInternalThread, small_id) 103 DECL_OFFSET(MonoInternalThread, static_data) 104 DECL_OFFSET(MonoInternalThread, last) 105 106 DECL_OFFSET(MonoMulticastDelegate, delegates) 107 108 DECL_OFFSET(MonoTransparentProxy, rp) 109 DECL_OFFSET(MonoTransparentProxy, remote_class) 110 DECL_OFFSET(MonoTransparentProxy, custom_type_info) 111 112 DECL_OFFSET(MonoRealProxy, target_domain_id) 113 DECL_OFFSET(MonoRealProxy, context) 114 DECL_OFFSET(MonoRealProxy, unwrapped_server) 115 116 DECL_OFFSET(MonoRemoteClass, proxy_class) 117 118 DECL_OFFSET(MonoArray, vector) 119 DECL_OFFSET(MonoArray, max_length) 120 DECL_OFFSET(MonoArray, bounds) 121 122 DECL_OFFSET(MonoArrayBounds, lower_bound) 123 DECL_OFFSET(MonoArrayBounds, length) 124 125 DECL_OFFSET(MonoSafeHandle, handle) 126 127 DECL_OFFSET(MonoHandleRef, handle) 128 129 DECL_OFFSET(MonoComInteropProxy, com_object) 130 131 DECL_OFFSET(MonoString, length) 132 DECL_OFFSET(MonoString, chars) 133 134 DECL_OFFSET(MonoException, message) 135 136 DECL_OFFSET(MonoTypedRef, type) 137 DECL_OFFSET(MonoTypedRef, klass) 138 DECL_OFFSET(MonoTypedRef, value) 139 140 //Internal structs 141 DECL_OFFSET(MonoThreadsSync, status) 142 DECL_OFFSET(MonoThreadsSync, nest) 143 144 DECL_OFFSET(MonoProfilerCallContext, method) 145 DECL_OFFSET(MonoProfilerCallContext, return_value) 146 147 #ifdef HAVE_SGEN_GC 148 DECL_OFFSET(SgenClientThreadInfo, in_critical_region) 149 DECL_OFFSET(SgenThreadInfo, tlab_next) 150 DECL_OFFSET(SgenThreadInfo, tlab_temp_end) 151 #endif 152 153 #endif //DISABLE METADATA OFFSETS 154 155 // Offsets for structures defined in mini/ 156 #ifndef DISABLE_JIT_OFFSETS 157 DECL_OFFSET(MonoLMF, previous_lmf) 158 159 DECL_OFFSET(MonoMethodRuntimeGenericContext, class_vtable) 160 161 DECL_OFFSET(MonoJitTlsData, lmf) 162 DECL_OFFSET(MonoJitTlsData, class_cast_from) 163 DECL_OFFSET(MonoJitTlsData, class_cast_to) 164 DECL_OFFSET(MonoJitTlsData, restore_stack_prot) 165 166 DECL_OFFSET(MonoGSharedVtMethodRuntimeInfo, locals_size) 167 DECL_OFFSET(MonoGSharedVtMethodRuntimeInfo, entries) //XXX more to fix here 168 169 DECL_OFFSET(MonoContinuation, stack_used_size) 170 DECL_OFFSET(MonoContinuation, saved_stack) 171 DECL_OFFSET(MonoContinuation, return_sp) 172 DECL_OFFSET(MonoContinuation, lmf) 173 DECL_OFFSET(MonoContinuation, return_ip) 174 175 DECL_OFFSET(MonoDelegateTrampInfo, invoke_impl) 176 DECL_OFFSET(MonoDelegateTrampInfo, method_ptr) 177 178 // Architecture-specific offsets 179 // ----------------------------- 180 181 #if defined(TARGET_WASM) 182 DECL_OFFSET(MonoContext, wasm_ip) 183 DECL_OFFSET(MonoContext, wasm_bp) 184 DECL_OFFSET(MonoContext, wasm_sp) 185 DECL_OFFSET(MonoContext, llvm_exc_reg) 186 187 DECL_OFFSET(MonoLMF, method) 188 DECL_OFFSET(MonoLMF, lmf_addr) 189 190 #elif defined(TARGET_X86) 191 DECL_OFFSET(MonoContext, eax) 192 DECL_OFFSET(MonoContext, ebx) 193 DECL_OFFSET(MonoContext, ecx) 194 DECL_OFFSET(MonoContext, edx) 195 DECL_OFFSET(MonoContext, edi) 196 DECL_OFFSET(MonoContext, esi) 197 DECL_OFFSET(MonoContext, esp) 198 DECL_OFFSET(MonoContext, ebp) 199 DECL_OFFSET(MonoContext, eip) 200 201 DECL_OFFSET(MonoLMF, method) 202 DECL_OFFSET(MonoLMF, lmf_addr) 203 DECL_OFFSET(MonoLMF, esp) 204 DECL_OFFSET(MonoLMF, ebx) 205 DECL_OFFSET(MonoLMF, edi) 206 DECL_OFFSET(MonoLMF, esi) 207 DECL_OFFSET(MonoLMF, ebp) 208 DECL_OFFSET(MonoLMF, eip) 209 #elif defined(TARGET_AMD64) 210 DECL_OFFSET(MonoContext, gregs) 211 DECL_OFFSET(MonoContext, fregs) 212 213 DECL_OFFSET(MonoLMF, rsp) 214 DECL_OFFSET(MonoLMF, rbp) 215 216 DECL_OFFSET(DynCallArgs, res) 217 218 DECL_OFFSET(MonoLMFTramp, ctx) 219 DECL_OFFSET(MonoLMFTramp, lmf_addr) 220 #elif defined(TARGET_ARM) 221 DECL_OFFSET(MonoLMF, sp) 222 DECL_OFFSET(MonoLMF, fp) 223 DECL_OFFSET(MonoLMF, ip) 224 DECL_OFFSET(MonoLMF, iregs) 225 DECL_OFFSET(MonoLMF, fregs) 226 DECL_OFFSET(DynCallArgs, fpregs) 227 DECL_OFFSET(DynCallArgs, has_fpregs) 228 DECL_OFFSET(DynCallArgs, regs) 229 DECL_OFFSET(DynCallArgs, n_stackargs) 230 DECL_OFFSET(SeqPointInfo, ss_tramp_addr) 231 #elif defined(TARGET_ARM64) 232 DECL_OFFSET(MonoLMF, pc) 233 DECL_OFFSET(MonoLMF, gregs) 234 DECL_OFFSET(DynCallArgs, regs) 235 DECL_OFFSET(DynCallArgs, fpregs) 236 DECL_OFFSET(DynCallArgs, n_stackargs) 237 DECL_OFFSET(DynCallArgs, n_fpargs) 238 DECL_OFFSET(DynCallArgs, n_fpret) 239 #endif 240 241 // Shared architecture offfsets 242 // ---------------------------- 243 244 #if defined(TARGET_ARM) || defined(TARGET_ARM64) 245 DECL_OFFSET (MonoContext, pc) 246 DECL_OFFSET (MonoContext, regs) 247 DECL_OFFSET (MonoContext, fregs) 248 249 DECL_OFFSET(MonoLMF, lmf_addr) 250 251 DECL_OFFSET(SeqPointInfo, ss_trigger_page) 252 253 DECL_OFFSET(DynCallArgs, res) 254 DECL_OFFSET(DynCallArgs, res2) 255 #endif 256 257 #if defined(TARGET_ARM) 258 DECL_OFFSET(MonoLMF, method) 259 DECL_OFFSET(GSharedVtCallInfo, stack_usage) 260 DECL_OFFSET(GSharedVtCallInfo, vret_arg_reg) 261 DECL_OFFSET(GSharedVtCallInfo, ret_marshal) 262 DECL_OFFSET(GSharedVtCallInfo, vret_slot) 263 DECL_OFFSET(GSharedVtCallInfo, gsharedvt_in) 264 #endif 265 266 #if defined(TARGET_ARM64) 267 DECL_OFFSET (MonoContext, has_fregs) 268 269 DECL_OFFSET(GSharedVtCallInfo, stack_usage) 270 DECL_OFFSET(GSharedVtCallInfo, gsharedvt_in) 271 DECL_OFFSET(GSharedVtCallInfo, ret_marshal) 272 DECL_OFFSET(GSharedVtCallInfo, vret_slot) 273 #endif 274 275 #if defined(TARGET_AMD64) || defined(TARGET_ARM64) 276 DECL_OFFSET(SeqPointInfo, ss_tramp_addr) 277 #endif 278 279 #if defined(TARGET_AMD64) || defined(TARGET_ARM) || defined(TARGET_ARM64) 280 DECL_OFFSET(SeqPointInfo, bp_addrs) 281 #endif 282 283 #ifndef DISABLE_INTERPRETER 284 DECL_OFFSET(InterpMethodArguments, ilen) 285 DECL_OFFSET(InterpMethodArguments, iargs) 286 DECL_OFFSET(InterpMethodArguments, flen) 287 DECL_OFFSET(InterpMethodArguments, fargs) 288 DECL_OFFSET(InterpMethodArguments, retval) 289 DECL_OFFSET(InterpMethodArguments, is_float_ret) 290 #endif 291 292 #endif //DISABLE_JIT_OFFSETS 293 294 #endif //USED_CROSS_COMPILER_OFFSETS 295 296 #undef DECL_OFFSET 297 #undef DECL_OFFSET2 298 #undef DECL_ALIGN 299 #undef DECL_ALIGN2 300 #undef DECL_SIZE 301 #undef DECL_SIZE2 302 #undef USE_CROSS_COMPILE_OFFSETS 303