1 #ifndef __MONO_MINI_X86_H__
2 #define __MONO_MINI_X86_H__
4 #include <mono/arch/x86/x86-codegen.h>
7 /* use SIG* defines if possible */
12 /* sigcontext surrogate */
25 typedef void (* MonoW32ExceptionHandler) (int);
26 void win32_seh_init(void);
27 void win32_seh_cleanup(void);
28 void win32_seh_set_handler(int type, MonoW32ExceptionHandler handler);
42 LONG CALLBACK seh_handler(EXCEPTION_POINTERS* ep);
44 #endif /* PLATFORM_WIN32 */
46 #ifdef sun // Solaris x86
47 # undef SIGSEGV_ON_ALTSTACK
48 # define MONO_ARCH_USE_SIGACTION 1
50 unsigned short gs, __gsh;
51 unsigned short fs, __fsh;
52 unsigned short es, __esh;
53 unsigned short ds, __dsh;
65 unsigned short cs, __csh;
67 unsigned long esp_at_signal;
68 unsigned short ss, __ssh;
69 unsigned long fpstate[95];
70 unsigned long filler[5];
72 #endif // sun, Solaris x86
74 /* Enables OP_LSHL, OP_LSHL_IMM, OP_LSHR, OP_LSHR_IMM, OP_LSHR_UN, OP_LSHR_UN_IMM */
75 #define MONO_ARCH_NO_EMULATE_LONG_SHIFT_OPS
77 #define MONO_MAX_IREGS 8
78 #define MONO_MAX_FREGS 6
80 #define MONO_ARCH_FRAME_ALIGNMENT 4
82 /* fixme: align to 16byte instead of 32byte (we align to 32byte to get
83 * reproduceable results for benchmarks */
84 #define MONO_ARCH_CODE_ALIGNMENT 32
86 #define MONO_ARCH_BASEREG X86_EBP
87 #define MONO_ARCH_RETREG1 X86_EAX
88 #define MONO_ARCH_RETREG2 X86_EDX
90 #define MONO_ARCH_ENCODE_LREG(r1,r2) (r1 | (r2<<3))
92 #define inst_dreg_low dreg&7
93 #define inst_dreg_high dreg>>3
94 #define inst_sreg1_low sreg1&7
95 #define inst_sreg1_high sreg1>>3
96 #define inst_sreg2_low sreg2&7
97 #define inst_sreg2_high sreg2>>3
100 gpointer previous_lmf;
110 typedef struct MonoCompileArch {
113 #if defined(__FreeBSD__) || defined(__NetBSD__) || defined(__OpenBSD__)
114 # define SC_EAX sc_eax
115 # define SC_EBX sc_ebx
116 # define SC_ECX sc_ecx
117 # define SC_EDX sc_edx
118 # define SC_EBP sc_ebp
119 # define SC_EIP sc_eip
120 # define SC_ESP sc_esp
121 # define SC_EDI sc_edi
122 # define SC_ESI sc_esi
135 typedef struct sigcontext MonoContext;
137 #define MONO_CONTEXT_SET_IP(ctx,ip) do { (ctx)->SC_EIP = (long)(ip); } while (0);
138 #define MONO_CONTEXT_SET_BP(ctx,bp) do { (ctx)->SC_EBP = (long)(bp); } while (0);
139 #define MONO_CONTEXT_SET_SP(ctx,esp) do { (ctx)->SC_ESP = (long)(esp); } while (0);
141 #define MONO_CONTEXT_GET_IP(ctx) ((gpointer)((ctx)->SC_EIP))
142 #define MONO_CONTEXT_GET_BP(ctx) ((gpointer)((ctx)->SC_EBP))
143 #define MONO_CONTEXT_GET_SP(ctx) ((gpointer)((ctx)->SC_ESP))
145 #define MONO_INIT_CONTEXT_FROM_FUNC(ctx,start_func) do { \
146 mono_arch_flush_register_windows (); \
147 MONO_CONTEXT_SET_IP ((ctx), (start_func)); \
148 MONO_CONTEXT_SET_BP ((ctx), __builtin_frame_address (0)); \
151 #ifndef PLATFORM_WIN32
152 #ifdef HAVE_WORKING_SIGALTSTACK
153 #define MONO_ARCH_SIGSEGV_ON_ALTSTACK
154 /* NetBSD doesn't define SA_STACK */
156 #define SA_STACK SA_ONSTACK
162 #define MONO_ARCH_BIGMUL_INTRINS 1
163 #define MONO_ARCH_NEED_DIV_CHECK 1
164 #define MONO_ARCH_HAVE_IS_INT_OVERFLOW 1
165 #define MONO_ARCH_HAVE_INVALIDATE_METHOD 1
166 #define MONO_ARCH_HAVE_PIC_AOT 1
167 #define MONO_ARCH_NEED_GOT_VAR 1
168 #define MONO_ARCH_HAVE_THROW_CORLIB_EXCEPTION 1
169 #define MONO_ARCH_ENABLE_EMIT_STATE_OPT 1
170 #define MONO_ARCH_HAVE_OUT_OF_LINE_BBLOCKS 1
172 #endif /* __MONO_MINI_X86_H__ */