git: 73a78b5efa73 - main - kinst: Clarify a comment in the trampoline allocator
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Fri, 14 Oct 2022 15:33:41 UTC
The branch main has been updated by markj:
URL: https://cgit.FreeBSD.org/src/commit/?id=73a78b5efa737f53c81b37926476757b28888e54
commit 73a78b5efa737f53c81b37926476757b28888e54
Author: Mark Johnston <markj@FreeBSD.org>
AuthorDate: 2022-10-14 15:17:12 +0000
Commit: Mark Johnston <markj@FreeBSD.org>
CommitDate: 2022-10-14 15:32:47 +0000
kinst: Clarify a comment in the trampoline allocator
Fixes: f0bc4ed144fc ("kinst: Initial revision")
---
sys/cddl/dev/kinst/trampoline.c | 9 +++++----
1 file changed, 5 insertions(+), 4 deletions(-)
diff --git a/sys/cddl/dev/kinst/trampoline.c b/sys/cddl/dev/kinst/trampoline.c
index 094b055f1b14..2749fe7144a2 100644
--- a/sys/cddl/dev/kinst/trampoline.c
+++ b/sys/cddl/dev/kinst/trampoline.c
@@ -58,10 +58,11 @@ kinst_trampchunk_alloc(void)
/*
* Allocate virtual memory for the trampoline chunk. The returned
- * address is saved in "trampaddr".
- *
- * Setting "trampaddr" to KERNBASE causes vm_map_find() to return an
- * address above KERNBASE, so this satisfies both requirements.
+ * 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.
*/
trampaddr = KERNBASE;
error = vm_map_find(kernel_map, NULL, 0, &trampaddr,