From nobody Fri Mar 15 17:10:41 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 4Tx9k96FNsz5Dn3p; Fri, 15 Mar 2024 17:10:41 +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 4Tx9k955J9z4mPT; Fri, 15 Mar 2024 17:10:41 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1710522641; 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=NTz7/I5ETGnsZOL5gO0A9Cv5+J2rg9qTRAtw4xeFPj8=; b=K7KT3d/LRAPKZtg87KDjeqia62dB0pLPm54+9QipGLIwep8E402+iAcTVGUBoUbVvPezu2 yd6CWeqDSEBSD30Tv/oNv5JO9c8brsL5BDuZwE71xh1eXrs1+LKb66Ip4NinG5Z8YLVm39 FvD6bEvcCDJ3cORZm9DxFtT2vOR1B0ZlvjHIu+Cl39FtQonXaz5NMXUt1qQMNHeYAbIVb0 WaZJ3OSWoYs6s6uBwRjq66par5D3QtYSX9mTrwoS3h4EK0ykNA3ai0SaI/8I/DipSkmaD4 W9u4XDPA5xkMEJRpp/LRS1KEBLLpw2BVMmU9+lLlRRnY6HVoCHA1Vak/1B/rbA== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1710522641; a=rsa-sha256; cv=none; b=jj0ZuQOrSEkGk3gj1wBgW+in0ITwNjg6tjWoPU9ePAzY+za4IOgBkIUKLGL77QvgxKebpJ YKBwP3cHEcZbtNWpKSyv7eaLOO2H97P/iK5NZyuB6/clozX1tiSVofalZIaZ//SduRdoM4 /UFuV50gvqFyxlpHA/ZT80a7w3F9o+buc3hx2sOO/mOW7uUYK8jJf9W+Mu3kaDJy+rbjKa pxGVY7F8kA70CmTPGtjQ33SpZASmXEg80Qv6o8duEnKHZg9V1rxWxGuvjaHh5aVztc4IvL tOmZTFh+dj115YaGNxDcfuxqgWP/dbpOHb45Jp47OA26clZR0uuGAHhqKYIdng== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1710522641; 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=NTz7/I5ETGnsZOL5gO0A9Cv5+J2rg9qTRAtw4xeFPj8=; b=xQWMpYpV84I51oa6CAlSoE9DuXY20+tlO11gLk7w4t7Ssui/CbVi+QGa0TciV61UitPPOo h2fzdCjpI2vfgCTD2NE1M8IWinU406iL1uuhY3MtvXr2tYsjnns9Nnzqp9aYv2Sq0j5ZCl YtL+ChxIqq/SSgtb5fCygDdNuc5ns9CYJ7jL0AuZ5+0kI+BjyyTIvUjDe6VSN+/8gI90nY w1gOIbu9TVMuosYHtzqTEq5jGsSVFf3bXgySyr7mAJGSBEUhMxk0YfKwNAWtnnRIZEEupu pxL5AMHCDEFE3TngEeAcuEMSYJuzfZVYSMKNC5oNTjWHMcolOKs8HefngF0aIQ== 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 4Tx9k94jh0zKc2; Fri, 15 Mar 2024 17:10:41 +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 42FHAfrK026271; Fri, 15 Mar 2024 17:10:41 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 42FHAfo6026268; Fri, 15 Mar 2024 17:10:41 GMT (envelope-from git) Date: Fri, 15 Mar 2024 17:10:41 GMT Message-Id: <202403151710.42FHAfo6026268@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: John Baldwin Subject: git: e48770de6831 - main - arm64: Use void pointers for arguments to arm64_get_writable_addr 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: jhb X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: e48770de6831dc152aaeb2c0b70fcfb2a346bb89 Auto-Submitted: auto-generated The branch main has been updated by jhb: URL: https://cgit.FreeBSD.org/src/commit/?id=e48770de6831dc152aaeb2c0b70fcfb2a346bb89 commit e48770de6831dc152aaeb2c0b70fcfb2a346bb89 Author: John Baldwin AuthorDate: 2024-03-15 17:10:24 +0000 Commit: John Baldwin CommitDate: 2024-03-15 17:10:24 +0000 arm64: Use void pointers for arguments to arm64_get_writable_addr No functional change, but this reduces diffs with CheriBSD downstream. Reviewed by: andrew Sponsored by: University of Cambridge, Google, Inc. Differential Revision: https://reviews.freebsd.org/D44344 --- sys/arm64/arm64/db_interface.c | 6 +++--- sys/arm64/arm64/machdep.c | 11 ++++++----- sys/arm64/include/cpufunc.h | 2 +- sys/cddl/dev/fbt/aarch64/fbt_isa.c | 4 ++-- sys/cddl/dev/kinst/aarch64/kinst_isa.c | 4 ++-- 5 files changed, 14 insertions(+), 13 deletions(-) diff --git a/sys/arm64/arm64/db_interface.c b/sys/arm64/arm64/db_interface.c index 1aaec9665550..79e81b210f49 100644 --- a/sys/arm64/arm64/db_interface.c +++ b/sys/arm64/arm64/db_interface.c @@ -155,7 +155,7 @@ int db_write_bytes(vm_offset_t addr, size_t size, char *data) { jmp_buf jb; - void *prev_jb; + void *prev_jb, *kaddr; char *dst; size_t i; int ret; @@ -163,7 +163,7 @@ db_write_bytes(vm_offset_t addr, size_t size, char *data) prev_jb = kdb_jmpbuf(jb); ret = setjmp(jb); if (ret == 0) { - if (!arm64_get_writable_addr(addr, &addr)) { + if (!arm64_get_writable_addr((void *)addr, &kaddr)) { ret = 1; } else { dst = (char *)addr; @@ -175,7 +175,7 @@ db_write_bytes(vm_offset_t addr, size_t size, char *data) * Ensure the I & D cache are in sync if we wrote * to executable memory. */ - cpu_icache_sync_range((void *)addr, (vm_size_t)size); + cpu_icache_sync_range(kaddr, size); } } (void)kdb_jmpbuf(prev_jb); diff --git a/sys/arm64/arm64/machdep.c b/sys/arm64/arm64/machdep.c index 2716182ca442..50b2cd15df3f 100644 --- a/sys/arm64/arm64/machdep.c +++ b/sys/arm64/arm64/machdep.c @@ -424,12 +424,12 @@ init_proc0(vm_offset_t kstack) * read-only, e.g. to patch kernel code. */ bool -arm64_get_writable_addr(vm_offset_t addr, vm_offset_t *out) +arm64_get_writable_addr(void *addr, void **out) { vm_paddr_t pa; /* Check if the page is writable */ - if (PAR_SUCCESS(arm64_address_translate_s1e1w(addr))) { + if (PAR_SUCCESS(arm64_address_translate_s1e1w((vm_offset_t)addr))) { *out = addr; return (true); } @@ -437,7 +437,7 @@ arm64_get_writable_addr(vm_offset_t addr, vm_offset_t *out) /* * Find the physical address of the given page. */ - if (!pmap_klookup(addr, &pa)) { + if (!pmap_klookup((vm_offset_t)addr, &pa)) { return (false); } @@ -445,8 +445,9 @@ arm64_get_writable_addr(vm_offset_t addr, vm_offset_t *out) * If it is within the DMAP region and is writable use that. */ if (PHYS_IN_DMAP(pa)) { - addr = PHYS_TO_DMAP(pa); - if (PAR_SUCCESS(arm64_address_translate_s1e1w(addr))) { + addr = (void *)PHYS_TO_DMAP(pa); + if (PAR_SUCCESS(arm64_address_translate_s1e1w( + (vm_offset_t)addr))) { *out = addr; return (true); } diff --git a/sys/arm64/include/cpufunc.h b/sys/arm64/include/cpufunc.h index 1903af965a68..ba712f48b262 100644 --- a/sys/arm64/include/cpufunc.h +++ b/sys/arm64/include/cpufunc.h @@ -191,7 +191,7 @@ int arm64_icache_sync_range_checked(void *, vm_size_t); void arm64_dcache_wbinv_range(void *, vm_size_t); void arm64_dcache_inv_range(void *, vm_size_t); void arm64_dcache_wb_range(void *, vm_size_t); -bool arm64_get_writable_addr(vm_offset_t, vm_offset_t *); +bool arm64_get_writable_addr(void *, void **); #endif /* _KERNEL */ #endif /* _MACHINE_CPUFUNC_H_ */ diff --git a/sys/cddl/dev/fbt/aarch64/fbt_isa.c b/sys/cddl/dev/fbt/aarch64/fbt_isa.c index 30117202f8e7..4f6d28c2f32b 100644 --- a/sys/cddl/dev/fbt/aarch64/fbt_isa.c +++ b/sys/cddl/dev/fbt/aarch64/fbt_isa.c @@ -71,9 +71,9 @@ fbt_invop(uintptr_t addr, struct trapframe *frame, uintptr_t rval) void fbt_patch_tracepoint(fbt_probe_t *fbt, fbt_patchval_t val) { - vm_offset_t addr; + void *addr; - if (!arm64_get_writable_addr((vm_offset_t)fbt->fbtp_patchpoint, &addr)) + if (!arm64_get_writable_addr(fbt->fbtp_patchpoint, &addr)) panic("%s: Unable to write new instruction", __func__); *(fbt_patchval_t *)addr = val; diff --git a/sys/cddl/dev/kinst/aarch64/kinst_isa.c b/sys/cddl/dev/kinst/aarch64/kinst_isa.c index 0e5d5eee2979..20ca26219a55 100644 --- a/sys/cddl/dev/kinst/aarch64/kinst_isa.c +++ b/sys/cddl/dev/kinst/aarch64/kinst_isa.c @@ -235,9 +235,9 @@ kinst_invop(uintptr_t addr, struct trapframe *frame, uintptr_t scratch) void kinst_patch_tracepoint(struct kinst_probe *kp, kinst_patchval_t val) { - vm_offset_t addr; + void *addr; - if (!arm64_get_writable_addr((vm_offset_t)kp->kp_patchpoint, &addr)) + if (!arm64_get_writable_addr(kp->kp_patchpoint, &addr)) panic("%s: Unable to write new instruction", __func__); *(kinst_patchval_t *)addr = val; cpu_icache_sync_range(kp->kp_patchpoint, INSN_SIZE);