PMAP_COPY(9)

πŸ’– PMAP_COPY πŸ’– (section 9, kernel devs only, bestie)

okay so this is PMAP_COPY(9) from the Kernel Developer's Manual, and it's literally all about copying physical memory pages. two functions, one job, let's go ✨


🌸 NAME 🌸

pmap_copy, pmap_copy_page β€” copy physical memory pages


πŸŽ€ SYNOPSIS πŸŽ€

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

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);

✨ DESCRIPTION ✨

so the pmap_copy() function copies the range that src_addr and len are specifying β€” that whole stretch β€” from the source physical map src_pmap over to the destination physical map dst_pmap, and it drops it at the address dst_addr. that's the move πŸ’…

and then pmap_copy_page() is the single-page girlie: it copies the physical page src to the physical page dst. how? it maps the page into kernel virtual address space (KVA), and then uses bcopy() to actually do the copy. periodt 🫢


πŸ’€ IMPLEMENTATION NOTES πŸ’€

ngl this is the part you need to read twice, bestie.

the pmap_copy() routine is only advisory and need not do anything. like, it's allowed to just... not. and here's the tea: actually implementing it may seriously reduce system performance. so yeah, no cap, doing the thing can make everything worse. 😭

the pmap_copy_page() routine only operates upon a single page. one page. that's it. don't ask it for more. πŸ™ˆ


πŸ”₯ SEE ALSO πŸ”₯


πŸ‘‘ AUTHORS πŸ‘‘

this manual page was written by Bruce M Simpson <bms@spc.org>. iconic of him, honestly 🌟


and that's the whole page, bestie β€” tysm for reading πŸ¦‹ this was the PMAP_COPY(9) page from Debian, dated July 21, 2003 πŸ’– mwah, go copy some pages responsibly πŸ’…βœ¨

πŸ“¦ where this page comes from