From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1KPisF-00042N-Qt for qemu-devel@nongnu.org; Sun, 03 Aug 2008 15:04:11 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1KPisE-00041y-E0 for qemu-devel@nongnu.org; Sun, 03 Aug 2008 15:04:10 -0400 Received: from [199.232.76.173] (port=43796 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1KPisE-00041v-7w for qemu-devel@nongnu.org; Sun, 03 Aug 2008 15:04:10 -0400 Received: from savannah.gnu.org ([199.232.41.3]:54528 helo=sv.gnu.org) by monty-python.gnu.org with esmtps (TLS-1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1KPisE-0005SS-0Q for qemu-devel@nongnu.org; Sun, 03 Aug 2008 15:04:10 -0400 Received: from cvs.savannah.gnu.org ([199.232.41.69]) by sv.gnu.org with esmtp (Exim 4.63) (envelope-from ) id 1KPisC-0006EM-PX for qemu-devel@nongnu.org; Sun, 03 Aug 2008 19:04:08 +0000 Received: from malc by cvs.savannah.gnu.org with local (Exim 4.63) (envelope-from ) id 1KPisC-0006EI-HL for qemu-devel@nongnu.org; Sun, 03 Aug 2008 19:04:08 +0000 MIME-Version: 1.0 Errors-To: malc Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit From: malc Message-Id: Date: Sun, 03 Aug 2008 19:04:08 +0000 Subject: [Qemu-devel] [4984] Preliminary MacOS X on PPC32 support Reply-To: qemu-devel@nongnu.org List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org 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