PMAP_MAP(9)

πŸ’– PMAP_MAP(9) πŸ’–

okay bestie, welcome to the Kernel Developer's Manual page for pmap_map β€” yes it's a section 9 page, yes it's kernel-level, yes you're built different for being here 🫢


✨ NAME ✨

pmap_map β€” map a physical memory range into kernel virtual address (KVA) space 🌈


🌸 SYNOPSIS 🌸

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

vm_offset_t
pmap_map(vm_offset_t *virt, vm_paddr_t start, vm_paddr_t end, int prot);

πŸ‘‘ DESCRIPTION πŸ‘‘

so the pmap_map() function takes a range of physical addresses and maps them into kernel virtual address (KVA) space, going from start to end, with the protection bits you pass in as prot. literally doing the map thing. iconic behaviour only πŸ’…

and the value you put in *virt? that gets treated as a hint for the virtual address where the mapping should begin. it's giving "here's a suggestion, no pressure" energy ✨


🧚 IMPLEMENTATION NOTES 🧚

  • ngl, the prot argument is currently ignored by machine-dependent implementations. so yeah, it's there, it's in the signature, it's just... not being read rn πŸ™ˆ
  • architectures that can support a direct mapped physical to virtual region are allowed to just return the appropriate address inside that region, leaving *virt unchanged. no cap, they can just do that πŸ¦‹

πŸ’€ RETURN VALUES πŸ’€

if the mapping went through successfully, pmap_map() returns the virtual address of the beginning of the mapping β€” and *virt gets updated too, with the first usable address after the mapped region. two-for-one, we love to see it πŸ’–

if it doesn't work out? NULL is returned. that's it. that's the whole vibe. 😭


πŸ”₯ SEE ALSO πŸ”₯


πŸŽ€ AUTHORS πŸŽ€

this manual page was written by Bruce M Simpson <bms@spc.org>. absolute legend behaviour, ty for your service 🫢


and that's a wrap bestie!! this little beauty comes to you from Debian, dated July 21, 2003 β€” old but gold, fr fr. go map something responsibly πŸ’œβœ¨

πŸ“¦ where this page comes from