From nobody Thu May 25 20:41:32 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 4QS0Mc37N7z4Wgs8; Thu, 25 May 2023 20:41:32 +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 4QS0Mc2b1Nz4Nw6; Thu, 25 May 2023 20:41:32 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1685047292; 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=7q4ZpRNDNU4qlRkELXe8ts2bnT5+o8gDyMbWBBLqWH4=; b=XbUwJZWd9YgS3jxfzXPGTjo2tRqXSIfpMn+bCIHZPHR/kwxsrH+aYechOLUg0vZ+sOuHuE KZXe9d2Y6bRo9+ei86HygBpjIMaKUi2gFxx2MxDJFqa1iybFTgNKV13t9v5s3qeSaX1PeY y4H1GafLitMsnI9jPvoeFqNdnhk/cFH6C5HS10b8UBhxoysAz6p7HMVztR+l288WxMO6Xm JGZRSume1jTJeWxqWNOQfYWpa9OPYtDUnBQZlmPTkTg9tdlVGK9a1Hz14dyjD4xtb6jh69 WGxwfA4d7TJG+rpj3sUnyZbPvT73z60Y5eG/M6j089JpX0BV27tAmvQOjuc3NQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1685047292; 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=7q4ZpRNDNU4qlRkELXe8ts2bnT5+o8gDyMbWBBLqWH4=; b=iUJKTeiSod/OIXAgD7jhhuZDqCH+we90GzAexp8nu7IUb6ZS1my3BLBOmSo0TAjpuOv0qp cGOFNdnj9If86NG8EDq/WzFYl/MPbGT5J1xZ4DCxBN4ubvWv0mzJoQPxOYM8pCFRAOE/rh HbQB/COze6/rSbS8TRC7q/Xb8568JnBpy9FLJdQofxVhCqPn/VtUMOLsRKYppUjTdJU5H3 6uZYUFOZUr+kP9VKGKjXzeM2PAL1Nbjb9oaHv/fty893dS+QxLppfmPGTyy7hSvphYC8AN uK2YGEmH4lqGohzaKW9WRPRx+/2uQQA+sh4iNWRKPQMHI+r+mspKTDBnexPWaA== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1685047292; a=rsa-sha256; cv=none; b=xWUV7l79ahKJJHboiEf31WhAdh3R6itOUXcsFk/Wsj88v3VgI2xvNrqfCRlQDaQZLMqR2n qllZlC3my+JPOV8Rzpftu0tTa2rDgIV3vQPCoNYZ8O/QC5abc66KAMb/mYDaBFO6+JGjlZ Q9M4cpesUbMtl82sNH4FwlxUeGwfIlNO7+dYRHFiju7p54t2aAOCmd06leM8qzoWnECWXa N3xFm+dtNBMaolpCumVqYfkv5dZLoRqcPWUMBJI2eH3j1l7WnxL07G0lF2IOnLyTO5Q4CP p0AXgf8gEvhFC4DOB5WlUucjGRXnSJamYohSLQG735lVLqowI+cWr2/ucy0oqQ== 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 4QS0Mc1fjwzfYn; Thu, 25 May 2023 20:41:32 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 34PKfWTF086024; Thu, 25 May 2023 20:41:32 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 34PKfWd7086008; Thu, 25 May 2023 20:41:32 GMT (envelope-from git) Date: Thu, 25 May 2023 20:41:32 GMT Message-Id: <202305252041.34PKfWd7086008@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Christos Margiolis Subject: git: 855ade9e722a - main - kinst: be explicit about trampoline placement 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: christos X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 855ade9e722a5c3f7363f5f78798bdfedadb1005 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by christos: URL: https://cgit.FreeBSD.org/src/commit/?id=855ade9e722a5c3f7363f5f78798bdfedadb1005 commit 855ade9e722a5c3f7363f5f78798bdfedadb1005 Author: Christos Margiolis AuthorDate: 2023-05-25 20:40:46 +0000 Commit: Christos Margiolis CommitDate: 2023-05-25 20:40:46 +0000 kinst: be explicit about trampoline placement The current implementation and comment was specific to amd64. Even though in the case of kinst's supported architectures (RISC-V and ARM64) VM_MIN_KERNEL_ADDRESS is equal to KERNBASE, it's better to be explicit. Reviewed by: markj Approved by: markj (mentor) Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D40266 --- sys/cddl/dev/kinst/trampoline.c | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/sys/cddl/dev/kinst/trampoline.c b/sys/cddl/dev/kinst/trampoline.c index 5575503f60fb..75efd022fb20 100644 --- a/sys/cddl/dev/kinst/trampoline.c +++ b/sys/cddl/dev/kinst/trampoline.c @@ -68,15 +68,22 @@ kinst_trampchunk_alloc(void) sx_assert(&kinst_tramp_sx, SX_XLOCKED); +#ifdef __amd64__ /* - * Allocate virtual memory for the trampoline chunk. The returned - * address is saved in "trampaddr". To simplify population of - * trampolines, we follow the amd64 kernel's code model and allocate - * them above KERNBASE, i.e., in the top 2GB of the kernel's virtual - * address space. Trampolines must be executable so max_prot must - * include VM_PROT_EXECUTE. + * To simplify population of trampolines, we follow the amd64 kernel's + * code model and allocate them above KERNBASE, i.e., in the top 2GB of + * the kernel's virtual address space (not the case for other + * platforms). */ trampaddr = KERNBASE; +#else + trampaddr = VM_MIN_KERNEL_ADDRESS; +#endif + /* + * Allocate virtual memory for the trampoline chunk. The returned + * address is saved in "trampaddr". Trampolines must be executable so + * max_prot must include VM_PROT_EXECUTE. + */ error = vm_map_find(kernel_map, NULL, 0, &trampaddr, KINST_TRAMPCHUNK_SIZE, 0, VMFS_ANY_SPACE, VM_PROT_ALL, VM_PROT_ALL, 0);