Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1KjHh8-00017E-CL for qemu-devel@nongnu.org; Fri, 26 Sep 2008 14:05:34 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1KjHh7-00016z-M5 for qemu-devel@nongnu.org; Fri, 26 Sep 2008 14:05:33 -0400 Received: from [199.232.76.173] (port=38139 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1KjHh7-00016q-96 for qemu-devel@nongnu.org; Fri, 26 Sep 2008 14:05:33 -0400 Received: from savannah.gnu.org ([199.232.41.3]:45045 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 1KjHh7-0004k0-5v for qemu-devel@nongnu.org; Fri, 26 Sep 2008 14:05:33 -0400 Received: from cvs.savannah.gnu.org ([199.232.41.69]) by sv.gnu.org with esmtp (Exim 4.63) (envelope-from ) id 1KjHh6-0006Uu-6l for qemu-devel@nongnu.org; Fri, 26 Sep 2008 18:05:32 +0000 Received: from blueswir1 by cvs.savannah.gnu.org with local (Exim 4.63) (envelope-from ) id 1KjHh3-0006Uo-Hf for qemu-devel@nongnu.org; Fri, 26 Sep 2008 18:05:31 +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: Fri, 26 Sep 2008 18:05:29 +0000 Subject: [Qemu-devel] [5327] Implement UA2005 hypervisor traps 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: 5327 http://svn.sv.gnu.org/viewvc/?view=rev&root=qemu&revision=5327 Author: blueswir1 Date: 2008-09-26 18:05:23 +0000 (Fri, 26 Sep 2008) Log Message: ----------- Implement UA2005 hypervisor traps 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-09-26 18:02:48 UTC (rev 5326) +++ trunk/target-sparc/helper.h 2008-09-26 18:05:23 UTC (rev 5327) @@ -38,8 +38,6 @@ DEF_HELPER(uint64_t, helper_tick_get_count, (void *opaque)) DEF_HELPER(void, helper_tick_set_limit, (void *opaque, uint64_t limit)) #endif -DEF_HELPER(void, helper_trap, (target_ulong nb_trap)) -DEF_HELPER(void, helper_trapcc, (target_ulong nb_trap, target_ulong do_trap)) DEF_HELPER(void, helper_check_align, (target_ulong addr, uint32_t align)) DEF_HELPER(void, helper_debug, (void)) DEF_HELPER(void, helper_save, (void)) Modified: trunk/target-sparc/op_helper.c =================================================================== --- trunk/target-sparc/op_helper.c 2008-09-26 18:02:48 UTC (rev 5326) +++ trunk/target-sparc/op_helper.c 2008-09-26 18:05:23 UTC (rev 5327) @@ -55,20 +55,6 @@ cpu_loop_exit(); } -void helper_trap(target_ulong nb_trap) -{ - env->exception_index = TT_TRAP + (nb_trap & 0x7f); - cpu_loop_exit(); -} - -void helper_trapcc(target_ulong nb_trap, target_ulong do_trap) -{ - if (do_trap) { - env->exception_index = TT_TRAP + (nb_trap & 0x7f); - cpu_loop_exit(); - } -} - static inline void set_cwp(int new_cwp) { cpu_set_cwp(env, new_cwp); Modified: trunk/target-sparc/translate.c =================================================================== --- trunk/target-sparc/translate.c 2008-09-26 18:02:48 UTC (rev 5326) +++ trunk/target-sparc/translate.c 2008-09-26 18:05:23 UTC (rev 5327) @@ -93,6 +93,9 @@ #define QFPREG(r) (r & 0x1c) #endif +#define UA2005_HTRAP_MASK 0xff +#define V8_TRAP_MASK 0x7f + static int sign_extend(int x, int len) { len = 32 - len; @@ -2019,9 +2022,16 @@ cond = GET_FIELD(insn, 3, 6); if (cond == 0x8) { save_state(dc, cpu_cond); - tcg_gen_helper_0_1(helper_trap, cpu_dst); + if ((dc->def->features & CPU_FEATURE_HYPV) && + supervisor(dc)) + tcg_gen_andi_tl(cpu_dst, cpu_dst, UA2005_HTRAP_MASK); + else + tcg_gen_andi_tl(cpu_dst, cpu_dst, V8_TRAP_MASK); + tcg_gen_addi_tl(cpu_dst, cpu_dst, TT_TRAP); + tcg_gen_helper_0_1(raise_exception, cpu_dst); } else if (cond != 0) { TCGv r_cond = tcg_temp_new(TCG_TYPE_TL); + int l1; #ifdef TARGET_SPARC64 /* V9 icc/xcc */ int cc = GET_FIELD_SP(insn, 11, 12); @@ -2037,7 +2047,18 @@ save_state(dc, cpu_cond); gen_cond(r_cond, 0, cond); #endif - tcg_gen_helper_0_2(helper_trapcc, cpu_dst, r_cond); + l1 = gen_new_label(); + tcg_gen_brcondi_tl(TCG_COND_EQ, r_cond, 0, l1); + + if ((dc->def->features & CPU_FEATURE_HYPV) && + supervisor(dc)) + tcg_gen_andi_tl(cpu_dst, cpu_dst, UA2005_HTRAP_MASK); + else + tcg_gen_andi_tl(cpu_dst, cpu_dst, V8_TRAP_MASK); + tcg_gen_addi_tl(cpu_dst, cpu_dst, TT_TRAP); + tcg_gen_helper_0_1(raise_exception, cpu_dst); + + gen_set_label(l1); tcg_temp_free(r_cond); } gen_op_next_insn();