From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1KKCRJ-0003W3-1F for qemu-devel@nongnu.org; Sat, 19 Jul 2008 09:25:33 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1KKCRH-0003Ug-Tz for qemu-devel@nongnu.org; Sat, 19 Jul 2008 09:25:32 -0400 Received: from [199.232.76.173] (port=51416 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1KKCRH-0003UG-K7 for qemu-devel@nongnu.org; Sat, 19 Jul 2008 09:25:31 -0400 Received: from savannah.gnu.org ([199.232.41.3]:60664 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 1KKCRH-0004m8-5J for qemu-devel@nongnu.org; Sat, 19 Jul 2008 09:25:31 -0400 Received: from cvs.savannah.gnu.org ([199.232.41.69]) by sv.gnu.org with esmtp (Exim 4.63) (envelope-from ) id 1KKCRF-00073T-Tb for qemu-devel@nongnu.org; Sat, 19 Jul 2008 13:25:30 +0000 Received: from blueswir1 by cvs.savannah.gnu.org with local (Exim 4.63) (envelope-from ) id 1KKCRF-00073P-Gs for qemu-devel@nongnu.org; Sat, 19 Jul 2008 13:25:29 +0000 MIME-Version: 1.0 Errors-To: blueswir1 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit From: Blue Swirl Message-Id: Date: Sat, 19 Jul 2008 13:25:29 +0000 Subject: [Qemu-devel] [4902] Implement nucleus quad ldda 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: 4902 http://svn.sv.gnu.org/viewvc/?view=rev&root=qemu&revision=4902 Author: blueswir1 Date: 2008-07-19 13:25:28 +0000 (Sat, 19 Jul 2008) Log Message: ----------- Implement nucleus quad ldda Modified Paths: -------------- trunk/target-sparc/helper.h trunk/target-sparc/op_helper.c trunk/target-sparc/translate.c Modified: trunk/target-sparc/helper.h =================================================================== --- trunk/target-sparc/helper.h 2008-07-19 13:04:26 UTC (rev 4901) +++ trunk/target-sparc/helper.h 2008-07-19 13:25:28 UTC (rev 4902) @@ -22,6 +22,7 @@ DEF_HELPER(target_ulong, helper_alignaddr, (target_ulong addr, \ target_ulong offset)) DEF_HELPER(target_ulong, helper_popc, (target_ulong val)) +DEF_HELPER(void, helper_ldda_asi, (target_ulong addr, int asi, int rd)) DEF_HELPER(void, helper_ldf_asi, (target_ulong addr, int asi, int size, int rd)) DEF_HELPER(void, helper_stf_asi, (target_ulong addr, int asi, int size, int rd)) DEF_HELPER(target_ulong, helper_cas_asi, (target_ulong addr, \ Modified: trunk/target-sparc/op_helper.c =================================================================== --- trunk/target-sparc/op_helper.c 2008-07-19 13:04:26 UTC (rev 4901) +++ trunk/target-sparc/op_helper.c 2008-07-19 13:25:28 UTC (rev 4902) @@ -1634,12 +1634,15 @@ } break; } + case 0x24: // Nucleus quad LDD 128 bit atomic + case 0x2c: // Nucleus quad LDD 128 bit atomic LE + // Only ldda allowed + raise_exception(TT_ILL_INSN); + return 0; case 0x04: // Nucleus case 0x0c: // Nucleus Little Endian (LE) case 0x11: // As if user secondary case 0x19: // As if user secondary LE - case 0x24: // Nucleus quad LDD 128 bit atomic - case 0x2c: // Nucleus quad LDD 128 bit atomic case 0x4a: // UPA config case 0x81: // Secondary case 0x83: // Secondary no-fault @@ -1943,12 +1946,15 @@ } } return; + case 0x24: // Nucleus quad LDD 128 bit atomic + case 0x2c: // Nucleus quad LDD 128 bit atomic LE + // Only ldda allowed + raise_exception(TT_ILL_INSN); + return; case 0x04: // Nucleus case 0x0c: // Nucleus Little Endian (LE) case 0x11: // As if user secondary case 0x19: // As if user secondary LE - case 0x24: // Nucleus quad LDD 128 bit atomic - case 0x2c: // Nucleus quad LDD 128 bit atomic case 0x4a: // UPA config case 0x81: // Secondary case 0x89: // Secondary LE @@ -2144,6 +2150,53 @@ } #endif /* CONFIG_USER_ONLY */ +void helper_ldda_asi(target_ulong addr, int asi, int rd) +{ + unsigned int i; + + if ((asi < 0x80 && (env->pstate & PS_PRIV) == 0) + || (asi >= 0x30 && asi < 0x80 && !(env->hpstate & HS_PRIV))) + raise_exception(TT_PRIV_ACT); + + switch (asi) { + case 0x24: // Nucleus quad LDD 128 bit atomic + case 0x2c: // Nucleus quad LDD 128 bit atomic LE + helper_check_align(addr, 0xf); + if (rd == 0) { + env->gregs[1] = ldq_kernel(addr + 8); + if (asi == 0x2c) + bswap64s(&env->gregs[1]); + } else if (rd < 8) { + env->gregs[rd] = ldq_kernel(addr); + env->gregs[rd + 1] = ldq_kernel(addr + 8); + if (asi == 0x2c) { + bswap64s(&env->gregs[rd]); + bswap64s(&env->gregs[rd + 1]); + } + } else { + env->regwptr[rd] = ldq_kernel(addr); + env->regwptr[rd + 1] = ldq_kernel(addr + 8); + if (asi == 0x2c) { + bswap64s(&env->regwptr[rd]); + bswap64s(&env->regwptr[rd + 1]); + } + } + break; + default: + helper_check_align(addr, 0x3); + if (rd == 0) + env->gregs[1] = helper_ld_asi(addr + 4, asi, 4, 0); + else if (rd < 8) { + env->gregs[rd] = helper_ld_asi(addr, asi, 4, 0); + env->gregs[rd + 1] = helper_ld_asi(addr + 4, asi, 4, 0); + } else { + env->regwptr[rd] = helper_ld_asi(addr, asi, 4, 0); + env->regwptr[rd + 1] = helper_ld_asi(addr + 4, asi, 4, 0); + } + break; + } +} + void helper_ldf_asi(target_ulong addr, int asi, int size, int rd) { unsigned int i; Modified: trunk/target-sparc/translate.c =================================================================== --- trunk/target-sparc/translate.c 2008-07-19 13:04:26 UTC (rev 4901) +++ trunk/target-sparc/translate.c 2008-07-19 13:25:28 UTC (rev 4902) @@ -1722,20 +1722,15 @@ tcg_gen_trunc_i64_tl(dst, cpu_tmp64); } -static inline void gen_ldda_asi(TCGv lo, TCGv hi, TCGv addr, int insn) +static inline void gen_ldda_asi(TCGv hi, TCGv addr, int insn, int rd) { - TCGv r_asi, r_size, r_sign; + TCGv r_asi, r_rd; r_asi = gen_get_asi(insn, addr); - r_size = tcg_const_i32(8); - r_sign = tcg_const_i32(0); - tcg_gen_helper_1_4(helper_ld_asi, cpu_tmp64, addr, r_asi, r_size, r_sign); - tcg_temp_free(r_sign); - tcg_temp_free(r_size); + r_rd = tcg_const_i32(rd); + tcg_gen_helper_0_3(helper_ldda_asi, addr, r_asi, r_rd); + tcg_temp_free(r_rd); tcg_temp_free(r_asi); - tcg_gen_andi_i64(lo, cpu_tmp64, 0xffffffffULL); - tcg_gen_shri_i64(cpu_tmp64, cpu_tmp64, 32); - tcg_gen_andi_i64(hi, cpu_tmp64, 0xffffffffULL); } static inline void gen_stda_asi(TCGv hi, TCGv addr, int insn, int rd) @@ -1822,7 +1817,7 @@ tcg_gen_trunc_i64_tl(dst, cpu_tmp64); } -static inline void gen_ldda_asi(TCGv lo, TCGv hi, TCGv addr, int insn) +static inline void gen_ldda_asi(TCGv hi, TCGv addr, int insn, int rd) { TCGv r_asi, r_size, r_sign; @@ -1833,9 +1828,11 @@ tcg_temp_free(r_sign); tcg_temp_free(r_size); tcg_temp_free(r_asi); - tcg_gen_trunc_i64_tl(lo, cpu_tmp64); + tcg_gen_trunc_i64_tl(cpu_tmp0, cpu_tmp64); + gen_movl_TN_reg(rd + 1, cpu_tmp0); tcg_gen_shri_i64(cpu_tmp64, cpu_tmp64, 32); tcg_gen_trunc_i64_tl(hi, cpu_tmp64); + gen_movl_TN_reg(rd, hi); } static inline void gen_stda_asi(TCGv hi, TCGv addr, int insn, int rd) @@ -4310,9 +4307,8 @@ if (rd & 1) goto illegal_insn; save_state(dc, cpu_cond); - gen_ldda_asi(cpu_tmp0, cpu_val, cpu_addr, insn); - gen_movl_TN_reg(rd + 1, cpu_tmp0); - break; + gen_ldda_asi(cpu_val, cpu_addr, insn, rd); + goto skip_move; case 0x19: /* load signed byte alternate */ #ifndef TARGET_SPARC64 if (IS_IMM) @@ -4403,7 +4399,7 @@ goto illegal_insn; } gen_movl_TN_reg(rd, cpu_val); -#ifdef TARGET_SPARC64 +#if !defined(CONFIG_USER_ONLY) || defined(TARGET_SPARC64) skip_move: ; #endif } else if (xop >= 0x20 && xop < 0x24) {