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
This commit is contained in:
parent
5a7500dab9
commit
855ade9e72
@ -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);
|
||||
|
Loading…
Reference in New Issue
Block a user