PMAP(9)

πŸ“¦
version 15.1 Β· 4 versions
, in freebsd 15.1, nixpkgs unstable

🌸 NAME 🌸

okay so bestie, meet pmap β€” the machine-dependent portion of the virtual memory subsystem. it's PMAP(9) from the Kernel Developer's Manual, and it's basically the part of the VM system that has to actually talk to your specific CPU. no cap. πŸ’…


✨ SYNOPSIS ✨

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

πŸ¦‹ DESCRIPTION πŸ¦‹

so the pmap module is the machine-dependent portion of the FreeBSD VM (Virtual Memory) sub-system. every single function documented in these pages has to have its own architecture-dependent implementation β€” like, no sharing, no copy-paste shortcuts, each arch does its own thing. periodt. πŸ’–

the pmap module is responsible for managing hardware-dependent objects such as page tables, address maps, TLBs, etc. yes, all the scary low-level stuff. she's got main character energy fr fr. πŸ”₯

machine-dependent code must provide the header file <machine/pmap.h>. this file contains the definition of the pmap structure:

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

this header file may also define other data structures used by the pmap implementation. so like, it's not a one-struct situation, it can bring friends. 🫢

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

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

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. not optional, bestie β€” if you forget to keep pm_stats updated, that's a vibe check you will fail. 😭

lowkey important: resident_count is the number of mapped pages, wired_count is the number of wired pages, and both live inside that one struct instance named pm_stats.

πŸ”— SEE ALSO πŸ”—

the whole friend group, in order, no skips (iykyk):


πŸ‘‘ AUTHORS πŸ‘‘

this manual page was written by Bruce M Simpson <bms@spc.org>. iconic. πŸ’œ


and that's the whole page, bestie β€” this one's from Debian, dated January 12, 2024. go forth and manage those hardware-dependent objects. slay. πŸŽ€βœ¨πŸ¦‹

πŸ“¦ where this page comes from