From nobody Wed Nov 15 18:12:20 2023 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 4SVrq93p3vz50Zck; Wed, 15 Nov 2023 18:12:21 +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 4SVrq90365z4N40; Wed, 15 Nov 2023 18:12:21 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1700071941; 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=3Wb7pzDPyaODOrwuJt3H/6A8s/reJLUP9tAqUy7vtxk=; b=Ul4XXQX+5GfOTkorLxePCQd68CWlYTBBEnydMjmn+8O/cIPAbEPmOonOVnNvidnDhMwRJQ 0Fie8JcPANube48r/o3ujC2MS9Gg1miu1GPXXXQ/jh9BuGd4lhvnRD3AM68yP8ddlheYD6 8YYczV8JOI7B2EWCaBTIwssZhw5z7XQQYGeGoepXSxldxHCRBXTt7GBF0EccMjvUD7rF7q 2DCguaZf87oJGxij4mCzTVq6PmVrWqYW80fv6xieQ/E6OUc8tI3FmZG/3voSCJFls3ymtg W+nrAdPh6ANTkytqqpTB+oaHm2ztoeUBNKTET2ZikYi13oaHhbvkBogUXYFh3A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1700071941; 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=3Wb7pzDPyaODOrwuJt3H/6A8s/reJLUP9tAqUy7vtxk=; b=VHTB3M27if/M9jl5y9reDlrYQvhYKCR54Er9h4Z+JBRFEO1VJhpSAlZiUrshMJatgjeOLE qaj5rqsAEBTeWOXF6rK3IKImYn2mDhicrDevqE9yYI5jROQGMSDHocg7TuneTKTcSMuGn7 oQpXZ5ikXl11xtOli7cVWhzwg+uieB2nCeD8BpGNVhB0okNiGPrRAYjrxSNhZZqAiIUrzE dwhI8PLOHQJwzN9nbyreSPIB7OnvgTxtcf1KOTkoAW/aGA/sVqzBVr3XvUuZTevXA+h3Df nKxZBcJzIu9JJEVJigWpFAIxG0H6TmuSOIWz3tvUymCX9qJdMhfwA8M/yHt/UQ== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1700071941; a=rsa-sha256; cv=none; b=ZOQxJW2DyURMQ+mLLNMphi58XuLOeEXHClS83Tm5an/11KceJq5KV03Rp21FBQHBKGVsdq 63MtMKIDnOY/6Pt4vBKacDaIblh1ZRbnqz10HqSqD8IDEuXkMFRsE368Vnttzu9zKynv4u DpIOwQQjpBCXRHsE0vCDCFphrO6hFs2azuS+hvcn/+lgNZS+dgTpOtvcmkOPTgETqR4yCo G9iDvsQjosfJ/OqqLjGl0XH4TO+ydXXfR3gMjgRmz4NJYKxQrjC9QtEDkuXM6ZHIDNh5Cs 3epA7NqkY8Xi9X0l5ylKs7HhaLWAkmSerwPeXsenJfrHSgzOdObY6/y2cgL4AA== 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 4SVrq86GwNzCJN; Wed, 15 Nov 2023 18:12:20 +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 3AFICKSO077522; Wed, 15 Nov 2023 18:12:20 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 3AFICKgF077519; Wed, 15 Nov 2023 18:12:20 GMT (envelope-from git) Date: Wed, 15 Nov 2023 18:12:20 GMT Message-Id: <202311151812.3AFICKgF077519@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Andrew Turner Subject: git: 61f14f1da37b - main - 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/main X-Git-Reftype: branch X-Git-Commit: 61f14f1da37b4e6db8f9efe40c6b544c855fb9bd Auto-Submitted: auto-generated The branch main has been updated by andrew: URL: https://cgit.FreeBSD.org/src/commit/?id=61f14f1da37b4e6db8f9efe40c6b544c855fb9bd commit 61f14f1da37b4e6db8f9efe40c6b544c855fb9bd Author: Andrew Turner AuthorDate: 2023-11-13 15:39:06 +0000 Commit: Andrew Turner CommitDate: 2023-11-15 18:05:08 +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 --- sys/arm64/arm64/locore.S | 18 +++++------------- 1 file changed, 5 insertions(+), 13 deletions(-) diff --git a/sys/arm64/arm64/locore.S b/sys/arm64/arm64/locore.S index cea2f690b60f..ffd13610ec02 100644 --- a/sys/arm64/arm64/locore.S +++ b/sys/arm64/arm64/locore.S @@ -359,21 +359,13 @@ LEND(drop_to_el1) * Get the physical address the kernel was loaded at. */ LENTRY(get_load_phys_addr) + /* Load the offset of get_load_phys_addr from KERNBASE */ + ldr x28, =(get_load_phys_addr - KERNBASE) /* 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 + 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) /*