Revision 5d7ff5bb tcg/ppc64/tcg-target.c
b/tcg/ppc64/tcg-target.c | ||
---|---|---|
104 | 104 |
TCG_REG_R29, |
105 | 105 |
TCG_REG_R30, |
106 | 106 |
TCG_REG_R31, |
107 |
#ifdef __APPLE__ |
|
108 |
TCG_REG_R2, |
|
109 |
#endif |
|
107 | 110 |
TCG_REG_R3, |
108 | 111 |
TCG_REG_R4, |
109 | 112 |
TCG_REG_R5, |
... | ... | |
112 | 115 |
TCG_REG_R8, |
113 | 116 |
TCG_REG_R9, |
114 | 117 |
TCG_REG_R10, |
118 |
#ifndef __APPLE__ |
|
115 | 119 |
TCG_REG_R11, |
120 |
#endif |
|
116 | 121 |
TCG_REG_R12, |
117 | 122 |
TCG_REG_R24, |
118 | 123 |
TCG_REG_R25, |
... | ... | |
136 | 141 |
}; |
137 | 142 |
|
138 | 143 |
static const int tcg_target_callee_save_regs[] = { |
144 |
#ifdef __APPLE__ |
|
145 |
TCG_REG_R11, |
|
146 |
#endif |
|
139 | 147 |
TCG_REG_R14, |
140 | 148 |
TCG_REG_R15, |
141 | 149 |
TCG_REG_R16, |
... | ... | |
477 | 485 |
} |
478 | 486 |
} |
479 | 487 |
|
488 |
static void tcg_out_b (TCGContext *s, int mask, tcg_target_long target) |
|
489 |
{ |
|
490 |
tcg_target_long disp; |
|
491 |
|
|
492 |
disp = target - (tcg_target_long) s->code_ptr; |
|
493 |
if ((disp << 38) >> 38 == disp) |
|
494 |
tcg_out32 (s, B | (disp & 0x3fffffc) | mask); |
|
495 |
else { |
|
496 |
tcg_out_movi (s, TCG_TYPE_I64, 0, (tcg_target_long) target); |
|
497 |
tcg_out32 (s, MTSPR | RS (0) | CTR); |
|
498 |
tcg_out32 (s, BCCTR | BO_ALWAYS | mask); |
|
499 |
} |
|
500 |
} |
|
501 |
|
|
480 | 502 |
static void tcg_out_call (TCGContext *s, tcg_target_long arg, int const_arg) |
481 | 503 |
{ |
504 |
#ifdef __APPLE__ |
|
505 |
if (const_arg) { |
|
506 |
tcg_out_b (s, LK, arg); |
|
507 |
} |
|
508 |
else { |
|
509 |
tcg_out32 (s, MTSPR | RS (arg) | LR); |
|
510 |
tcg_out32 (s, BCLR | BO_ALWAYS | LK); |
|
511 |
} |
|
512 |
#else |
|
482 | 513 |
int reg; |
483 | 514 |
|
484 | 515 |
if (const_arg) { |
... | ... | |
492 | 523 |
tcg_out32 (s, LD | RT (11) | RA (reg) | 16); |
493 | 524 |
tcg_out32 (s, LD | RT (2) | RA (reg) | 8); |
494 | 525 |
tcg_out32 (s, BCCTR | BO_ALWAYS | LK); |
526 |
#endif |
|
495 | 527 |
} |
496 | 528 |
|
497 | 529 |
static void tcg_out_ldst (TCGContext *s, int ret, int addr, |
... | ... | |
516 | 548 |
} |
517 | 549 |
} |
518 | 550 |
|
519 |
static void tcg_out_b (TCGContext *s, int mask, tcg_target_long target) |
|
520 |
{ |
|
521 |
tcg_target_long disp; |
|
522 |
|
|
523 |
disp = target - (tcg_target_long) s->code_ptr; |
|
524 |
if ((disp << 38) >> 38 == disp) |
|
525 |
tcg_out32 (s, B | (disp & 0x3fffffc) | mask); |
|
526 |
else { |
|
527 |
tcg_out_movi (s, TCG_TYPE_I64, 0, (tcg_target_long) target); |
|
528 |
tcg_out32 (s, MTSPR | RS (0) | CTR); |
|
529 |
tcg_out32 (s, BCCTR | BO_ALWAYS | mask); |
|
530 |
} |
|
531 |
} |
|
532 |
|
|
533 | 551 |
#if defined (CONFIG_SOFTMMU) |
534 | 552 |
|
535 | 553 |
#include "../../softmmu_defs.h" |
... | ... | |
845 | 863 |
void tcg_target_qemu_prologue (TCGContext *s) |
846 | 864 |
{ |
847 | 865 |
int i, frame_size; |
866 |
#ifndef __APPLE__ |
|
848 | 867 |
uint64_t addr; |
868 |
#endif |
|
849 | 869 |
|
850 | 870 |
frame_size = 0 |
851 | 871 |
+ 8 /* back chain */ |
... | ... | |
859 | 879 |
; |
860 | 880 |
frame_size = (frame_size + 15) & ~15; |
861 | 881 |
|
882 |
#ifndef __APPLE__ |
|
862 | 883 |
/* First emit adhoc function descriptor */ |
863 | 884 |
addr = (uint64_t) s->code_ptr + 24; |
864 | 885 |
tcg_out32 (s, addr >> 32); tcg_out32 (s, addr); /* entry point */ |
865 | 886 |
s->code_ptr += 16; /* skip TOC and environment pointer */ |
887 |
#endif |
|
866 | 888 |
|
867 | 889 |
/* Prologue */ |
868 | 890 |
tcg_out32 (s, MFSPR | RT (0) | LR); |
... | ... | |
1516 | 1538 |
tcg_regset_set32 (tcg_target_available_regs[TCG_TYPE_I64], 0, 0xffffffff); |
1517 | 1539 |
tcg_regset_set32 (tcg_target_call_clobber_regs, 0, |
1518 | 1540 |
(1 << TCG_REG_R0) | |
1541 |
#ifdef __APPLE__ |
|
1542 |
(1 << TCG_REG_R2) | |
|
1543 |
#endif |
|
1519 | 1544 |
(1 << TCG_REG_R3) | |
1520 | 1545 |
(1 << TCG_REG_R4) | |
1521 | 1546 |
(1 << TCG_REG_R5) | |
... | ... | |
1531 | 1556 |
tcg_regset_clear (s->reserved_regs); |
1532 | 1557 |
tcg_regset_set_reg (s->reserved_regs, TCG_REG_R0); |
1533 | 1558 |
tcg_regset_set_reg (s->reserved_regs, TCG_REG_R1); |
1559 |
#ifndef __APPLE__ |
|
1534 | 1560 |
tcg_regset_set_reg (s->reserved_regs, TCG_REG_R2); |
1561 |
#endif |
|
1535 | 1562 |
tcg_regset_set_reg (s->reserved_regs, TCG_REG_R13); |
1536 | 1563 |
|
1537 | 1564 |
#ifdef CONFIG_USE_GUEST_BASE |
Also available in: Unified diff