From patchwork Tue Dec 3 21:51:14 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 21996 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-qc0-f198.google.com (mail-qc0-f198.google.com [209.85.216.198]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 6EBB2202FA for ; Tue, 3 Dec 2013 21:51:25 +0000 (UTC) Received: by mail-qc0-f198.google.com with SMTP id e9sf5500096qcy.5 for ; Tue, 03 Dec 2013 13:51:25 -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=CwxPDP4LblPzs1FFfnRvzi3IiXfLUkAsFUQl3AwBHcY=; b=UC0lIQSHwOmsNTYpkYSB0+D7FEvwnbrzDaqvcz3ruU/wXcNGW8QfxuWWbaDK+xVFIQ TnbTW7VSHZyBq5fp+edU82bni92U0k2AQsA6ilvOOQpnY4HVWzXZAJ/IPk7JXT1ieVUB bEB8RjJPV+4U7SoVWB1Zp2Z6ZMHrKMCYH90fxuw1NATyZKsQ6epy0U3VD7N/IVP8VHy9 ihXZlYnb4dbKO9IT9uMGki5Kq0Eaa28+yF+253oY08RGm14USpsP2XaYsLWonyWKjjd5 OV2udHoDPgvMUjwYdWr3qi2Sxic9FfuUSmnfQdknJdaEDlqBKmobxTR2o0Fip381Qh0t Nxag== X-Gm-Message-State: ALoCoQkKAEErcsovajHmaaa/hwB0tDxHN316mdo3/d9ttankbIDYhjkE6aiCYHLUD5QkFvjsiR2t X-Received: by 10.52.229.41 with SMTP id sn9mr13576430vdc.6.1386107484792; Tue, 03 Dec 2013 13:51:24 -0800 (PST) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.49.49.70 with SMTP id s6ls3855qen.34.gmail; Tue, 03 Dec 2013 13:51:24 -0800 (PST) X-Received: by 10.52.164.16 with SMTP id ym16mr512365vdb.39.1386107484694; Tue, 03 Dec 2013 13:51:24 -0800 (PST) Received: from mail-vc0-f179.google.com (mail-vc0-f179.google.com [209.85.220.179]) by mx.google.com with ESMTPS id qi1si4434102vcb.25.2013.12.03.13.51.24 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 03 Dec 2013 13:51:24 -0800 (PST) Received-SPF: neutral (google.com: 209.85.220.179 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) client-ip=209.85.220.179; Received: by mail-vc0-f179.google.com with SMTP id ie18so10280682vcb.24 for ; Tue, 03 Dec 2013 13:51:24 -0800 (PST) X-Received: by 10.220.186.202 with SMTP id ct10mr58291160vcb.14.1386107484515; Tue, 03 Dec 2013 13:51:24 -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 u4csp243281vcz; Tue, 3 Dec 2013 13:51:24 -0800 (PST) X-Received: by 10.180.90.65 with SMTP id bu1mr4445959wib.15.1386107482659; Tue, 03 Dec 2013 13:51:22 -0800 (PST) Received: from mnementh.archaic.org.uk (1.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.d.1.0.0.b.8.0.1.0.0.2.ip6.arpa. [2001:8b0:1d0::1]) by mx.google.com with ESMTPS id j17si14701029wjq.37.2013.12.03.13.51.20 for (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Tue, 03 Dec 2013 13:51:22 -0800 (PST) Received-SPF: neutral (google.com: 2001:8b0:1d0::1 is neither permitted nor denied by best guess record for domain of pm215@archaic.org.uk) client-ip=2001:8b0:1d0::1; Received: from pm215 by mnementh.archaic.org.uk with local (Exim 4.80) (envelope-from ) id 1VnxsD-0006Io-Gn; Tue, 03 Dec 2013 21:51:17 +0000 From: Peter Maydell To: qemu-devel@nongnu.org Cc: patches@linaro.org, Alexander Graf , C Fontana , Dirk Mueller , Michael Matz , Laurent Desnogues , Richard Henderson , kvmarm@lists.cs.columbia.edu Subject: [PATCH 09/12] target-arm: A64: add support for BR, BLR and RET insns Date: Tue, 3 Dec 2013 21:51:14 +0000 Message-Id: <1386107477-24165-10-git-send-email-peter.maydell@linaro.org> X-Mailer: git-send-email 1.7.10.4 In-Reply-To: <1386107477-24165-1-git-send-email-peter.maydell@linaro.org> References: <1386107477-24165-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.220.179 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 8535803..48281ff 100644 --- a/target-arm/translate-a64.c +++ b/target-arm/translate-a64.c @@ -365,10 +365,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 */