map_range(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ’… map_range(9) β€” like, the Kernel API Manual entry, bestie ✨

Okay so real talk, this is one of those pages from the Kernel API Manual that sounds scary but honestly? It's giving "I map things, that's my whole personality." Let's get into it 🫢


🌸 NAME 🌸

map_range β€” maps a contiguous range of physical pages into virtual memory. Yes bestie, physical β†’ virtual, that's the whole vibe. No cap.


✨ SYNOPSIS ✨

void map_range (phys_addr_t *pte , u64 start , u64 end , phys_addr_t pa
, pgprot_t prot , int level , pte_t *tbl , bool may_use_cont , u64
va_offset );

Nine arguments. Nine. She's high-maintenance and honestly? Iconic for it πŸ‘‘


πŸŽ€ ARGUMENTS πŸŽ€

  • pte β€” Address of physical pointer to array of pages to allocate page tables from. That's where the page-table pages come from, bestie πŸ“
  • start β€” Virtual address of the start of the range. The beginning of the era, if you will.
  • end β€” Virtual address of the end of the range, and it's exclusive β€” so like, end is not invited to the party, it's just the door πŸ’€
  • pa β€” Physical address of the start of the range. This is the physical side of the situationship.
  • prot β€” Access permissions of the range. Who gets to touch it, who doesn't. Boundaries are healthy 🌈
  • level β€” Translation level for the mapping. Which floor of the page-table building we're on, iykyk.
  • tbl β€” The level level page table to create the mappings in. Yes, it literally says "the level level page table" β€” she said it twice and she meant it πŸ’…
  • may_use_cont β€” Whether the use of the contiguous attribute is allowed. Basically a permission slip for contiguity, and you literally pass a bool about it πŸ™ˆ
  • va_offset β€” Offset between a physical page and its current mapping in the VA space. The little gap between where a page is and where it's hanging out. Math, but make it flirty ✨

πŸ¦‹ SEE ALSO πŸ¦‹

  • Kernel file ./arch/arm64/kernel/pi/map_range.c β€” go read the source, bestie, it's right there and it's literally the main character of this whole page πŸ”₯

Fr fr, the important bit: end is exclusive. Do not come for me later saying I didn't warn you 😭

Cute lil sign-off: this absolute gem lives under ./arch/arm64/kernel/pi and the page is dated October 2026 β€” so yeah, technically future-dated, we don't ask questions, we just slay πŸ’œπŸ§šβ€β™€οΈβ­

πŸ“¦ where this page comes from