PMAP_EXTRACT(9)
π PMAP_EXTRACT(9) π
okay bestie, welcome to the Kernel Developer's Manual section 9, and today's main character is pmap_extract β the little guy who takes a virtual address and tells you which physical page it's living at. no cap. π¦
β¨ NAME β¨
pmap_extract, pmap_extract_and_hold β map a virtual address to a physical page
like, literally the whole job. address in, physical page out. slay. π
πΈ 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_paddr_t
pmap_extract_and_hold(pmap_t pmap, vm_offset_t va, vm_prot_t prot);
so you gotta pull in all three of those headers first β sys/param.h, vm/vm.h, and vm/pmap.h β and then you've got two functions to play with, both handing back a vm_paddr_t. π
π«Ά DESCRIPTION π«Ά
So the pmap_extract() function maps a virtual address to a physical page. that's it, that's the vibe. β¨
But in certain situations, callers may use pmap_extract_and_hold() instead β and the reason you'd do that is to make sure the returned page is held. π₯
The pmap_extract_and_hold() function maps a virtual address to a physical page and atomically holds the returned page for use by the caller β but only if the mapping permits the given page protection. it's giving responsible. it's giving "i checked first". periodt. π
π IMPLEMENTATION NOTES π
ngl, currently the page protection requested by the caller is not verified. the prot argument is just... there. living its life. π
β RETURN VALUES β
okay so here's the tea on what you actually get back:
pmap_extract()will return the physical page address associated with the virtual addressvainside the physical mappmap. π«§ and if the mapping does not exist, or if thepmapparameter isNULL, thenNULLwill be returned. no mapping, no address, that simple.pmap_extract_and_hold()will return the physical page address associated with the virtual addressvainside the physical mappmap. and if the mapping does not exist, the result is a no-op, andNULLwill be returned. π
so like, NULL is the answer in both failure modes. iconic consistency honestly. π
π SEE ALSO π
go read those next bestie, i'm serious, pmap(9) is required reading. π
π 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>. π
and that's the whole page, bestie!! this one's from the Debian crew, dated July 21, 2003 β ancient but still serving looks. go map some addresses, stay safe, and remember: if it returns NULL, that's not a personality flaw, that's just a missing mapping. π
β¨π¦
π¦ where this page comes from
- debian bookworm: freebsd-manpages 12.2-1 Β· BSD-2-Clause-FreeBSD AND BSD-4-Clause
- debian trixie: freebsd-manpages 12.2-2 Β· BSD-2-Clause-FreeBSD AND BSD-4-Clause
- ubuntu jammy: freebsd-manpages 12.2-1 Β· BSD-2-Clause-FreeBSD AND BSD-4-Clause
- ubuntu noble: freebsd-manpages 12.2-1 Β· BSD-2-Clause-FreeBSD AND BSD-4-Clause
- ubuntu questing: freebsd-manpages 12.2-2
- ubuntu resolute: freebsd-manpages 12.2-2build1 Β· BSD-2-Clause-FreeBSD AND BSD-4-Clause
- ubuntu stonking: freebsd-manpages 12.2-2build1 Β· BSD-2-Clause-FreeBSD AND BSD-4-Clause
- Copyright (c) 2003 Bruce M Simpson <bms@spc.org>
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms