MacOS X for Intel host support
PATCH 1/1 MacOS X for Intel host support
Hi,
I am not fully satisfied with those patches though. The dyngen-exec.h & exec-all.h bits should be improved and depend on gcc4 patches.
TODO:
- try test-i386
- use 80-bit long doubles?
target-i386/exec.h renamed from target-i386/exec.h.osx-intel-port +0 -6
@@ -457,8 +457,6 @@ static inline void helper_fstt(CPU86_LDo#define FPUC_EM 0x3f -extern const CPU86_LDouble f15rk[7 ]; -void helper_fldt_ST0_A0 (void );void helper_fstt_ST0_A0 (void );void fpu_raise_exception (void );
@@ -492,10 +490,6 @@ float approx_rsqrt(float a);float approx_rcp (float a);void update_fp_status (void ); -extern const uint8_t parity_table[256 ]; -extern const uint8_t rclw_table[32 ]; -extern const uint8_t rclb_table[32 ]; -static inline uint32_t compute_eflags (void ) {return env->eflags | cc_table[CC_OP ].compute_all () | (DF &DF_MASK );
target-i386/op.c renamed from target-i386/op.c.osx-intel-port +13 -0
@@ -21,6 +21,19 @@#define ASM_SOFTMMU #include "exec.h" +#if defined(__APPLE__) +/* XXX avoid indirect symbols, correct address patched at code generation time. */ +static const uint8_t parity_table[256 ]; +static const uint8_t rclw_table[32 ]; +static const uint8_t rclb_table[32 ]; +static const CPU86_LDouble f15rk[7 ]; +#else +extern const uint8_t parity_table[256 ]; +extern const uint8_t rclw_table[32 ]; +extern const uint8_t rclb_table[32 ]; +extern const CPU86_LDouble f15rk[7 ]; +#endif +/* n must be a constant to be efficient */ static inline target_long lshift (target_long x,int n) {
Makefile.target renamed from Makefile.target.osx-intel-port +3 -1
@@ -18,6 +18,9 @@ VPATH+=:$(SRC_PATH)/linux-user DEFINES+=-I$(SRC_PATH)/linux-user -I$(SRC_PATH)/linux-user/$(TARGET_ARCH) endif CFLAGS=-Wall -O2 -g -fno-strict-aliasing +ifeq ($(CONFIG_DARWIN),yes) +CFLAGS+=-mdynamic-no-pic +endif #CFLAGS+=-Werror LDFLAGS=-g LIBS=
@@ -156,7 +159,6 @@ OP_CFLAGS+=-fno-reorder-blocks -fno-opti endif ifeq ($(CONFIG_DARWIN),yes) -OP_CFLAGS+= -mdynamic-no-pic LIBS+=-lmx endif
dyngen.c renamed from dyngen.c.osx-intel-port +131 -13
200 lines not on this page · raw message
dyngen-exec.h renamed from dyngen-exec.h.osx-intel-port +7 -0
@@ -215,9 +215,16 @@ extern int __op_jmp0, __op_jmp1, __op_jm#define EXIT_TB () asm volatile ("hlt")/* Dyngen will replace cli with 0x9e (jmp). We generate the offset manually. */ +#if defined(__APPLE__) +/* XXX Different relocations are generated for MacOS X for Intel +(please as from cctools). */ +#define GOTO_LABEL_PARAM (n) \ + asm volatile ("cli;.long " ASM_NAME(__op_gen_label) #n) +#else #define GOTO_LABEL_PARAM (n) \ asm volatile ("cli;.long " ASM_NAME(__op_gen_label) #n " - 1f;1:")#endif +#endif #ifdef __x86_64__/* The same as i386. */ #define EXIT_TB () asm volatile ("hlt")
exec-all.h renamed from exec-all.h.osx-intel-port +15 -1
@@ -321,15 +321,29 @@ do {\/* we patch the jump instruction directly. Use sti in place of the actual jmp instruction so that dyngen can patch in the correct result. */ +#if defined(__APPLE__) +/* XXX Different relocations are generated for MacOS X for Intel +(please as from cctools). */ #define GOTO_TB (opname, tbparam, n)\ do {\ - asm volatile (".section .data\n"\ + asm volatile (ASM_DATA_SECTION\ + ASM_OP_LABEL_NAME(n, opname) ":\n"\ + ".long 1f\n"\ + ASM_PREVIOUS_SECTION \ + "sti;.long " ASM_NAME(__op_jmp) #n "\n"\ + "1:\n");\ +} while (0) +#else +#define GOTO_TB (opname, tbparam, n)\ +do {\ + asm volatile (ASM_DATA_SECTION\ ASM_OP_LABEL_NAME(n, opname) ":\n"\ ".long 1f\n"\ ASM_PREVIOUS_SECTION \ "sti;.long " ASM_NAME(__op_jmp) #n " - 1f\n"\ "1:\n");\ } while (0) +#endif #else