diff options
author | bellard <bellard@c046a42c-6fe2-441c-8c8c-71466251a162> | 2004-07-05 21:47:44 +0000 |
---|---|---|
committer | bellard <bellard@c046a42c-6fe2-441c-8c8c-71466251a162> | 2004-07-05 21:47:44 +0000 |
commit | d549f7d98f2d4764064fff66926bcd01eb1b71a0 (patch) | |
tree | 57e4d8d1bf8cc11860f0da101b66035c9623dbaf | |
parent | 83fb7adf6c653a0285a89d51b746cb642d2859cf (diff) |
Darwin patch (initial patch by Pierre d'Herbemont)
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@981 c046a42c-6fe2-441c-8c8c-71466251a162
-rw-r--r-- | exec-all.h | 35 |
1 files changed, 21 insertions, 14 deletions
diff --git a/exec-all.h b/exec-all.h index 8167d1a271..65d26fdfb4 100644 --- a/exec-all.h +++ b/exec-all.h @@ -303,16 +303,29 @@ TranslationBlock *tb_find_pc(unsigned long pc_ptr); #define offsetof(type, field) ((size_t) &((type *)0)->field) #endif +#if defined(_WIN32) +#define ASM_DATA_SECTION ".section \".data\"\n" +#define ASM_PREVIOUS_SECTION ".section .text\n" +#elif defined(__APPLE__) +#define ASM_DATA_SECTION ".data\n" +#define ASM_PREVIOUS_SECTION ".text\n" +#define ASM_NAME(x) "_" #x +#else +#define ASM_DATA_SECTION ".section \".data\"\n" +#define ASM_PREVIOUS_SECTION ".previous\n" +#define ASM_NAME(x) stringify(x) +#endif + #if defined(__powerpc__) /* we patch the jump instruction directly */ #define JUMP_TB(opname, tbparam, n, eip)\ do {\ - asm volatile (".section \".data\"\n"\ - "__op_label" #n "." stringify(opname) ":\n"\ + asm volatile (ASM_DATA_SECTION\ + ASM_NAME(__op_label) #n "." ASM_NAME(opname) ":\n"\ ".long 1f\n"\ - ".previous\n"\ - "b __op_jmp" #n "\n"\ + ASM_PREVIOUS_SECTION \ + "b " ASM_NAME(__op_jmp) #n "\n"\ "1:\n");\ T0 = (long)(tbparam) + (n);\ EIP = eip;\ @@ -321,25 +334,19 @@ do {\ #define JUMP_TB2(opname, tbparam, n)\ do {\ - asm volatile ("b __op_jmp" #n "\n");\ + asm volatile ("b " ASM_NAME(__op_jmp) #n "\n");\ } while (0) #elif defined(__i386__) && defined(USE_DIRECT_JUMP) -#ifdef _WIN32 -#define ASM_PREVIOUS_SECTION ".section .text\n" -#else -#define ASM_PREVIOUS_SECTION ".previous\n" -#endif - /* we patch the jump instruction directly */ #define JUMP_TB(opname, tbparam, n, eip)\ do {\ asm volatile (".section .data\n"\ - "__op_label" #n "." stringify(opname) ":\n"\ + ASM_NAME(__op_label) #n "." ASM_NAME(opname) ":\n"\ ".long 1f\n"\ ASM_PREVIOUS_SECTION \ - "jmp __op_jmp" #n "\n"\ + "jmp " ASM_NAME(__op_jmp) #n "\n"\ "1:\n");\ T0 = (long)(tbparam) + (n);\ EIP = eip;\ @@ -348,7 +355,7 @@ do {\ #define JUMP_TB2(opname, tbparam, n)\ do {\ - asm volatile ("jmp __op_jmp" #n "\n");\ + asm volatile ("jmp " ASM_NAME(__op_jmp) #n "\n");\ } while (0) #else |