Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1Kg6yT-00048m-D8 for qemu-devel@nongnu.org; Wed, 17 Sep 2008 20:02:21 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1Kg6yS-000488-LS for qemu-devel@nongnu.org; Wed, 17 Sep 2008 20:02:20 -0400 Received: from [199.232.76.173] (port=46457 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Kg6yS-00047z-En for qemu-devel@nongnu.org; Wed, 17 Sep 2008 20:02:20 -0400 Received: from savannah.gnu.org ([199.232.41.3]:53549 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 1Kg6yR-0002T2-Ag for qemu-devel@nongnu.org; Wed, 17 Sep 2008 20:02:19 -0400 Received: from cvs.savannah.gnu.org ([199.232.41.69]) by sv.gnu.org with esmtp (Exim 4.63) (envelope-from ) id 1Kg6yQ-0005Zj-I4 for qemu-devel@nongnu.org; Thu, 18 Sep 2008 00:02:18 +0000 Received: from aurel32 by cvs.savannah.gnu.org with local (Exim 4.63) (envelope-from ) id 1Kg6yQ-0005Zd-0N for qemu-devel@nongnu.org; Thu, 18 Sep 2008 00:02:18 +0000 MIME-Version: 1.0 Errors-To: aurel32 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit From: Aurelien Jarno Message-Id: Date: Thu, 18 Sep 2008 00:02:18 +0000 Subject: [Qemu-devel] [5247] target-alpha: switch a few helpers to TCG 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: 5247 http://svn.sv.gnu.org/viewvc/?view=rev&root=qemu&revision=5247 Author: aurel32 Date: 2008-09-18 00:02:17 +0000 (Thu, 18 Sep 2008) Log Message: ----------- target-alpha: switch a few helpers to TCG Switch a few helpers to TCG and implement RC and RS instructions Signed-off-by: Aurelien Jarno Modified Paths: -------------- trunk/target-alpha/cpu.h trunk/target-alpha/helper.h trunk/target-alpha/op.c trunk/target-alpha/op_helper.c trunk/target-alpha/op_helper.h trunk/target-alpha/translate.c Modified: trunk/target-alpha/cpu.h =================================================================== --- trunk/target-alpha/cpu.h 2008-09-17 22:04:52 UTC (rev 5246) +++ trunk/target-alpha/cpu.h 2008-09-18 00:02:17 UTC (rev 5247) @@ -269,6 +269,7 @@ uint64_t ps; uint64_t unique; int saved_mode; /* Used for HW_LD / HW_ST */ + int intr_flag; /* For RC and RS */ #if TARGET_LONG_BITS > HOST_LONG_BITS /* temporary fixed-point registers Modified: trunk/target-alpha/helper.h =================================================================== --- trunk/target-alpha/helper.h 2008-09-17 22:04:52 UTC (rev 5246) +++ trunk/target-alpha/helper.h 2008-09-18 00:02:17 UTC (rev 5247) @@ -4,7 +4,12 @@ DEF_HELPER(void, helper_tb_flush, (void)) +DEF_HELPER(void, helper_excp, (int, int)) DEF_HELPER(uint64_t, helper_amask, (uint64_t)) +DEF_HELPER(uint64_t, helper_load_pcc, (void)) +DEF_HELPER(uint64_t, helper_load_implver, (void)) +DEF_HELPER(uint64_t, helper_rc, (void)) +DEF_HELPER(uint64_t, helper_rs, (void)) DEF_HELPER(uint64_t, helper_ctpop, (uint64_t)) DEF_HELPER(uint64_t, helper_ctlz, (uint64_t)) Modified: trunk/target-alpha/op.c =================================================================== --- trunk/target-alpha/op.c 2008-09-17 22:04:52 UTC (rev 5246) +++ trunk/target-alpha/op.c 2008-09-18 00:02:17 UTC (rev 5247) @@ -149,24 +149,6 @@ #endif /* Misc */ -void OPPROTO op_excp (void) -{ - helper_excp(PARAM(1), PARAM(2)); - RETURN(); -} - -void OPPROTO op_load_pcc (void) -{ - helper_load_pcc(); - RETURN(); -} - -void OPPROTO op_load_implver (void) -{ - helper_load_implver(); - RETURN(); -} - void OPPROTO op_load_fpcr (void) { helper_load_fpcr(); @@ -179,24 +161,6 @@ RETURN(); } -void OPPROTO op_load_irf (void) -{ - helper_load_irf(); - RETURN(); -} - -void OPPROTO op_set_irf (void) -{ - helper_set_irf(); - RETURN(); -} - -void OPPROTO op_clear_irf (void) -{ - helper_clear_irf(); - RETURN(); -} - /* Arithmetic */ void OPPROTO op_addqv (void) { Modified: trunk/target-alpha/op_helper.c =================================================================== --- trunk/target-alpha/op_helper.c 2008-09-17 22:04:52 UTC (rev 5246) +++ trunk/target-alpha/op_helper.c 2008-09-18 00:02:17 UTC (rev 5247) @@ -58,7 +58,7 @@ /*****************************************************************************/ /* Exceptions processing helpers */ -void helper_excp (uint32_t excp, uint32_t error) +void helper_excp (int excp, int error) { env->exception_index = excp; env->error_code = error; @@ -80,15 +80,15 @@ return arg; } -void helper_load_pcc (void) +uint64_t helper_load_pcc (void) { /* XXX: TODO */ - T0 = 0; + return 0; } -void helper_load_implver (void) +uint64_t helper_load_implver (void) { - T0 = env->implver; + return env->implver; } void helper_load_fpcr (void) @@ -137,20 +137,30 @@ } } -void helper_load_irf (void) +spinlock_t intr_cpu_lock = SPIN_LOCK_UNLOCKED; + +uint64_t helper_rs(void) { - /* XXX: TODO */ - T0 = 0; + uint64_t tmp; + + spin_lock(&intr_cpu_lock); + tmp = env->intr_flag; + env->intr_flag = 1; + spin_unlock(&intr_cpu_lock); + + return tmp; } -void helper_set_irf (void) +uint64_t helper_rc(void) { - /* XXX: TODO */ -} + uint64_t tmp; -void helper_clear_irf (void) -{ - /* XXX: TODO */ + spin_lock(&intr_cpu_lock); + tmp = env->intr_flag; + env->intr_flag = 0; + spin_unlock(&intr_cpu_lock); + + return tmp; } void helper_addqv (void) Modified: trunk/target-alpha/op_helper.h =================================================================== --- trunk/target-alpha/op_helper.h 2008-09-17 22:04:52 UTC (rev 5246) +++ trunk/target-alpha/op_helper.h 2008-09-18 00:02:17 UTC (rev 5247) @@ -19,14 +19,8 @@ */ void helper_call_pal (uint32_t palcode); -void helper_excp (uint32_t excp, uint32_t error); -void helper_load_pcc (void); -void helper_load_implver (void); void helper_load_fpcr (void); void helper_store_fpcr (void); -void helper_load_irf (void); -void helper_set_irf (void); -void helper_clear_irf (void); void helper_addqv (void); void helper_addlv (void); void helper_subqv (void); Modified: trunk/target-alpha/translate.c =================================================================== --- trunk/target-alpha/translate.c 2008-09-17 22:04:52 UTC (rev 5246) +++ trunk/target-alpha/translate.c 2008-09-18 00:02:17 UTC (rev 5247) @@ -250,8 +250,14 @@ static always_inline void gen_excp (DisasContext *ctx, int exception, int error_code) { + TCGv tmp1, tmp2; + tcg_gen_movi_i64(cpu_pc, ctx->pc); - gen_op_excp(exception, error_code); + tmp1 = tcg_const_i32(exception); + tmp2 = tcg_const_i32(error_code); + tcg_gen_helper_0_2(helper_excp, tmp1, tmp2); + tcg_temp_free(tmp2); + tcg_temp_free(tmp1); } static always_inline void gen_invalid (DisasContext *ctx) @@ -1176,9 +1182,8 @@ break; case 0x6C: /* IMPLVER */ - gen_op_load_implver(); if (rc != 31) - tcg_gen_mov_i64(cpu_ir[rc], cpu_T[0]); + tcg_gen_helper_1_0(helper_load_implver, cpu_ir[rc]); break; default: goto invalid_opc; @@ -1699,16 +1704,13 @@ break; case 0xC000: /* RPCC */ - gen_op_load_pcc(); if (ra != 31) - tcg_gen_mov_i64(cpu_ir[ra], cpu_T[0]); + tcg_gen_helper_1_0(helper_load_pcc, cpu_ir[ra]); break; case 0xE000: /* RC */ - gen_op_load_irf(); if (ra != 31) - tcg_gen_mov_i64(cpu_ir[ra], cpu_T[0]); - gen_op_clear_irf(); + tcg_gen_helper_1_0(helper_rc, cpu_ir[ra]); break; case 0xE800: /* ECB */ @@ -1721,10 +1723,8 @@ break; case 0xF000: /* RS */ - gen_op_load_irf(); if (ra != 31) - tcg_gen_mov_i64(cpu_ir[ra], cpu_T[0]); - gen_op_set_irf(); + tcg_gen_helper_1_0(helper_rs, cpu_ir[ra]); break; case 0xF800: /* WH64 */