From patchwork Wed Mar 18 14:55:21 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ard Biesheuvel X-Patchwork-Id: 45964 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-we0-f197.google.com (mail-we0-f197.google.com [74.125.82.197]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id D47922153B for ; Wed, 18 Mar 2015 15:39:15 +0000 (UTC) Received: by wesq59 with SMTP id q59sf7976501wes.1 for ; Wed, 18 Mar 2015 08:39:15 -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=ZCx3231Hrdm3sTs4OBxiZWhzK9cbWNGgKzetS+W6c4lTL2JB/FfxIg8yQsXEOo8jH+ YmYlOko1YtMw4CUf/93jjbtcMId2M/HdYLha2tVzG6+WQ/svEoOqHs7pOgT870Gg9svJ +IzjwGFT83EixaUrG6qmlB1t4P6CZTKnAES/l+s7XgCa0yC3fh6j4+C/9ti0Y0qLozKz vRiCWFpYIqx1TmQyVR/YDmqTl1jtuBAW8DCUvqPjW3Z1ZfEVmASGOAcv3q87Bh0kjl2H QJM47niptqy6A/LQ8iAlEKvXQgN3lmJuDM5LF1VI46dNLOOqM1UvXAK6Wf5JfPklyZ3X 8g/w== X-Gm-Message-State: ALoCoQkXeNI5ZyT3cRvbn30q22Zmq5NioOCUcnvatnCorfRbrUojuSdDSF6OVjkeoeLTKK+WEgs8 X-Received: by 10.180.101.101 with SMTP id ff5mr878728wib.5.1426693155170; Wed, 18 Mar 2015 08:39:15 -0700 (PDT) X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.37.162 with SMTP id z2ls50330laj.75.gmail; Wed, 18 Mar 2015 08:39:14 -0700 (PDT) X-Received: by 10.152.179.139 with SMTP id dg11mr59129266lac.28.1426693154878; Wed, 18 Mar 2015 08:39:14 -0700 (PDT) Received: from mail-la0-f49.google.com (mail-la0-f49.google.com. [209.85.215.49]) by mx.google.com with ESMTPS id f4si13166204lbd.26.2015.03.18.08.39.14 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 18 Mar 2015 08:39:14 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.49 as permitted sender) client-ip=209.85.215.49; Received: by ladw1 with SMTP id w1so39354062lad.0 for ; Wed, 18 Mar 2015 08:39:14 -0700 (PDT) X-Received: by 10.112.212.106 with SMTP id nj10mr46016394lbc.36.1426693154627; Wed, 18 Mar 2015 08:39:14 -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 h5csp1235104lbj; Wed, 18 Mar 2015 08:39:13 -0700 (PDT) X-Received: by 10.66.121.161 with SMTP id ll1mr126334240pab.131.1426693152805; Wed, 18 Mar 2015 08:39:12 -0700 (PDT) Received: from bombadil.infradead.org (bombadil.infradead.org. [2001:1868:205::9]) by mx.google.com with ESMTPS id qn11si36728162pdb.229.2015.03.18.08.39.11 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 18 Mar 2015 08:39:12 -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 1YYG1o-0004QL-HZ; Wed, 18 Mar 2015 15:37:04 +0000 Received: from mail-we0-f173.google.com ([74.125.82.173]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1YYFO6-0003Mv-Bw for linux-arm-kernel@lists.infradead.org; Wed, 18 Mar 2015 14:56:03 +0000 Received: by wetk59 with SMTP id k59so34392854wet.3 for ; Wed, 18 Mar 2015 07:55:39 -0700 (PDT) X-Received: by 10.194.6.228 with SMTP id e4mr140924112wja.63.1426690539558; Wed, 18 Mar 2015 07:55:39 -0700 (PDT) Received: from ards-macbook-pro.local ([84.78.25.113]) by mx.google.com with ESMTPSA id y14sm24826582wjr.39.2015.03.18.07.55.37 (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Wed, 18 Mar 2015 07:55:38 -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 v5 2/8] arm64: add macros for common adrp usages Date: Wed, 18 Mar 2015 15:55:21 +0100 Message-Id: <1426690527-14258-3-git-send-email-ard.biesheuvel@linaro.org> X-Mailer: git-send-email 1.8.3.2 In-Reply-To: <1426690527-14258-1-git-send-email-ard.biesheuvel@linaro.org> References: <1426690527-14258-1-git-send-email-ard.biesheuvel@linaro.org> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20150318_075602_614321_564B3B61 X-CRM114-Status: UNSURE ( 8.90 ) 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.173 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.173 listed in wl.mailspike.net] -0.0 RCVD_IN_MSPIKE_WL Mailspike good senders Cc: marc.zyngier@arm.com, 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.49 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 */