From patchwork Fri Dec 11 17:38:23 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 40939 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [199.232.76.165]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id 6869CB7B6B for ; Sat, 12 Dec 2009 12:35:39 +1100 (EST) Received: from localhost ([127.0.0.1]:59059 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1NJGtT-00075r-D5 for incoming@patchwork.ozlabs.org; Fri, 11 Dec 2009 20:35:35 -0500 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1NJGhv-0007qA-5M for qemu-devel@nongnu.org; Fri, 11 Dec 2009 20:23:39 -0500 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1NJGhq-0007mw-9h for qemu-devel@nongnu.org; Fri, 11 Dec 2009 20:23:36 -0500 Received: from [199.232.76.173] (port=54752 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1NJGhp-0007mQ-Ed for qemu-devel@nongnu.org; Fri, 11 Dec 2009 20:23:33 -0500 Received: from are.twiddle.net ([75.149.56.221]:43438) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1NJGhn-000367-RQ for qemu-devel@nongnu.org; Fri, 11 Dec 2009 20:23:32 -0500 Received: by are.twiddle.net (Postfix, from userid 5000) id 8E3A8C8D; Fri, 11 Dec 2009 17:23:30 -0800 (PST) Message-Id: In-Reply-To: References: From: Richard Henderson Date: Fri, 11 Dec 2009 09:38:23 -0800 To: qemu-devel@nongnu.org MIME-Version: 1.0 X-detected-operating-system: by monty-python.gnu.org: GNU/Linux 2.6 (newer, 2) Subject: [Qemu-devel] [PATCH 06/13] alpha: Implement RD/WRUNIQUE in the translator X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org When emulating user-mode only, there's no reason to exit the translation block to effect a call_pal. We can generate a move to/from the unique slot directly. Signed-off-by: Richard Henderson --- hw/alpha_palcode.c | 11 +++++------ target-alpha/translate.c | 39 +++++++++++++++++++++++++++++---------- 2 files changed, 34 insertions(+), 16 deletions(-) diff --git a/hw/alpha_palcode.c b/hw/alpha_palcode.c index 44b2ca4..4cc37fe 100644 --- a/hw/alpha_palcode.c +++ b/hw/alpha_palcode.c @@ -1060,7 +1060,6 @@ void call_pal (CPUState *env, int palcode) { target_long ret; - qemu_log("%s: palcode %02x\n", __func__, palcode); switch (palcode) { case 0x80: /* BPT */ @@ -1093,14 +1092,14 @@ void call_pal (CPUState *env, int palcode) break; case 0x9E: /* RDUNIQUE */ - env->ir[IR_V0] = env->unique; qemu_log("RDUNIQUE: " TARGET_FMT_lx "\n", env->unique); - break; + /* Handled in the translator for usermode. */ + abort (); case 0x9F: /* WRUNIQUE */ - env->unique = env->ir[IR_A0]; - qemu_log("WRUNIQUE: " TARGET_FMT_lx "\n", env->unique); - break; + qemu_log("WRUNIQUE: " TARGET_FMT_lx "\n", env->ir[IR_A0]); + /* Handled in the translator for usermode. */ + abort (); case 0xAA: /* GENTRAP */ qemu_log("GENTRAP: " TARGET_FMT_lx "\n", env->ir[IR_A0]); diff --git a/target-alpha/translate.c b/target-alpha/translate.c index cabf75a..b53737a 100644 --- a/target-alpha/translate.c +++ b/target-alpha/translate.c @@ -57,6 +57,9 @@ static TCGv cpu_ir[31]; static TCGv cpu_fir[31]; static TCGv cpu_pc; static TCGv cpu_lock; +#ifdef CONFIG_USER_ONLY +static TCGv cpu_uniq; +#endif /* register names */ static char cpu_reg_names[10*4+21*5 + 10*5+21*6]; @@ -93,6 +96,11 @@ static void alpha_translate_init(void) cpu_lock = tcg_global_mem_new_i64(TCG_AREG0, offsetof(CPUState, lock), "lock"); +#ifdef CONFIG_USER_ONLY + cpu_uniq = tcg_global_mem_new_i64(TCG_AREG0, + offsetof(CPUState, unique), "uniq"); +#endif + /* register helpers */ #define GEN_HELPER 2 #include "helper.h" @@ -751,23 +759,34 @@ static inline int translate_one(DisasContext *ctx, uint32_t insn) switch (opc) { case 0x00: /* CALL_PAL */ +#ifdef CONFIG_USER_ONLY + if (palcode == 0x9E) { + /* RDUNIQUE */ + tcg_gen_mov_i64(cpu_ir[IR_V0], cpu_uniq); + break; + } else if (palcode == 0x9F) { + /* WRUNIQUE */ + tcg_gen_mov_i64(cpu_uniq, cpu_ir[IR_A0]); + break; + } +#endif if (palcode >= 0x80 && palcode < 0xC0) { /* Unprivileged PAL call */ gen_excp(ctx, EXCP_CALL_PAL + ((palcode & 0x3F) << 6), 0); -#if !defined (CONFIG_USER_ONLY) - } else if (palcode < 0x40) { + ret = 3; + break; + } +#ifndef CONFIG_USER_ONLY + if (palcode < 0x40) { /* Privileged PAL code */ if (ctx->mem_idx & 1) goto invalid_opc; - else - gen_excp(ctx, EXCP_CALL_PALP + ((palcode & 0x3F) << 6), 0); -#endif - } else { - /* Invalid PAL call */ - goto invalid_opc; + gen_excp(ctx, EXCP_CALL_PALP + ((palcode & 0x3F) << 6), 0); + ret = 3; } - ret = 3; - break; +#endif + /* Invalid PAL call */ + goto invalid_opc; case 0x01: /* OPC01 */ goto invalid_opc;