Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 8 Oct 2021 06:11:12 GMT
From:      Kyle Evans <kevans@FreeBSD.org>
To:        src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org
Subject:   git: 438448dd9fb5 - stable/12 - Use adrp in the arm64 efi loader
Message-ID:  <202110080611.1986BCbD007745@gitrepo.freebsd.org>

next in thread | raw e-mail | index | archive | help
The branch stable/12 has been updated by kevans:

URL: https://cgit.FreeBSD.org/src/commit/?id=438448dd9fb50720cc289b63892c12b6c8c34e5f

commit 438448dd9fb50720cc289b63892c12b6c8c34e5f
Author:     Andrew Turner <andrew@FreeBSD.org>
AuthorDate: 2020-10-13 16:51:05 +0000
Commit:     Kyle Evans <kevans@FreeBSD.org>
CommitDate: 2021-10-08 05:24:27 +0000

    Use adrp in the arm64 efi loader
    
    On startup the arm64 efi loaders need to know PC-relative addresses.
    Previously we used the adr instruction to find this address, however this
    instruction is limited to +/- 1MiB.
    
    Switch to adrp to find the 4k page the address is within and an add to
    set the bottom 12 bits. This lets us address +/- 4GiB which should be
    large enough for now.
    
    (cherry picked from commit b9aa4537b2155a0b0bb419ff05b8da206c02bfbd)
---
 stand/efi/loader/arch/arm64/start.S | 15 ++++++++++-----
 1 file changed, 10 insertions(+), 5 deletions(-)

diff --git a/stand/efi/loader/arch/arm64/start.S b/stand/efi/loader/arch/arm64/start.S
index bddc2d088a64..675d4e153f36 100644
--- a/stand/efi/loader/arch/arm64/start.S
+++ b/stand/efi/loader/arch/arm64/start.S
@@ -142,8 +142,10 @@ _start:
 	/* Save the boot params to the stack */
 	stp	x0, x1, [sp, #-16]!
 
-	adr	x0, __bss_start
-	adr	x1, __bss_end
+	adrp	x0, __bss_start
+	add	x0, x0, :lo12:__bss_start
+	adrp	x1, __bss_end
+	add	x1, x1, :lo12:__bss_end
 
 	b 2f
 
@@ -153,8 +155,10 @@ _start:
 	cmp	x0, x1
 	b.lo	1b
 
-	adr	x0, ImageBase
-	adr	x1, _DYNAMIC
+	adrp	x0, ImageBase
+	add	x0, x0, :lo12:ImageBase
+	adrp	x1, _DYNAMIC
+	add	x1, x1, :lo12:_DYNAMIC
 
 	bl	self_reloc
 
@@ -165,7 +169,8 @@ _start:
 	 * Load the stack to use. The default stack may be too small for
 	 * the lua loader.
 	 */
-	adr	x2, initstack_end
+	adrp	x2, initstack_end
+	add	x2, x2, :lo12:initstack_end
 	mov	sp, x2
 #endif
 



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202110080611.1986BCbD007745>