From patchwork Mon May 9 21:34:44 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 94883 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [140.186.70.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id B5434B6F3A for ; Tue, 10 May 2011 07:45:07 +1000 (EST) Received: from localhost ([::1]:47428 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QJYGG-0003hG-Mz for incoming@patchwork.ozlabs.org; Mon, 09 May 2011 17:45:04 -0400 Received: from eggs.gnu.org ([140.186.70.92]:38644) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QJY6y-00043N-Hf for qemu-devel@nongnu.org; Mon, 09 May 2011 17:35:29 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1QJY6u-0006OU-TZ for qemu-devel@nongnu.org; Mon, 09 May 2011 17:35:28 -0400 Received: from mail-iy0-f173.google.com ([209.85.210.173]:48729) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QJY6u-0006A3-Qh for qemu-devel@nongnu.org; Mon, 09 May 2011 17:35:24 -0400 Received: by mail-iy0-f173.google.com with SMTP id 10so5564538iym.4 for ; Mon, 09 May 2011 14:35:24 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:sender:from:to:subject:date:message-id:x-mailer :in-reply-to:references; bh=AYPsZkokv9Fyn6GPg4tZ/JdiXQiDfClcjMz+1stxOAc=; b=EYz6ikhGdxzlWkycWiYQOhui9A+2n/HkUhEuffK5Pfc5LDvlhZA/Ec3NfX4pf0JBud R4bDid087XVp4sdaYiqU1s769x1wJaWi77t/04eL3mQUIDpbwaVDSc0Exg5uvuUprHkb Tgnp7wpxj6iAuvOeA4j6gnqtm9kxa1UiJT/+s= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=sender:from:to:subject:date:message-id:x-mailer:in-reply-to :references; b=FE+MJz0hr1kCSSN477DA6Y27iF2b1u58oXIJWbONhGrxPXkAAcTRk8GeSRmZmvTed7 PPapOFWZDrpfig9jZetntLA7nzIVyNy+AWbqVTq15TOUxxh/xE1EUNLyusB5lhv8vHKk JzHPE7+fZ8Llsal1tZZwrW32sgx2s3nQZE4BU= Received: by 10.42.147.69 with SMTP id m5mr6966122icv.12.1304976924530; Mon, 09 May 2011 14:35:24 -0700 (PDT) Received: from localhost.localdomain (are.twiddle.net [75.101.38.216]) by mx.google.com with ESMTPS id ui7sm2549819icb.14.2011.05.09.14.35.23 (version=TLSv1/SSLv3 cipher=OTHER); Mon, 09 May 2011 14:35:24 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Date: Mon, 9 May 2011 14:34:44 -0700 Message-Id: <1304976889-29675-31-git-send-email-rth@twiddle.net> X-Mailer: git-send-email 1.7.4.4 In-Reply-To: <1304976889-29675-1-git-send-email-rth@twiddle.net> References: <1304976889-29675-1-git-send-email-rth@twiddle.net> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 2) X-Received-From: 209.85.210.173 Subject: [Qemu-devel] [PATCH 30/35] target-alpha: Implement WAIT IPR. 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 --- target-alpha/translate.c | 31 +++++++++++++++++++++---------- 1 files changed, 21 insertions(+), 10 deletions(-) diff --git a/target-alpha/translate.c b/target-alpha/translate.c index 8107d19..7b976be 100644 --- a/target-alpha/translate.c +++ b/target-alpha/translate.c @@ -1621,9 +1621,10 @@ static void gen_mfpr(int ra, int regno) } } -static void gen_mtpr(int rb, int regno) +static ExitStatus gen_mtpr(DisasContext *ctx, int rb, int regno) { TCGv tmp; + int data; if (rb == 31) { tmp = tcg_const_i64(0); @@ -1631,19 +1632,27 @@ static void gen_mtpr(int rb, int regno) tmp = cpu_ir[rb]; } - /* These two register numbers perform a TLB cache flush. Thankfully we - can only do this inside PALmode, which means that the current basic - block cannot be affected by the change in mappings. */ - if (regno == 255) { + switch (regno) { + case 255: /* TBIA */ gen_helper_tbia(); - } else if (regno == 254) { + break; + + case 254: /* TBIS */ gen_helper_tbis(tmp); - } else { + break; + + case 253: + /* WAIT */ + tmp = tcg_const_i64(1); + tcg_gen_st32_i64(tmp, cpu_env, offsetof(CPUState, halted)); + return gen_excp(ctx, EXCP_HLT, 0); + + default: /* The basic registers are data only, and unknown registers are read-zero, write-ignore. */ - int data = cpu_pr_data(regno); + data = cpu_pr_data(regno); if (data != 0) { if (data & PR_BYTE) { tcg_gen_st8_i64(tmp, cpu_env, data & ~PR_BYTE); @@ -1653,11 +1662,14 @@ static void gen_mtpr(int rb, int regno) tcg_gen_st_i64(tmp, cpu_env, data); } } + break; } if (rb == 31) { tcg_temp_free(tmp); } + + return NO_EXIT; } #endif /* !USER_ONLY*/ @@ -3052,8 +3064,7 @@ static ExitStatus translate_one(DisasContext *ctx, uint32_t insn) /* HW_MTPR (PALcode) */ #ifndef CONFIG_USER_ONLY if (ctx->tb->flags & TB_FLAGS_PAL_MODE) { - gen_mtpr(rb, insn & 0xffff); - break; + return gen_mtpr(ctx, rb, insn & 0xffff); } #endif goto invalid_opc;