Physical frame ownership

This figure documents the historical i386 source baseline. Current native x86-64/AArch64 qualification is recorded separately; this is not an ELF64 or native SMP implementation diagram.

Physical frame ownership PMM determines available frames from Multiboot information, marks usable regions free and reserves occupied kernel, bitmap and heap frames. Allocation finds a free bit, marks it used and returns a 4 KiB frame; freeing clears ownership and makes the frame reusable. Exhaustion returns failure. map->bitmap bitmap->reserve reserve->cursor cursor->found found->alloc yes found->fail no alloc->free owner releases free->cursor frame reusable map Multiboot available-memory map bitmap PMM bitmap 1 bit per 4 KiB frame reserve Reserve kernel + bitmap + heap frames cursor Allocation: scan from next-free cursor found Free bit found? alloc Set bit → increment used count return physical frame fail Return allocation failure free Free frame: clear bit adjust used count + scan cursor
Physical frame ownership PMM determines available frames from Multiboot information, marks usable regions free and reserves occupied kernel, bitmap and heap frames. Allocation finds a free bit, marks it used and returns a 4 KiB frame; freeing clears ownership and makes the frame reusable. Exhaustion returns failure. map->bitmap bitmap->reserve reserve->cursor cursor->found found->alloc yes found:e->fail:e no alloc->free free:e->cursor:e frame reusable map Multiboot available-memory map bitmap Bitmap ownership 1 bit per 4 KiB frame reserve Reserve kernel, bitmap and heap frames cursor Scan from next-free cursor found Free bit found? alloc Set bit; increment used count return physical frame free Owner frees frame: clear bit; adjust count + cursor fail Return allocation failure

The bitmap tracks ownership; the next-free cursor is only a search hint.

Text equivalent and source references
  • PMM determines available frames from Multiboot information, marks usable regions free and reserves occupied kernel, bitmap and heap frames.
  • Allocation finds a free bit, marks it used and returns a 4 KiB frame; freeing clears ownership and makes the frame reusable. Exhaustion returns failure.

Allocation flow. Source paths refer to the atlas baseline; the kernel checkout is private.

  • kernel/core/memory.c · pmm_init, pmm_alloc_frame, pmm_free_frame, heap_init
  • include/memory.h · PAGE_SIZE