From patchwork Tue Mar 10 15:39:38 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ard Biesheuvel X-Patchwork-Id: 45597 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-wg0-f70.google.com (mail-wg0-f70.google.com [74.125.82.70]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id F062A214BF for ; Tue, 10 Mar 2015 15:42:23 +0000 (UTC) Received: by wggy19 with SMTP id y19sf2079835wgg.2 for ; Tue, 10 Mar 2015 08:42:23 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:delivered-to:from:to:subject:date:message-id :in-reply-to:references:cc:precedence:list-id:list-unsubscribe :list-archive:list-post:list-help:list-subscribe:mime-version :content-type:content-transfer-encoding:sender:errors-to :x-original-sender:x-original-authentication-results:mailing-list; bh=b6AbkoQniSm1zGpuABmlm0gkzOtYYcvOR7yGoCgPI+8=; b=fevJtnImLr5sim7kys+c6uMgHT33orSdl2IgkxKi/23HUbT6cXoSkJMWmMe5l0i19D mDrgCR8Dqx22PqR518WWnKOcYvyQNISupUL7SdQSv2D4IPB7CFuFQPU93PUEILhIj6Rx gm35TPtVxntFXbXFzLmVoxtqBWYYFaaonJf4Aq4ADz2esbENxizGi0Kj6bfmjbnQn0Z8 pMOHHWl1SpEFH55thiH76ziJKv1MvOja0MfUeHot66+YKlalaKOR4PhsLlpJXUMBMyZU 6IJq6xQ0m80C6RV5EBzMe4kzNBvANtt9RdpgM4NcW9zlku4Yoz3uhD2Piq1MfHGWJ+Z1 d4hw== X-Gm-Message-State: ALoCoQmljqgIyYm7y9bygCgGhqA2jo1fVfwd2irYipSknru9Gyxg2BQYdG5O7xgSwthP+CMJg4PA X-Received: by 10.152.164.171 with SMTP id yr11mr1893190lab.4.1426002143226; Tue, 10 Mar 2015 08:42:23 -0700 (PDT) X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.10.132 with SMTP id i4ls42811lab.25.gmail; Tue, 10 Mar 2015 08:42:22 -0700 (PDT) X-Received: by 10.112.130.100 with SMTP id od4mr8233815lbb.86.1426002142933; Tue, 10 Mar 2015 08:42:22 -0700 (PDT) Received: from mail-la0-f46.google.com (mail-la0-f46.google.com. [209.85.215.46]) by mx.google.com with ESMTPS id y9si632474lae.4.2015.03.10.08.42.22 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 10 Mar 2015 08:42:22 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.46 as permitted sender) client-ip=209.85.215.46; Received: by lamq1 with SMTP id q1so2561271lam.12 for ; Tue, 10 Mar 2015 08:42:22 -0700 (PDT) X-Received: by 10.112.162.232 with SMTP id yd8mr30489393lbb.41.1426002142848; Tue, 10 Mar 2015 08:42:22 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patch@linaro.org Received: by 10.112.35.133 with SMTP id h5csp2213120lbj; Tue, 10 Mar 2015 08:42:21 -0700 (PDT) X-Received: by 10.66.187.97 with SMTP id fr1mr3231682pac.157.1426002139474; Tue, 10 Mar 2015 08:42:19 -0700 (PDT) Received: from bombadil.infradead.org (bombadil.infradead.org. [2001:1868:205::9]) by mx.google.com with ESMTPS id ox7si1822727pdb.30.2015.03.10.08.42.18 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 10 Mar 2015 08:42:19 -0700 (PDT) Received-SPF: none (google.com: linux-arm-kernel-bounces+patch=linaro.org@lists.infradead.org does not designate permitted sender hosts) client-ip=2001:1868:205::9; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1YVMH0-0004bd-Mb; Tue, 10 Mar 2015 15:40:46 +0000 Received: from mail-we0-f171.google.com ([74.125.82.171]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1YVMGV-00035a-BN for linux-arm-kernel@lists.infradead.org; Tue, 10 Mar 2015 15:40:16 +0000 Received: by wesk11 with SMTP id k11so2649409wes.13 for ; Tue, 10 Mar 2015 08:39:52 -0700 (PDT) X-Received: by 10.194.62.167 with SMTP id z7mr70519190wjr.106.1426001992122; Tue, 10 Mar 2015 08:39:52 -0700 (PDT) Received: from ards-macbook-pro.local ([213.143.60.209]) by mx.google.com with ESMTPSA id ei3sm7381208wib.4.2015.03.10.08.39.49 (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 10 Mar 2015 08:39:51 -0700 (PDT) From: Ard Biesheuvel To: will.deacon@arm.com, mark.rutland@arm.com, catalin.marinas@arm.com, linux-arm-kernel@lists.infradead.org Subject: [PATCH v4 1/5] arm64: add macros for common adrp usages Date: Tue, 10 Mar 2015 16:39:38 +0100 Message-Id: <1426001982-20047-2-git-send-email-ard.biesheuvel@linaro.org> X-Mailer: git-send-email 1.8.3.2 In-Reply-To: <1426001982-20047-1-git-send-email-ard.biesheuvel@linaro.org> References: <1426001982-20047-1-git-send-email-ard.biesheuvel@linaro.org> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20150310_084015_608274_7BF532A7 X-CRM114-Status: UNSURE ( 9.04 ) X-CRM114-Notice: Please train this message. X-Spam-Score: -0.7 (/) X-Spam-Report: SpamAssassin version 3.4.0 on bombadil.infradead.org summary: Content analysis details: (-0.7 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.7 RCVD_IN_DNSWL_LOW RBL: Sender listed at http://www.dnswl.org/, low trust [74.125.82.171 listed in list.dnswl.org] -0.0 SPF_PASS SPF: sender matches SPF record -0.0 RCVD_IN_MSPIKE_H3 RBL: Good reputation (+3) [74.125.82.171 listed in wl.mailspike.net] -0.0 RCVD_IN_MSPIKE_WL Mailspike good senders Cc: Ard Biesheuvel X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: , List-Help: , List-Subscribe: , MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patch=linaro.org@lists.infradead.org X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: ard.biesheuvel@linaro.org X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.46 as permitted sender) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org X-Google-Group-Id: 836684582541 The adrp instruction is mostly used in combination with either an add, a ldr or a str instruction with the low bits of the referenced symbol in the 12-bit immediate of the followup instruction. Introduce the macros adr_l, ldr_l and str_l that encapsulate these common patterns. Signed-off-by: Ard Biesheuvel --- arch/arm64/include/asm/assembler.h | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) diff --git a/arch/arm64/include/asm/assembler.h b/arch/arm64/include/asm/assembler.h index 750bac4e637e..f1804d4803fb 100644 --- a/arch/arm64/include/asm/assembler.h +++ b/arch/arm64/include/asm/assembler.h @@ -159,4 +159,33 @@ lr .req x30 // link register orr \rd, \lbits, \hbits, lsl #32 .endm +/* + * Pseudo-ops for PC-relative adr/ldr/str , where + * is within the range +/- 4 GB of the PC. + */ + .macro adr_l, dst, sym, tmp= + .ifb \tmp + adrp \dst, \sym + add \dst, \dst, :lo12:\sym + .else + adrp \tmp, \sym + add \dst, \tmp, :lo12:\sym + .endif + .endm + + .macro ldr_l, dst, sym, tmp= + .ifb \tmp + adrp \dst, \sym + ldr \dst, [\dst, :lo12:\sym] + .else + adrp \tmp, \sym + ldr \dst, [\tmp, :lo12:\sym] + .endif + .endm + + .macro str_l, src, sym, tmp + adrp \tmp, \sym + str \src, [\tmp, :lo12:\sym] + .endm + #endif /* __ASM_ASSEMBLER_H */