From patchwork Thu Dec 5 21:51:19 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 22112 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-pd0-f198.google.com (mail-pd0-f198.google.com [209.85.192.198]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 63EDC202E0 for ; Thu, 5 Dec 2013 21:57:01 +0000 (UTC) Received: by mail-pd0-f198.google.com with SMTP id g10sf50103149pdj.5 for ; Thu, 05 Dec 2013 13:57:01 -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=TZ2s1IdVBBVRCBJsUnDELB9hahm65GxfjXNXRF5MS4k=; b=Iek7uvRMYndvnk/Xeu/mYFhnWoRkAIHztTQcVxr8NE9PZ22BXq2OKIu3dkqMYBUdyB JqMEBKQAXHJiLVxtb5ifFy9CyTMEgfY7iEZSrD7dqH5VAYNoXZSduO7z6HwYGGLkTpby nFd7DCRWoH4C4SuMlKi/FKB1+stjup0qiW9PJMkjiW2hZd87hVl1TuwURL9Y09KU8sbC VB09uW7fOuWdtHr6PnQAiWiN2eO7yDHS7jM86ZO9t6wb8DE7/2Jksou7C7HzTdqTeeAq Fm7/BdnwaW0dVJgJjIyLyMCXcUXxZhFd8SWl9Z8Wh+W5cl7bhSj8d2dqmA6D/ovjDIzW 6IBg== X-Gm-Message-State: ALoCoQmnBf9GccI12H2MdYH8aLk2kX9OlLylm6B9KNAP9OA2k1eKHYFBZBmEwoGGumoxy2XOmG3i X-Received: by 10.66.137.43 with SMTP id qf11mr131132pab.28.1386280621185; Thu, 05 Dec 2013 13:57:01 -0800 (PST) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.49.50.196 with SMTP id e4ls1004320qeo.3.gmail; Thu, 05 Dec 2013 13:57:01 -0800 (PST) X-Received: by 10.52.117.176 with SMTP id kf16mr11474vdb.6.1386280620998; Thu, 05 Dec 2013 13:57:00 -0800 (PST) Received: from mail-ve0-f170.google.com (mail-ve0-f170.google.com [209.85.128.170]) by mx.google.com with ESMTPS id ti3si29117044vdc.15.2013.12.05.13.57.00 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Thu, 05 Dec 2013 13:57:00 -0800 (PST) Received-SPF: neutral (google.com: 209.85.128.170 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.170; Received: by mail-ve0-f170.google.com with SMTP id oy12so14845410veb.29 for ; Thu, 05 Dec 2013 13:57:00 -0800 (PST) X-Received: by 10.52.160.130 with SMTP id xk2mr12997vdb.24.1386280620850; Thu, 05 Dec 2013 13:57:00 -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 u4csp50461vcz; Thu, 5 Dec 2013 13:57:00 -0800 (PST) X-Received: by 10.204.227.14 with SMTP id iy14mr48826bkb.161.1386280619932; Thu, 05 Dec 2013 13:56:59 -0800 (PST) Received: from mnementh.archaic.org.uk (mnementh.archaic.org.uk. [2001:8b0:1d0::1]) by mx.google.com with ESMTPS id hj12si18174wib.69.2013.12.05.13.56.57 for (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Thu, 05 Dec 2013 13:56:59 -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 1VogpV-0007CP-Dl; Thu, 05 Dec 2013 21:51:29 +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 03/13] target-arm: A64: add support for ADR and ADRP Date: Thu, 5 Dec 2013 21:51:19 +0000 Message-Id: <1386280289-27636-4-git-send-email-peter.maydell@linaro.org> X-Mailer: git-send-email 1.7.10.4 In-Reply-To: <1386280289-27636-1-git-send-email-peter.maydell@linaro.org> References: <1386280289-27636-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.170 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 8a13806..bff7071 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) */