From patchwork Fri Dec 6 13:19:03 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 22120 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-yh0-f69.google.com (mail-yh0-f69.google.com [209.85.213.69]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 6B35C23A4E for ; Fri, 6 Dec 2013 13:19:21 +0000 (UTC) Received: by mail-yh0-f69.google.com with SMTP id a41sf1288529yho.0 for ; Fri, 06 Dec 2013 05:19:20 -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=+q90hev30LxRLP2NaNHaT7EjpKLjRwGLSNJl1jq8XxQ=; b=JHgiAZ0d02hKAsAowBxZogk0HAJ2qF8Z59j496S+cSNbq4heqQl7g9E0A8l2tQU/0F I8CGMvkNZ4Jg7AcoT1XkxiQOJtVMSyrnFzn/oOKyZnDVHqcbd3BadcTKZoUOoAljVIBe PghfvQhDEf2SjizgS3jWQwjZ05HZDoVVaIcPCRehnqIInoOvyOlQQIWlW4ARILI/dEpi CbbeCbGOJQis+4at5U5aH250p1cNAtIWLXGbLO/OL5YDAQL7QIv23iRbAPy2V16Ky/Gs b5K1TII9rQMHXTevoDQUaBwVnhgDcKuHvf1Jjtmba158jD+KHetDbywT5OHYHkGem50W 9Z7Q== X-Gm-Message-State: ALoCoQkMAFTT7MFhkpNcmy9PtKptA+5o6FKzFHBtks93VHs3ChOwH/JJLdoKxcmE+HsqosZEncrb X-Received: by 10.236.180.2 with SMTP id i2mr951906yhm.4.1386335960499; Fri, 06 Dec 2013 05:19:20 -0800 (PST) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.49.0.174 with SMTP id 14ls1267523qef.5.gmail; Fri, 06 Dec 2013 05:19:20 -0800 (PST) X-Received: by 10.58.75.164 with SMTP id d4mr1211934vew.53.1386335960404; Fri, 06 Dec 2013 05:19:20 -0800 (PST) Received: from mail-ve0-f171.google.com (mail-ve0-f171.google.com [209.85.128.171]) by mx.google.com with ESMTPS id im16si34613973vec.16.2013.12.06.05.19.20 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Fri, 06 Dec 2013 05:19:20 -0800 (PST) Received-SPF: neutral (google.com: 209.85.128.171 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.171; Received: by mail-ve0-f171.google.com with SMTP id pa12so730922veb.30 for ; Fri, 06 Dec 2013 05:19:20 -0800 (PST) X-Received: by 10.220.58.1 with SMTP id e1mr1926613vch.0.1386335959970; Fri, 06 Dec 2013 05:19:19 -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 u4csp99107vcz; Fri, 6 Dec 2013 05:19:19 -0800 (PST) X-Received: by 10.180.187.41 with SMTP id fp9mr2357063wic.33.1386335958801; Fri, 06 Dec 2013 05:19:18 -0800 (PST) Received: from mnementh.archaic.org.uk (mnementh.archaic.org.uk. [2001:8b0:1d0::1]) by mx.google.com with ESMTPS id gy4si1252337wib.12.2013.12.06.05.19.17 for (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Fri, 06 Dec 2013 05:19:18 -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 1VovJJ-0007WP-Cs; Fri, 06 Dec 2013 13:19:13 +0000 From: Peter Maydell To: qemu-devel@nongnu.org Cc: patches@linaro.org, Michael Matz , Claudio Fontana , Dirk Mueller , Laurent Desnogues , kvmarm@lists.cs.columbia.edu, Richard Henderson , =?UTF-8?q?Alex=20Benn=C3=A9e?= , Christoffer Dall , Will Newton Subject: [PATCH v2 03/13] target-arm: A64: add support for ADR and ADRP Date: Fri, 6 Dec 2013 13:19:03 +0000 Message-Id: <1386335953-28876-4-git-send-email-peter.maydell@linaro.org> X-Mailer: git-send-email 1.7.10.4 In-Reply-To: <1386335953-28876-1-git-send-email-peter.maydell@linaro.org> References: <1386335953-28876-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.171 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 Add support for the instructions described in "C3.4.6 PC-rel. addressing" (ADR and ADRP). Signed-off-by: Alexander Graf [claudio: adapted to new decoder structure] Signed-off-by: Claudio Fontana Reviewed-by: Richard Henderson --- target-arm/translate-a64.c | 25 +++++++++++++++++++++++-- 1 file changed, 23 insertions(+), 2 deletions(-) diff --git a/target-arm/translate-a64.c b/target-arm/translate-a64.c index b6cce1e..90eaf02 100644 --- a/target-arm/translate-a64.c +++ b/target-arm/translate-a64.c @@ -653,10 +653,31 @@ static void disas_ldst(DisasContext *s, uint32_t insn) } } -/* PC-rel. addressing */ +/* C3.4.6 PC-rel. addressing + * 31 30 29 28 24 23 5 4 0 + * +----+-------+-----------+-------------------+------+ + * | op | immlo | 1 0 0 0 0 | immhi | Rd | + * +----+-------+-----------+-------------------+------+ + */ static void disas_pc_rel_adr(DisasContext *s, uint32_t insn) { - unsupported_encoding(s, insn); + unsigned int page, rd; + uint64_t base; + int64_t offset; + + page = extract32(insn, 31, 1); + /* SignExtend(immhi:immlo) -> offset */ + offset = ((int64_t)sextract32(insn, 5, 19) << 2) | extract32(insn, 29, 2); + rd = extract32(insn, 0, 5); + base = s->pc - 4; + + if (page) { + /* ADRP (page based) */ + base &= ~0xfff; + offset <<= 12; + } + + tcg_gen_movi_i64(cpu_reg(s, rd), base + offset); } /* Add/subtract (immediate) */