Commit d549f7d98f2d4764064fff66926bcd01eb1b71a0

Authored by bellard
1 parent 83fb7adf

Darwin patch (initial patch by Pierre d'Herbemont)


git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@981 c046a42c-6fe2-441c-8c8c-71466251a162
Showing 1 changed file with 21 additions and 14 deletions
exec-all.h
... ... @@ -303,16 +303,29 @@ TranslationBlock *tb_find_pc(unsigned long pc_ptr);
303 303 #define offsetof(type, field) ((size_t) &((type *)0)->field)
304 304 #endif
305 305  
  306 +#if defined(_WIN32)
  307 +#define ASM_DATA_SECTION ".section \".data\"\n"
  308 +#define ASM_PREVIOUS_SECTION ".section .text\n"
  309 +#elif defined(__APPLE__)
  310 +#define ASM_DATA_SECTION ".data\n"
  311 +#define ASM_PREVIOUS_SECTION ".text\n"
  312 +#define ASM_NAME(x) "_" #x
  313 +#else
  314 +#define ASM_DATA_SECTION ".section \".data\"\n"
  315 +#define ASM_PREVIOUS_SECTION ".previous\n"
  316 +#define ASM_NAME(x) stringify(x)
  317 +#endif
  318 +
306 319 #if defined(__powerpc__)
307 320  
308 321 /* we patch the jump instruction directly */
309 322 #define JUMP_TB(opname, tbparam, n, eip)\
310 323 do {\
311   - asm volatile (".section \".data\"\n"\
312   - "__op_label" #n "." stringify(opname) ":\n"\
  324 + asm volatile (ASM_DATA_SECTION\
  325 + ASM_NAME(__op_label) #n "." ASM_NAME(opname) ":\n"\
313 326 ".long 1f\n"\
314   - ".previous\n"\
315   - "b __op_jmp" #n "\n"\
  327 + ASM_PREVIOUS_SECTION \
  328 + "b " ASM_NAME(__op_jmp) #n "\n"\
316 329 "1:\n");\
317 330 T0 = (long)(tbparam) + (n);\
318 331 EIP = eip;\
... ... @@ -321,25 +334,19 @@ do {\
321 334  
322 335 #define JUMP_TB2(opname, tbparam, n)\
323 336 do {\
324   - asm volatile ("b __op_jmp" #n "\n");\
  337 + asm volatile ("b " ASM_NAME(__op_jmp) #n "\n");\
325 338 } while (0)
326 339  
327 340 #elif defined(__i386__) && defined(USE_DIRECT_JUMP)
328 341  
329   -#ifdef _WIN32
330   -#define ASM_PREVIOUS_SECTION ".section .text\n"
331   -#else
332   -#define ASM_PREVIOUS_SECTION ".previous\n"
333   -#endif
334   -
335 342 /* we patch the jump instruction directly */
336 343 #define JUMP_TB(opname, tbparam, n, eip)\
337 344 do {\
338 345 asm volatile (".section .data\n"\
339   - "__op_label" #n "." stringify(opname) ":\n"\
  346 + ASM_NAME(__op_label) #n "." ASM_NAME(opname) ":\n"\
340 347 ".long 1f\n"\
341 348 ASM_PREVIOUS_SECTION \
342   - "jmp __op_jmp" #n "\n"\
  349 + "jmp " ASM_NAME(__op_jmp) #n "\n"\
343 350 "1:\n");\
344 351 T0 = (long)(tbparam) + (n);\
345 352 EIP = eip;\
... ... @@ -348,7 +355,7 @@ do {\
348 355  
349 356 #define JUMP_TB2(opname, tbparam, n)\
350 357 do {\
351   - asm volatile ("jmp __op_jmp" #n "\n");\
  358 + asm volatile ("jmp " ASM_NAME(__op_jmp) #n "\n");\
352 359 } while (0)
353 360  
354 361 #else
... ...