Commit d549f7d98f2d4764064fff66926bcd01eb1b71a0
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,16 +303,29 @@ TranslationBlock *tb_find_pc(unsigned long pc_ptr); | ||
303 | #define offsetof(type, field) ((size_t) &((type *)0)->field) | 303 | #define offsetof(type, field) ((size_t) &((type *)0)->field) |
304 | #endif | 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 | #if defined(__powerpc__) | 319 | #if defined(__powerpc__) |
307 | 320 | ||
308 | /* we patch the jump instruction directly */ | 321 | /* we patch the jump instruction directly */ |
309 | #define JUMP_TB(opname, tbparam, n, eip)\ | 322 | #define JUMP_TB(opname, tbparam, n, eip)\ |
310 | do {\ | 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 | ".long 1f\n"\ | 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 | "1:\n");\ | 329 | "1:\n");\ |
317 | T0 = (long)(tbparam) + (n);\ | 330 | T0 = (long)(tbparam) + (n);\ |
318 | EIP = eip;\ | 331 | EIP = eip;\ |
@@ -321,25 +334,19 @@ do {\ | @@ -321,25 +334,19 @@ do {\ | ||
321 | 334 | ||
322 | #define JUMP_TB2(opname, tbparam, n)\ | 335 | #define JUMP_TB2(opname, tbparam, n)\ |
323 | do {\ | 336 | do {\ |
324 | - asm volatile ("b __op_jmp" #n "\n");\ | 337 | + asm volatile ("b " ASM_NAME(__op_jmp) #n "\n");\ |
325 | } while (0) | 338 | } while (0) |
326 | 339 | ||
327 | #elif defined(__i386__) && defined(USE_DIRECT_JUMP) | 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 | /* we patch the jump instruction directly */ | 342 | /* we patch the jump instruction directly */ |
336 | #define JUMP_TB(opname, tbparam, n, eip)\ | 343 | #define JUMP_TB(opname, tbparam, n, eip)\ |
337 | do {\ | 344 | do {\ |
338 | asm volatile (".section .data\n"\ | 345 | asm volatile (".section .data\n"\ |
339 | - "__op_label" #n "." stringify(opname) ":\n"\ | 346 | + ASM_NAME(__op_label) #n "." ASM_NAME(opname) ":\n"\ |
340 | ".long 1f\n"\ | 347 | ".long 1f\n"\ |
341 | ASM_PREVIOUS_SECTION \ | 348 | ASM_PREVIOUS_SECTION \ |
342 | - "jmp __op_jmp" #n "\n"\ | 349 | + "jmp " ASM_NAME(__op_jmp) #n "\n"\ |
343 | "1:\n");\ | 350 | "1:\n");\ |
344 | T0 = (long)(tbparam) + (n);\ | 351 | T0 = (long)(tbparam) + (n);\ |
345 | EIP = eip;\ | 352 | EIP = eip;\ |
@@ -348,7 +355,7 @@ do {\ | @@ -348,7 +355,7 @@ do {\ | ||
348 | 355 | ||
349 | #define JUMP_TB2(opname, tbparam, n)\ | 356 | #define JUMP_TB2(opname, tbparam, n)\ |
350 | do {\ | 357 | do {\ |
351 | - asm volatile ("jmp __op_jmp" #n "\n");\ | 358 | + asm volatile ("jmp " ASM_NAME(__op_jmp) #n "\n");\ |
352 | } while (0) | 359 | } while (0) |
353 | 360 | ||
354 | #else | 361 | #else |