PMAP_EXTRACT(9)

πŸ“¦ version 15.1, in freebsd 14.5, freebsd 15.1, nixpkgs unstable

πŸ’… 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