aboutsummaryrefslogtreecommitdiff
path: root/sys/cddl
diff options
context:
space:
mode:
authorAndrew Turner <andrew@FreeBSD.org>2021-09-21 17:10:57 +0000
committerAndrew Turner <andrew@FreeBSD.org>2021-10-01 10:27:33 +0000
commit3d2533f5c29fbf6e63c5e408ba13c2294a7612fd (patch)
treedef4eba677accd7002a423f4332ad307db214938 /sys/cddl
parent7ec86b66099124a9c2c88613507a10979cb8b191 (diff)
downloadsrc-3d2533f5c29fbf6e63c5e408ba13c2294a7612fd.tar.gz
src-3d2533f5c29fbf6e63c5e408ba13c2294a7612fd.zip
Allow ddb and dtrace use the DMAP region on arm64
When writing to memory on arm64 we may be trying to be accessing a read-only page. In this case try to access via the DMAP region to get a writable location. While here simplify writing data in DDB and stop trashing the size as it is passed into the cache handling functions. Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D32053
Diffstat (limited to 'sys/cddl')
-rw-r--r--sys/cddl/dev/fbt/aarch64/fbt_isa.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/sys/cddl/dev/fbt/aarch64/fbt_isa.c b/sys/cddl/dev/fbt/aarch64/fbt_isa.c
index f9b99febe8d1..4d22f1d584d3 100644
--- a/sys/cddl/dev/fbt/aarch64/fbt_isa.c
+++ b/sys/cddl/dev/fbt/aarch64/fbt_isa.c
@@ -74,8 +74,12 @@ 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;
- *fbt->fbtp_patchpoint = val;
+ if (!arm64_get_writable_addr((vm_offset_t)fbt->fbtp_patchpoint, &addr))
+ panic("%s: Unable to write new instruction", __func__);
+
+ *(fbt_patchval_t *)addr = val;
cpu_icache_sync_range((vm_offset_t)fbt->fbtp_patchpoint, 4);
}