PMAP_EXTRACT(9)
π PMAP_EXTRACT(9) π
ok so this is a page from the Kernel Developer's Manual bestie, and it's literally about turning virtual addresses into physical pages. no cap, it's giving "where does this actually live in RAM" main character energy π¦
β¨ NAME β¨
pmap_extract, pmap_extract_and_hold β map a virtual address to a physical page π
π SYNOPSIS π
#include <sys/param.h>
#include <vm/vm.h>
#include <vm/pmap.h>
vm_paddr_t
pmap_extract(pmap_t pmap, vm_offset_t va);
vm_page_t
pmap_extract_and_hold(pmap_t pmap, vm_offset_t va, vm_prot_t prot);
π DESCRIPTION π
okay so the pmap_extract() function maps a virtual address to a physical page. that's it. that's the whole vibe β¨
but sometimes β in certain situations β callers might wanna use pmap_extract_and_hold() instead, so they can make sure the returned page is actually held. it's giving "don't let it get away from you" energy π«Ά
and the pmap_extract_and_hold() function maps a virtual address to a physical page and atomically holds the returned page for the caller to use β but only if the mapping permits the given page protection. like, it's conditional bestie, it checks the vibe first π
π§ IMPLEMENTATION NOTES π§
lowkey important: currently, the page protection requested by the caller is not verified. so like, don't count on that check happening rn π
β RETURN VALUES β
the pmap_extract() function will return the physical page address associated with the virtual address va inside the physical map pmap. π―
if the mapping does not exist, or if the pmap parameter is NULL, then NULL will be returned. periodt π
the pmap_extract_and_hold() function will return the vm_page_t associated with the virtual address va inside the physical map pmap. if the mapping does not exist, the result is a no-op, and NULL will be returned. slay πΈ
ngl, both of these can hand you back NULL, so pls check. it's not mean, it's just careful π₯Ί
π₯ SEE ALSO π₯
iykyk π
π AUTHORS π
the pmap_extract_and_hold() function was implemented by Alan L. Cox <alc@imimic.com> π
this manual page was written by Bruce M Simpson <bms@spc.org> π
k bye bestie, this has been the Debian edition of your kernel dev manual, dated July 21, 2003 β yes it's vintage, yes it still ate, mwah ππ
π¦ where this page comes from
- freebsd 14.5: base 14.5
- freebsd 15.1: base 15.1
- nixpkgs unstable: source
- Copyright (c) 2003 Bruce M Simpson <bms@spc.org>
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms