From patchwork Thu Dec 5 12:39:37 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 22065 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-vc0-f198.google.com (mail-vc0-f198.google.com [209.85.220.198]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 8F77123FBA for ; Thu, 5 Dec 2013 12:40:18 +0000 (UTC) Received: by mail-vc0-f198.google.com with SMTP id ld13sf36842390vcb.1 for ; Thu, 05 Dec 2013 04:40:18 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:delivered-to:from:to:cc:subject :date:message-id:in-reply-to:references:x-original-sender :x-original-authentication-results:precedence:mailing-list:list-id :list-post:list-help:list-archive:list-unsubscribe; bh=3GVTSbqjY4IEKA+6ZixaQgZhSyN2d64xsv11BOIYOEQ=; b=ljLnJapVuWtA3wvVwWs3o75AZJoNrs/HkBUPHNPulSQgmBJTx4H7sXv50KTVzjOlYo 90ioDsj2nSG+FXWolQC0P9hT+nUN/3EzWtig/G0cGuip5KN6XY+lc+tChhoCunh86BNV 09eShB++V1OV5z8XJB0ZCUb0F31yjGIvffiBGelE9hygQDaWWorFxjFnU5B122ny8S4b xEOA814Wi0+5KD3iNM6XrAfnclY5yroqLQ3TmQD9gGDvUgI+EImJtjtkWoKQ+pLr705q AC1293uC8mz/SkFnMx/j5cfJpC7f/6nJtvwltWCEMWnB1GGlcgQHqMAFe1Ck+QAY/7By KC1w== X-Gm-Message-State: ALoCoQlSX7iCv20MEu8qAnZogEF6C6QDESyNu3MQqVaQH7YBwCgqsDVSuj0/MV2x1iNlvSTHVlDu X-Received: by 10.236.111.73 with SMTP id v49mr7463028yhg.46.1386247218365; Thu, 05 Dec 2013 04:40:18 -0800 (PST) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.49.48.129 with SMTP id l1ls733291qen.75.gmail; Thu, 05 Dec 2013 04:40:18 -0800 (PST) X-Received: by 10.58.33.9 with SMTP id n9mr96522vei.66.1386247218297; Thu, 05 Dec 2013 04:40:18 -0800 (PST) Received: from mail-ve0-f174.google.com (mail-ve0-f174.google.com [209.85.128.174]) by mx.google.com with ESMTPS id h7si34407419vee.109.2013.12.05.04.40.18 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Thu, 05 Dec 2013 04:40:18 -0800 (PST) Received-SPF: neutral (google.com: 209.85.128.174 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) client-ip=209.85.128.174; Received: by mail-ve0-f174.google.com with SMTP id pa12so13738738veb.33 for ; Thu, 05 Dec 2013 04:40:18 -0800 (PST) X-Received: by 10.221.42.133 with SMTP id ty5mr119208vcb.61.1386247218145; Thu, 05 Dec 2013 04:40:18 -0800 (PST) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patches@linaro.org Received: by 10.220.174.196 with SMTP id u4csp11850vcz; Thu, 5 Dec 2013 04:40:17 -0800 (PST) X-Received: by 10.194.122.131 with SMTP id ls3mr44313374wjb.0.1386247217363; Thu, 05 Dec 2013 04:40:17 -0800 (PST) Received: from mnementh.archaic.org.uk (mnementh.archaic.org.uk. [2001:8b0:1d0::1]) by mx.google.com with ESMTPS id cq2si1006806wib.38.2013.12.05.04.40.15 for (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Thu, 05 Dec 2013 04:40:17 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of pm215@archaic.org.uk designates 2001:8b0:1d0::1 as permitted sender) client-ip=2001:8b0:1d0::1; Received: from pm215 by mnementh.archaic.org.uk with local (Exim 4.80) (envelope-from ) id 1VoYDV-00072R-4O; Thu, 05 Dec 2013 12:39:41 +0000 From: Peter Maydell To: qemu-devel@nongnu.org Cc: patches@linaro.org, Michael Matz , C Fontana , Dirk Mueller , Laurent Desnogues , kvmarm@lists.cs.columbia.edu, Richard Henderson , =?UTF-8?q?Alex=20Benn=C3=A9e?= Subject: [PATCH v3 09/12] target-arm: A64: add support for BR, BLR and RET insns Date: Thu, 5 Dec 2013 12:39:37 +0000 Message-Id: <1386247180-26994-10-git-send-email-peter.maydell@linaro.org> X-Mailer: git-send-email 1.7.10.4 In-Reply-To: <1386247180-26994-1-git-send-email-peter.maydell@linaro.org> References: <1386247180-26994-1-git-send-email-peter.maydell@linaro.org> X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: peter.maydell@linaro.org X-Original-Authentication-Results: mx.google.com; spf=neutral (google.com: 209.85.128.174 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Precedence: list Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org List-ID: X-Google-Group-Id: 836684582541 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , From: Alexander Graf Implement BR, BLR and RET. This is all of the 'unconditional branch (register)' instruction category except for ERET and DPRS (which are system mode only). Signed-off-by: Alexander Graf [claudio: reimplemented on top of new decoder structure] Signed-off-by: Claudio Fontana Signed-off-by: Peter Maydell Reviewed-by: Richard Henderson --- target-arm/translate-a64.c | 43 +++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 41 insertions(+), 2 deletions(-) diff --git a/target-arm/translate-a64.c b/target-arm/translate-a64.c index bab890d..ce2f841 100644 --- a/target-arm/translate-a64.c +++ b/target-arm/translate-a64.c @@ -384,10 +384,49 @@ static void disas_exc(DisasContext *s, uint32_t insn) unsupported_encoding(s, insn); } -/* Unconditional branch (register) */ +/* C3.2.7 Unconditional branch (register) + * 31 25 24 21 20 16 15 10 9 5 4 0 + * +---------------+-------+-------+-------+------+-------+ + * | 1 1 0 1 0 1 1 | opc | op2 | op3 | Rn | op4 | + * +---------------+-------+-------+-------+------+-------+ + */ static void disas_uncond_b_reg(DisasContext *s, uint32_t insn) { - unsupported_encoding(s, insn); + unsigned int opc, op2, op3, rn, op4; + + opc = extract32(insn, 21, 4); + op2 = extract32(insn, 16, 5); + op3 = extract32(insn, 10, 6); + rn = extract32(insn, 5, 5); + op4 = extract32(insn, 0, 5); + + if (op4 != 0x0 || op3 != 0x0 || op2 != 0x1f) { + unallocated_encoding(s); + return; + } + + switch (opc) { + case 0: /* BR */ + case 2: /* RET */ + break; + case 1: /* BLR */ + tcg_gen_movi_i64(cpu_reg(s, 30), s->pc); + break; + case 4: /* ERET */ + case 5: /* DRPS */ + if (rn != 0x1f) { + unallocated_encoding(s); + } else { + unsupported_encoding(s, insn); + } + return; + default: + unallocated_encoding(s); + return; + } + + tcg_gen_mov_i64(cpu_pc, cpu_reg(s, rn)); + s->is_jmp = DISAS_JUMP; } /* C3.2 Branches, exception generating and system instructions */