From patchwork Mon Jul 22 21:39:41 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Julien Grall X-Patchwork-Id: 169432 Delivered-To: patch@linaro.org Received: by 2002:a92:4782:0:0:0:0:0 with SMTP id e2csp8012230ilk; Mon, 22 Jul 2019 14:41:14 -0700 (PDT) X-Google-Smtp-Source: APXvYqzS3CytD58dWQuXl1WLwcWGJFSdGohMW13sPxgtJmLx6e6HY3I0q22nt//LdmEnXCeUFufI X-Received: by 2002:a02:8814:: with SMTP id r20mr78582871jai.115.1563831674322; Mon, 22 Jul 2019 14:41:14 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1563831674; cv=none; d=google.com; s=arc-20160816; b=evRp61slAMarBRJafD1aSmszXI+wLVAtTmZ9aiD0fszE2BjNKxBiVJW1P5eXLkVWlk N+lQ/gAZfN+rkeq+WSAgAmHRd8EFjE6vx6ROXbtBdyK4cAsC1TvwdNCI7hqGqxLgCak2 zC4hOcsAQgEOPwsD01MxMdz5nTFDzwdHMg4clFGAh5Wh9T+egaPArA5IEfbmETnNvrVR ll56uWVShZksqMYHiyAZ/rOtpOPSkA4+qOzyFtN1Ii1Er9fQEytDfHDHoztOeNZgtt7Z ISQMauuGCZiwiMQTxCAD52VCY3IEIGVN8mVfW2GJOVNhFuFzHcbvZmm3XpiiULSgUOL1 3K8Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:mime-version:cc :list-subscribe:list-help:list-post:list-unsubscribe:list-id :precedence:subject:references:in-reply-to:message-id:date:to:from; bh=lyf46eoSzFBwiYqEBGeGYOcn5xdUw2+pj7rBwmcMRPc=; b=xUjBv1j0hUUpwbvv9I8pOfxNcW7uMvILtpkZVA3EwEEozsNR6wnernG0h1nskGoKMU N7DuGVky2XbI7h7T+7pu5h3df8r8yg8Bl9+Nvm6ttwgai9dluaCmDDq6d2B/1s6wQBrs be+nNe9z5WTTjt6otxV2vHCHIecz1+H1I2VVUM2Kcgbmd1tB+HyFKWpJzZVt7wmgcvCK 2LaDYUk/4YT1rLIhKYC1VEPLRLx0lFWmSKogTilwenJqkXV9K3jmJRn8N3I3oqyxbKZS IxsKw4UqwTOpn6p5HEH3kOy15V8mxqWDAk5iAZTjZzmXEWCFPemqJkX7Td20br86xnc0 DAPg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of xen-devel-bounces@lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org Return-Path: Received: from lists.xenproject.org (lists.xenproject.org. [192.237.175.120]) by mx.google.com with ESMTPS id n26si374643ioh.135.2019.07.22.14.41.14 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Mon, 22 Jul 2019 14:41:14 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of xen-devel-bounces@lists.xenproject.org designates 192.237.175.120 as permitted sender) client-ip=192.237.175.120; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of xen-devel-bounces@lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1hpg2i-0002l9-Qt; Mon, 22 Jul 2019 21:40:24 +0000 Received: from us1-rack-dfw2.inumbo.com ([104.130.134.6]) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1hpg2h-0002he-5u for xen-devel@lists.xenproject.org; Mon, 22 Jul 2019 21:40:23 +0000 X-Inumbo-ID: 4edd0f0b-acc9-11e9-8980-bc764e045a96 Received: from foss.arm.com (unknown [217.140.110.172]) by us1-rack-dfw2.inumbo.com (Halon) with ESMTP id 4edd0f0b-acc9-11e9-8980-bc764e045a96; Mon, 22 Jul 2019 21:40:22 +0000 (UTC) Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 18CA7344; Mon, 22 Jul 2019 14:40:22 -0700 (PDT) Received: from e108454-lin.cambridge.arm.com (e108454-lin.cambridge.arm.com [10.1.196.50]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 4BCDC3F71F; Mon, 22 Jul 2019 14:40:21 -0700 (PDT) From: Julien Grall To: xen-devel@lists.xenproject.org Date: Mon, 22 Jul 2019 22:39:41 +0100 Message-Id: <20190722213958.5761-19-julien.grall@arm.com> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20190722213958.5761-1-julien.grall@arm.com> References: <20190722213958.5761-1-julien.grall@arm.com> Subject: [Xen-devel] [PATCH v2 18/35] xen/arm64: head: Introduce a macro to get a PC-relative address of a symbol X-BeenThere: xen-devel@lists.xenproject.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Cc: Julien Grall , Stefano Stabellini , Volodymyr Babchuk MIME-Version: 1.0 Errors-To: xen-devel-bounces@lists.xenproject.org Sender: "Xen-devel" Arm64 provides instructions to load a PC-relative address, but with some limitations: - adr is enable to cope with +/-1MB - adrp is enale to cope with +/-4GB but relative to a 4KB page address Because of that, the code requires to use 2 instructions to load any Xen symbol. To make the code more obvious, introducing a new macro adr_l is introduced. The new macro is used to replace a couple of open-coded use in efi_xen_start. The macro is copied from Linux 5.2-rc4. Signed-off-by: Julien Grall Acked-by: Stefano Stabellini --- Changes in v2: - Patch added --- xen/arch/arm/arm64/head.S | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/xen/arch/arm/arm64/head.S b/xen/arch/arm/arm64/head.S index 9afd89d447..2287f3ce48 100644 --- a/xen/arch/arm/arm64/head.S +++ b/xen/arch/arm/arm64/head.S @@ -111,6 +111,18 @@ #endif /* !CONFIG_EARLY_PRINTK */ +/* + * Pseudo-op for PC relative adr , where is + * within the range +/- 4GB of the PC. + * + * @dst: destination register (64 bit wide) + * @sym: name of the symbol + */ +.macro adr_l, dst, sym + adrp \dst, \sym + add \dst, \dst, :lo12:\sym +.endm + /* Load the physical address of a symbol into xb */ .macro load_paddr xb, sym ldr \xb, =\sym @@ -886,11 +898,9 @@ ENTRY(efi_xen_start) * Flush dcache covering current runtime addresses * of xen text/data. Then flush all of icache. */ - adrp x1, _start - add x1, x1, #:lo12:_start + adr_l x1, _start mov x0, x1 - adrp x2, _end - add x2, x2, #:lo12:_end + adr_l x2, _end sub x1, x2, x1 bl __flush_dcache_area