setup_physmem(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

✨ setup_physmem(9) ✨

okay bestie, welcome to the Kernel API Manual β€” this one's a kernel-level function from the UML (User-Mode Linux) world, so grab a lil snack and let's get into it 🫢


🌸 NAME 🌸

setup_physmem β€” the function that sets up physical memory for UML, no cap πŸ’…


πŸ¦‹ SYNOPSIS πŸ¦‹

void setup_physmem (unsigned long start , unsigned long reserve_end ,
       unsigned long len );

πŸŽ€ ARGUMENTS πŸŽ€

  • start β€” the start address of the physical kernel memory, aka the start address of the executable image. literally where it all begins ✨
  • reserve_end β€” the end address of the physical kernel memory. that's a wrap 🎬
  • len β€” the length of total physical memory that should be mapped/made available, in bytes. yes, bytes. all of them πŸ’–

πŸ‘‘ DESCRIPTION πŸ‘‘

So here's the tea, bestie: this function creates an unlinked temporary file of size (len) and memory maps it on the last executable image address (uml_reserved). iconic behavior honestly 🧚

The offset is needed because the length of the total physical memory (len) includes the size of the memory used by the executable image β€” but the mapped-to address is the last address of the executable image (where uml_reserved == end address of executable image). it's giving "accounting for the overlap" and it ate πŸ’…

The memory mapped memory of the temporary file is used as backing memory of all user space processes/kernel tasks. so yeah, it's kind of a big deal πŸ”₯

ngl this one's lowkey doing a lot of heavy lifting behind the scenes β€” the temp file is the memory, fr fr ✨

πŸ’œ SEE ALSO πŸ’œ

  • Kernel file ./arch/um/kernel/physmem.c β€” go read the source, bestie, it's right there πŸ™ˆ

and that's the whole vibe check! this page came to you from ./arch/um/kernel, dated October 2026 β€” slay, periodt, go set up some physical memory πŸ“πŸ’–πŸŽ€

πŸ“¦ where this page comes from