From owner-svn-src-head@freebsd.org Tue Oct 13 16:51:06 2020 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 2115C446280; Tue, 13 Oct 2020 16:51:06 +0000 (UTC) (envelope-from andrew@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4C9hQ207HWz3g1j; Tue, 13 Oct 2020 16:51:06 +0000 (UTC) (envelope-from andrew@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id DD698207C9; Tue, 13 Oct 2020 16:51:05 +0000 (UTC) (envelope-from andrew@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 09DGp53q094223; Tue, 13 Oct 2020 16:51:05 GMT (envelope-from andrew@FreeBSD.org) Received: (from andrew@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 09DGp514094222; Tue, 13 Oct 2020 16:51:05 GMT (envelope-from andrew@FreeBSD.org) Message-Id: <202010131651.09DGp514094222@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: andrew set sender to andrew@FreeBSD.org using -f From: Andrew Turner Date: Tue, 13 Oct 2020 16:51:05 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r366670 - head/stand/efi/loader/arch/arm64 X-SVN-Group: head X-SVN-Commit-Author: andrew X-SVN-Commit-Paths: head/stand/efi/loader/arch/arm64 X-SVN-Commit-Revision: 366670 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 13 Oct 2020 16:51:06 -0000 Author: andrew Date: Tue Oct 13 16:51:05 2020 New Revision: 366670 URL: https://svnweb.freebsd.org/changeset/base/366670 Log: 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. Reported by: imp MFC after: 2 weeks Sponsored by: Innovate UK Modified: head/stand/efi/loader/arch/arm64/start.S Modified: head/stand/efi/loader/arch/arm64/start.S ============================================================================== --- head/stand/efi/loader/arch/arm64/start.S Tue Oct 13 16:19:21 2020 (r366669) +++ head/stand/efi/loader/arch/arm64/start.S Tue Oct 13 16:51:05 2020 (r366670) @@ -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