26typedef struct phyframe
30 PHYFRAME_RESERVED = 0,
80#define phyframe_pfn(frame) ((pfn_t) ((frame) - phyframes))
81#define pfn_phyframe(pfn) (&phyframes[(pfn)])
116#define pmm_reserve_address(paddr) pmm_reserve_frames(ALIGN_DOWN_TO_PAGE(paddr) / MOS_PAGE_SIZE, 1)
117#define pmm_reserve_addresses(paddr, npages) pmm_reserve_frames(ALIGN_DOWN_TO_PAGE(paddr) / MOS_PAGE_SIZE, npages)
143#define pmm_ref(thing, npages) _Generic((thing), phyframe_t *: _pmm_ref_phyframes, pfn_t: _pmm_ref_pfn_range)(thing, npages)
144#define pmm_unref(thing, npages) _Generic((thing), phyframe_t *: _pmm_unref_phyframes, pfn_t: _pmm_unref_pfn_range)(thing, npages)
146#define pmm_ref_one(thing) pmm_ref(thing, 1)
147#define pmm_unref_one(thing) pmm_unref(thing, 1)
#define pfn_phyframe(pfn)
void _pmm_unref_phyframes(phyframe_t *frame, size_t npages)
phyframe_t * _pmm_ref_phyframes(phyframe_t *frame, size_t npages)
size_t pmm_reserved_frames
struct phyframe phyframe_t
pfn_t pmm_reserve_frames(pfn_t pfn, size_t npages)
Mark a range of physical memory as reserved.
void pmm_free_frames(phyframe_t *start_frame, size_t n_pages)
should_inline pfn_t _pmm_ref_pfn_range(pfn_t pfn_start, size_t npages)
should_inline void _pmm_unref_pfn_range(pfn_t pfn_start, size_t npages)
size_t pmm_allocated_frames
phyframe_t * pmm_allocate_frames(size_t n_frames, pmm_allocation_flags_t flags)
Allocate n_frames of contiguous physical memory.
pmm_region_t * pmm_find_reserved_region(ptr_t needle)
Find a region in the physical memory manager.
void pmm_dump_lists(void)
Dump the physical memory manager's state, (i.e. the free list and the allocated list).
@ PMM_ALLOC_NORMAL
allocate normal pages
#define MOS_WARNING_DISABLE(text)
#define MOS_STATIC_ASSERT
atomic_t allocated_refcount
bool dirty
1 if the page is dirty