[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [4984] Preliminary MacOS X on PPC32 support
From: |
malc |
Subject: |
[Qemu-devel] [4984] Preliminary MacOS X on PPC32 support |
Date: |
Sun, 03 Aug 2008 19:04:08 +0000 |
Revision: 4984
http://svn.sv.gnu.org/viewvc/?view=rev&root=qemu&revision=4984
Author: malc
Date: 2008-08-03 19:04:07 +0000 (Sun, 03 Aug 2008)
Log Message:
-----------
Preliminary MacOS X on PPC32 support
Big thanks to BlueSwirl for Sparc failure analysis.
Modified Paths:
--------------
trunk/tcg/ppc/tcg-target.c
trunk/tcg/ppc/tcg-target.h
Modified: trunk/tcg/ppc/tcg-target.c
===================================================================
--- trunk/tcg/ppc/tcg-target.c 2008-08-02 11:18:40 UTC (rev 4983)
+++ trunk/tcg/ppc/tcg-target.c 2008-08-03 19:04:07 UTC (rev 4984)
@@ -24,6 +24,14 @@
static uint8_t *tb_ret_addr;
+#ifdef __APPLE__
+#define LINKAGE_AREA_SIZE 12
+#define BACK_CHAIN_OFFSET 8
+#else
+#define LINKAGE_AREA_SIZE 8
+#define BACK_CHAIN_OFFSET 4
+#endif
+
#define FAST_PATH
#if TARGET_PHYS_ADDR_BITS <= 32
#define ADDEND_OFFSET 0
@@ -81,6 +89,9 @@
TCG_REG_R29,
TCG_REG_R30,
TCG_REG_R31,
+#ifdef __APPLE__
+ TCG_REG_R2,
+#endif
TCG_REG_R3,
TCG_REG_R4,
TCG_REG_R5,
@@ -89,7 +100,9 @@
TCG_REG_R8,
TCG_REG_R9,
TCG_REG_R10,
+#ifndef __APPLE__
TCG_REG_R11,
+#endif
TCG_REG_R12,
TCG_REG_R13,
TCG_REG_R0,
@@ -118,6 +131,10 @@
};
static const int tcg_target_callee_save_regs[] = {
+#ifdef __APPLE__
+ TCG_REG_R11,
+ TCG_REG_R13,
+#endif
TCG_REG_R14,
TCG_REG_R15,
TCG_REG_R16,
@@ -710,8 +727,12 @@
#else
tcg_out_mov (s, 3, addr_reg2);
tcg_out_mov (s, 4, addr_reg);
+#ifdef TCG_TARGET_CALL_ALIGN_ARGS
ir = 5;
+#else
+ ir = 4;
#endif
+#endif
switch (opc) {
case 0:
@@ -734,9 +755,11 @@
tcg_out_mov (s, ir, data_reg);
break;
case 3:
- tcg_out_mov (s, 5, data_reg2);
- tcg_out_mov (s, 6, data_reg);
- ir = 6;
+#ifdef TCG_TARGET_CALL_ALIGN_ARGS
+ ir = 5;
+#endif
+ tcg_out_mov (s, ir++, data_reg2);
+ tcg_out_mov (s, ir, data_reg);
break;
}
ir++;
@@ -806,8 +829,7 @@
int i, frame_size;
frame_size = 0
- + 4 /* back chain */
- + 4 /* LR */
+ + LINKAGE_AREA_SIZE
+ TCG_STATIC_CALL_ARGS_SIZE
+ ARRAY_SIZE (tcg_target_callee_save_regs) * 4
;
@@ -819,10 +841,10 @@
tcg_out32 (s, (STW
| RS (tcg_target_callee_save_regs[i])
| RA (1)
- | (i * 4 + 8 + TCG_STATIC_CALL_ARGS_SIZE)
+ | (i * 4 + LINKAGE_AREA_SIZE +
TCG_STATIC_CALL_ARGS_SIZE)
)
);
- tcg_out32 (s, STW | RS (0) | RA (1) | (frame_size + 4));
+ tcg_out32 (s, STW | RS (0) | RA (1) | (frame_size + BACK_CHAIN_OFFSET));
tcg_out32 (s, MTSPR | RS (3) | CTR);
tcg_out32 (s, BCCTR | BO_ALWAYS);
@@ -832,10 +854,10 @@
tcg_out32 (s, (LWZ
| RT (tcg_target_callee_save_regs[i])
| RA (1)
- | (i * 4 + 8 + TCG_STATIC_CALL_ARGS_SIZE)
+ | (i * 4 + LINKAGE_AREA_SIZE +
TCG_STATIC_CALL_ARGS_SIZE)
)
);
- tcg_out32 (s, LWZ | RT (0) | RA (1) | (frame_size + 4));
+ tcg_out32 (s, LWZ | RT (0) | RA (1) | (frame_size + BACK_CHAIN_OFFSET));
tcg_out32 (s, MTSPR | RS (0) | LR);
tcg_out32 (s, ADDI | RT (1) | RA (1) | frame_size);
tcg_out32 (s, BCLR | BO_ALWAYS);
@@ -1438,6 +1460,9 @@
tcg_regset_set32(tcg_target_available_regs[TCG_TYPE_I32], 0, 0xffffffff);
tcg_regset_set32(tcg_target_call_clobber_regs, 0,
(1 << TCG_REG_R0) |
+#ifdef __APPLE__
+ (1 << TCG_REG_R2) |
+#endif
(1 << TCG_REG_R3) |
(1 << TCG_REG_R4) |
(1 << TCG_REG_R5) |
@@ -1453,7 +1478,9 @@
tcg_regset_clear(s->reserved_regs);
tcg_regset_set_reg(s->reserved_regs, TCG_REG_R0);
tcg_regset_set_reg(s->reserved_regs, TCG_REG_R1);
+#ifndef __APPLE__
tcg_regset_set_reg(s->reserved_regs, TCG_REG_R2);
+#endif
tcg_add_target_add_op_defs(ppc_op_defs);
}
Modified: trunk/tcg/ppc/tcg-target.h
===================================================================
--- trunk/tcg/ppc/tcg-target.h 2008-08-02 11:18:40 UTC (rev 4983)
+++ trunk/tcg/ppc/tcg-target.h 2008-08-03 19:04:07 UTC (rev 4984)
@@ -65,8 +65,12 @@
/* used for function call generation */
#define TCG_REG_CALL_STACK TCG_REG_R1
#define TCG_TARGET_STACK_ALIGN 16
+#ifdef __APPLE__
+#define TCG_TARGET_CALL_STACK_OFFSET 12
+#else
+#define TCG_TARGET_CALL_ALIGN_ARGS 1
#define TCG_TARGET_CALL_STACK_OFFSET 8
-#define TCG_TARGET_CALL_ALIGN_ARGS 1
+#endif
/* optional instructions */
#define TCG_TARGET_HAS_neg_i32
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Qemu-devel] [4984] Preliminary MacOS X on PPC32 support,
malc <=