From patchwork Mon Aug 5 17:49:58 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 264723 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id 68ED72C007B for ; Tue, 6 Aug 2013 03:51:30 +1000 (EST) Received: from localhost ([::1]:47992 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1V6OwF-0007Vn-Lo for incoming@patchwork.ozlabs.org; Mon, 05 Aug 2013 13:51:23 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:34414) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1V6Ovf-0007S0-Kv for qemu-devel@nongnu.org; Mon, 05 Aug 2013 13:50:54 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1V6OvZ-0002DC-RY for qemu-devel@nongnu.org; Mon, 05 Aug 2013 13:50:47 -0400 Received: from mail-qa0-x233.google.com ([2607:f8b0:400d:c00::233]:41383) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1V6OvZ-0002D2-Lv for qemu-devel@nongnu.org; Mon, 05 Aug 2013 13:50:41 -0400 Received: by mail-qa0-f51.google.com with SMTP id f11so1126258qae.17 for ; Mon, 05 Aug 2013 10:50:41 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=sender:from:to:cc:subject:date:message-id:x-mailer:in-reply-to :references; bh=AexAxjzBs39XbruXqg3fGY4+qHCOVR9j7xWKYHLXU4I=; b=JSz3VrTorrbyAGO2Roz/mzY2T0LcufcRw6snr7GtMD6NsXloCMrugkotpGs48v9Ni5 ehgqQzVw2pRLRELlQMKXMQtuJANOmjCu3tZgG6htX8v0MmturFIvUSWOaLVLzxrB65G+ k9gWT6ZlfYWk6LHHTZiJhROcektgwBzJMSxEKqauFemOHcqCoWD3/nQe4dyWg0TyKCvN bl19MF1N4MuftfPVn5XTNc0/GVm5vW8mfwvS5YI7VMqiHPPm5yCVmSOYbJqnFMLZh9J/ Wl2+8VRK1DSJHyomjlS8cTJSWcQ0VeeccxTZZmErtq+spNq8kL7rL52XZmUsmyer3LDo ihXg== X-Received: by 10.224.173.3 with SMTP id n3mr19980467qaz.59.1375725041052; Mon, 05 Aug 2013 10:50:41 -0700 (PDT) Received: from pebble.com (cpe-66-91-180-52.hawaii.res.rr.com. [66.91.180.52]) by mx.google.com with ESMTPSA id w2sm338327qec.8.2013.08.05.10.50.39 for (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Mon, 05 Aug 2013 10:50:40 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Date: Mon, 5 Aug 2013 07:49:58 -1000 Message-Id: <1375725002-18526-2-git-send-email-rth@twiddle.net> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1375725002-18526-1-git-send-email-rth@twiddle.net> References: <1375725002-18526-1-git-send-email-rth@twiddle.net> X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). X-Received-From: 2607:f8b0:400d:c00::233 Cc: Richard Henderson Subject: [Qemu-devel] [PATCH for-next 1/5] target-alpha: Implement call_pal without an exception X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org The destination of the call_pal, and the cpu state, is very predictable; there's no need for exiting the cpu loop. Signed-off-by: Richard Henderson --- target-alpha/helper.h | 1 + target-alpha/sys_helper.c | 12 ++++++++++++ target-alpha/translate.c | 25 ++++++++++++++++++++++--- 3 files changed, 35 insertions(+), 3 deletions(-) diff --git a/target-alpha/helper.h b/target-alpha/helper.h index 0e425cf..5529c17 100644 --- a/target-alpha/helper.h +++ b/target-alpha/helper.h @@ -99,6 +99,7 @@ DEF_HELPER_FLAGS_2(ieee_input_cmp, TCG_CALL_NO_WG, void, env, i64) #if !defined (CONFIG_USER_ONLY) DEF_HELPER_2(hw_ret, void, env, i64) +DEF_HELPER_3(call_pal, void, env, i64, i64) DEF_HELPER_1(ldl_phys, i64, i64) DEF_HELPER_1(ldq_phys, i64, i64) diff --git a/target-alpha/sys_helper.c b/target-alpha/sys_helper.c index bd94597..ce51ed6 100644 --- a/target-alpha/sys_helper.c +++ b/target-alpha/sys_helper.c @@ -51,6 +51,17 @@ void helper_hw_ret(CPUAlphaState *env, uint64_t a) } } +void helper_call_pal(CPUAlphaState *env, uint64_t pc, uint64_t entry_ofs) +{ + int pal_mode = env->pal_mode; + env->exc_addr = pc | pal_mode; + env->pc = env->palbr + entry_ofs; + if (!pal_mode) { + env->pal_mode = 1; + swap_shadow_regs(env); + } +} + void helper_tbia(CPUAlphaState *env) { tlb_flush(env, 1); @@ -91,4 +102,5 @@ void helper_set_alarm(CPUAlphaState *env, uint64_t expire) qemu_del_timer(cpu->alarm_timer); } } + #endif /* CONFIG_USER_ONLY */ diff --git a/target-alpha/translate.c b/target-alpha/translate.c index 0efd559..59389a2 100644 --- a/target-alpha/translate.c +++ b/target-alpha/translate.c @@ -1521,7 +1521,8 @@ static ExitStatus gen_call_pal(DisasContext *ctx, int palcode) tcg_gen_mov_i64(cpu_unique, cpu_ir[IR_A0]); break; default: - return gen_excp(ctx, EXCP_CALL_PAL, palcode & 0xbf); + palcode &= 0xbf; + goto do_call_pal; } return NO_EXIT; } @@ -1586,13 +1587,31 @@ static ExitStatus gen_call_pal(DisasContext *ctx, int palcode) break; default: - return gen_excp(ctx, EXCP_CALL_PAL, palcode & 0x3f); + palcode &= 0x3f; + goto do_call_pal; } return NO_EXIT; } #endif - return gen_invalid(ctx); + + do_call_pal: +#ifdef CONFIG_USER_ONLY + return gen_excp(ctx, EXCP_CALL_PAL, palcode); +#else + { + TCGv pc = tcg_const_i64(ctx->pc); + TCGv entry = tcg_const_i64(palcode & 0x80 + ? 0x2000 + (palcode - 0x80) * 64 + : 0x1000 + palcode * 64); + + gen_helper_call_pal(cpu_env, pc, entry); + + tcg_temp_free(entry); + tcg_temp_free(pc); + return EXIT_PC_UPDATED; + } +#endif } #ifndef CONFIG_USER_ONLY