PMAP(9)

πŸ’– PMAP(9) β€” bestie edition πŸ’–

the kernel developer's manual, but make it cute 🌸

okay so you're reading the pmap page from the Kernel Developer's Manual β€” welcome to the machine-dependent side of the house, bestie, it's giving ✨hardware✨ and honestly? iconic.


✨ NAME ✨

pmap β€” machine-dependent portion of virtual memory subsystem πŸ§ πŸ’Ύ


🌈 SYNOPSIS 🌈

#include <sys/param.h>
#include <vm/vm.h>
#include <vm/pmap.h>

like, that's it. that's the vibe. include these and go be a kernel dev πŸ’…


πŸ‘‘ DESCRIPTION πŸ‘‘

okay so. the pmap module is the machine-dependent portion of the FreeBSD VM (Virtual Memory) sub-system. no cap. and here's the tea: every single function documented in this whole pmap saga has to have its own architecture-dependent implementation. like, you can't just copy-paste and call it a day, every architecture does its own thing and that's valid 🫢

the pmap module is responsible for managing hardware-dependent objects such as page tables, address maps, TLBs, etc. so basically all the stuff the hardware is ✨particular✨ about.

machine-dependent code must provide the header file <machine/pmap.h>. must. as in, non-negotiable, periodt. this file contains the definition of the pmap structure:

struct pmap {
        /* Contents defined by pmap implementation. */
};
typedef struct pmap *pmap_t;

so yeah, the contents are defined by the pmap implementation β€” that's your job, bestie, the struct is a ✨blank canvas✨ 🎨

this header file may also define other data structures used by the pmap implementation. go off, honestly.

the header file <vm/pmap.h> defines a structure for tracking pmap statistics (peep below πŸ‘‡). this structure is defined as:

struct pmap_statistics {
        long        resident_count; /* number of mapped pages */
        long        wired_count;    /* number of wired pages */
};

so like β€” resident_count is the number of mapped pages, wired_count is the number of wired pages. two longs, two jobs, they ate πŸ”₯

the implementation's struct pmap must contain an instance of this structure having the name pm_stats, and it must be updated by the implementation after each relevant pmap operation. like, the pm_stats name? not a suggestion. not a nickname. it's the name. and keeping it updated is the whole point, so don't be out here leaving stale stats, that's πŸ’€ behavior.


πŸ¦‹ SEE ALSO πŸ¦‹

the whole friend group, in order, as the original presents them:


πŸŽ€ AUTHORS πŸŽ€

this manual page was written by Bruce M Simpson <bms@spc.org>. king behavior, truly πŸ‘‘ thank you for your service πŸ«‘πŸ’–


and that's the page, bestie ✨ go manage some page tables, you're literally the main character of the VM subsystem πŸ’…πŸŒˆ

sign-off: this one came from the Debian edition, dated August 30, 2016 β€” so yeah, it's got that vintage-but-still-slaying energy πŸŽ€ sending love from the PMAP(9) corner of the manual, mwah πŸ’–

πŸ“¦ where this page comes from