PMAP_KEXTRACT(9)
okay so this is a page from the Kernel Developer's Manual β yep, PMAP_KEXTRACT(9) β and it's all about pmap_kextract and vtophys, the functions that extract a physical address from the kernel page table. bestie, let's get into it π
πΈ NAME πΈ
pmap_kextract, vtophys β extract a physical address from the kernel page table, periodt β¨
π SYNOPSIS π
#include <sys/param.h>
#include <vm/vm.h>
#include <vm/pmap.h>
vm_paddr_t
pmap_kextract(vm_offset_t va);
vm_paddr_t
vtophys(vm_offset_t va);
π¦ DESCRIPTION π¦
pmap_kextract() is the main character here: it retrieves the underlying physical memory address corresponding to the given kernel virtual address va. π
but bestie, listen β the caller is responsible for ensuring that va belongs to a valid mapping in the kernel address space. no vibes-based checking, okay? the returned physical address is only meaningful as long as the mapping remains stable, so the caller must also have some knowledge or guarantee of the mapping's lifetime. for example, it is invalid to call pmap_kextract() with the address of a malloc'd object while there is a possibility for that object to be freed concurrently. that's a no-no π«
Unlike pmap_extract(9), pmap_kextract() is safe to be called from any context β it has no internal locking or sleep. slay π«Ά
vtophys() is an alias for pmap_kextract() and behaves identically. literal twins π―
π RETURN VALUES π
pmap_kextract()β returns the physical address of memory mapped at the kernel virtual addressvaπ«pmap_kextract()β generally does not fail. however, if supplied with an illegitimate value forva, the function may return zero, an invalid non-zero value, or callpanic(9). π so yeah, keepvalegit.
π₯ SEE ALSO π₯
π AUTHORS π
This manual page was written by Mina GaliΔ <FreeBSD@igalic.co>, based on the pmap_extract(9) page written by Bruce M Simpson <bms@spc.org>. give them their flowers π
and that's a wrap, bestie β this one's from Debian, dated October 16, 2023, and the page is PMAP_KEXTRACT(9). mwah πβ¨
π¦ where this page comes from
- freebsd 15.1: base 15.1
- nixpkgs unstable: source
- π the page's license: BSD-2-Clause
- Copyright (c) 2023 The FreeBSD Foundation
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms