From nobody Mon Feb 19 16:45:30 2024 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4TdpLg2Dllz5C9GG; Mon, 19 Feb 2024 16:45:31 +0000 (UTC) (envelope-from git@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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4TdpLf6Zpbz4cD0; Mon, 19 Feb 2024 16:45:30 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1708361130; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=ljeSXx62t4QDqpt59qybtBAzNqwDL5ms9Acgw1+M21M=; b=EICl4nkX+7Oi73tY5i1LnuZVP7qCxHbWtOowK059X++OkHPJGKSMXTSHdVwt6dh2S2s1Fk 0rNYaxBlUMdf6wm6xAuPV9em7+gVD14clSbnISgO5xrAJD552eUC6w3FiWEhYeKYTjW4e0 AjhO7/gQtA5kEMDwpKVHHySy69QVLoxFoQKjzY2kMeTp4JUyx9Q44dfzvfzd7IdZydliW2 VA1C4YTHBffPShQ8ENN1j8AT/w1nWeiQx2CwDhXErzNMIoeAhWvM5a2mzIJ5KpNJHUoTkJ n2XjNm9qq3HMXngw9cR3vFGk52knz9SdNufp/bLUgaTeka25hWE2SBbH0cFfgw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1708361130; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=ljeSXx62t4QDqpt59qybtBAzNqwDL5ms9Acgw1+M21M=; b=btfMF7D3/aJUbaYHGW6Q96HI3es+xJmvkd2/7Npy2sMkUq+WU6NyULfvUHnQUIG9683Y/9 /OLH7n6H1lspiDGpIXNaE7StJbkMnv2J+15KXToj5qJzHkr41QxqcQ4dPVlmMUtJlqGca7 cVOAAR0k7AlZ9Qgu4R1JFLYplQt6h2x9dyuNQNFyDnSJXcXLH6qgZ3/RQdWegWEDL0MnJY c/Kw/s8bHf3uQSW5QEFOgi5N9UpUBnnEvDJcjdEO9IRtNiztmQyz8LZhg2OzM0SMc5T6J/ X1EqyMTpjFtpvXepAgPNkRK1tiUN2zSYFKV4PvQp1H8JDusmyP3eYXdo15RzIg== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1708361130; a=rsa-sha256; cv=none; b=eVu2CjQo6sMD55KQTZ/85EYiCXyftxZ6xhD+PyII928iNUttwPNZLguPQTnskSOcp0MZUO hXwAR7xzRn6pNYl/eyxqrCWDlia29OIkzWD1M41Jc4JCe9i3R/W+weprk6r3QEUOPE6+l/ 8YtUvQAAfUURNOkdIisj1Ws1SCP+IubAUYg1ARZ7XzfJ3CWHuXLszn/EdRH75auytoTuX6 /bndlrx5S8cLzAsh0P/dfQCrfkRprVm63B6HBwMltIjL8auBy2iJaLB672RyANcUx25ns9 DVMBQAUVoELX3Cq79zU4oPGM6o4khlt2IkM268z3IO6vnMxYVE5TIvfT9z7Upg== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (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 did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4TdpLf5WblzjST; Mon, 19 Feb 2024 16:45:30 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.17.1/8.17.1) with ESMTP id 41JGjURZ096582; Mon, 19 Feb 2024 16:45:30 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 41JGjUkn096579; Mon, 19 Feb 2024 16:45:30 GMT (envelope-from git) Date: Mon, 19 Feb 2024 16:45:30 GMT Message-Id: <202402191645.41JGjUkn096579@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Andrew Turner Subject: git: 54cf1499a33a - stable/14 - arm64: Clean up finding our load address List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: andrew X-Git-Repository: src X-Git-Refname: refs/heads/stable/14 X-Git-Reftype: branch X-Git-Commit: 54cf1499a33af463c656a2fb6555cfb5a1f2afa0 Auto-Submitted: auto-generated The branch stable/14 has been updated by andrew: URL: https://cgit.FreeBSD.org/src/commit/?id=54cf1499a33af463c656a2fb6555cfb5a1f2afa0 commit 54cf1499a33af463c656a2fb6555cfb5a1f2afa0 Author: Andrew Turner AuthorDate: 2023-11-13 15:39:06 +0000 Commit: Andrew Turner CommitDate: 2024-02-19 13:17:18 +0000 arm64: Clean up finding our load address Use the linker to pre-calculate the offset of a known symbol from KERNBASE, and use this to find the physical address KERNBASE should map to. Sponsored by: Arm Ltd Differential Revision: https://reviews.freebsd.org/D42568 (cherry picked from commit 61f14f1da37b4e6db8f9efe40c6b544c855fb9bd) (cherry picked from commit 257b04454818c80d9b85a840e3ea8db1ea891265) --- sys/arm64/arm64/locore.S | 20 ++++++-------------- 1 file changed, 6 insertions(+), 14 deletions(-) diff --git a/sys/arm64/arm64/locore.S b/sys/arm64/arm64/locore.S index ee3404958789..f7e0b4023aed 100644 --- a/sys/arm64/arm64/locore.S +++ b/sys/arm64/arm64/locore.S @@ -365,21 +365,13 @@ LEND(drop_to_el1) * Get the physical address the kernel was loaded at. */ LENTRY(get_load_phys_addr) - /* Load the physical address of virt_map */ - adrp x29, virt_map - add x29, x29, :lo12:virt_map - /* Load the virtual address of virt_map stored in virt_map */ - ldr x28, [x29] - /* Find PA - VA as PA' = VA' - VA + PA = VA' + (PA - VA) = VA' + x29 */ - sub x29, x29, x28 - /* Find the load address for the kernel */ - mov x28, #(KERNBASE) - add x28, x28, x29 + /* Load the offset of get_load_phys_addr from KERNBASE */ + ldr x28, =(get_load_phys_addr - KERNBASE) + /* Load the physical address of get_load_phys_addr */ + adr x29, get_load_phys_addr + /* Find the physical address of KERNBASE, i.e. our load address */ + sub x28, x29, x28 ret - - .align 3 -virt_map: - .quad virt_map LEND(get_load_phys_addr) /*