PMAP_COPY(9)

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

πŸ’… PMAP_COPY(9) β€” the one where we copy physical memory pages

okay so bestie, welcome to PMAP_COPY(9) from the Kernel Developer's Manual πŸ’– this is the page that explains pmap_copy and pmap_copy_page, two little functions that copy physical memory pages around. sound scary? it's not, i promise. let's get into it ✨


🌸 NAME

pmap_copy, pmap_copy_page β€” copy physical memory pages πŸŽ€


πŸ¦‹ SYNOPSIS

first things first, you gotta include these headers or nothing works, okay? periodt.

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

then there's the two function signatures, exactly like this:

void
pmap_copy(pmap_t dst_pmap, pmap_t src_pmap, vm_offset_t dst_addr,
    vm_size_t len, vm_offset_t src_addr);

void
pmap_copy_page(vm_page_t src, vm_page_t dst);

both of them return void, so like… no return value to obsess over. they just do the thing πŸ’…


✨ DESCRIPTION

okay so pmap_copy() copies the range that src_addr and len describe β€” going from the source physical map src_pmap over to the destination physical map dst_pmap, landing at the address dst_addr. lowkey straightforward, highkey important 🫢

and pmap_copy_page() copies the physical page src to the physical page dst β€” and the way it does this is iconic: it maps the page into kernel virtual address space (KVA), then uses bcopy() to copy the page. that's the whole move 🌈


πŸ‘‘ IMPLEMENTATION NOTES

okay this is the part where i need you to pay attention, bestie, because it's giving "gotcha" energy 😭

  • the pmap_copy() routine is only advisory and need not do anything. like, it's allowed to just… not. and honestly?
  • actually implementing it may seriously reduce system performance. so if you were about to go implement it for fun β€” no babe. put it down. walk away πŸ™ˆ
  • the pmap_copy_page() routine only operates upon a single page. one. uno. don't come for it with a whole range, it's not that girl πŸ’€
fr fr, that performance warning is real β€” implementing pmap_copy() can seriously hurt system performance.

πŸŽ€ SEE ALSO

go read those, iykyk πŸ“š


πŸ’– AUTHORS

This manual page was written by Bruce M Simpson <bms@spc.org>. ty for your service king πŸ‘‘


and that's the whole page, bestie!! πŸ¦‹ this Debian version dropped on July 21, 2003, so it's officially vintage β€” retro in the cutest way, PMAP_COPY(9) and all πŸ’œ mwah 🫢

πŸ“¦ where this page comes from