Skip to content

Physical memory manager

paddr_t pmm_alloc_page_full(enum alloc_flags flags)
source
paddr_t pmm_alloc_pages_full(size_t count, enum alloc_flags flags)
source
void pmm_free_pages(paddr_t addr, uint64_t count)
source
void pmm_free_page(paddr_t addr)
source
void pmm_early_init(struct limine_memmap_request m)
source
void pmm_mid_init(void)
source
void pmm_late_init(void)
source
uint64_t pmm_get_usable_ram(void)
source
extern struct limine_memmap_response *memmap
source
#define pmm_alloc_pages_1(count)
source

The reason we use an inline function here is to allow a check of count to make sure it somehow has not ended up equaling ALLOC_PARAMS_DEFAULT and warning once if this has ended up being the case

Expansion
#define pmm_alloc_pages_1(count) \
    ({ \
        if ((enum alloc_flags) count == ALLOC_FLAGS_DEFAULT) \
            log_msg_once(LOG_WARN, \
                         "Input to alloc_pages matches ALLOC_FLAGS_DEFAULT, " \
                         "possible mistake"); \
 \
        pmm_alloc_pages_2(count, ALLOC_FLAGS_DEFAULT); \
    })
#define pmm_alloc_pages_2(count, f)
source
Expansion
#define pmm_alloc_pages_2(count, f) pmm_alloc_pages_full((count), (f))
#define pmm_alloc_pages(...)
source
Expansion
#define pmm_alloc_pages(...) PP_CALL(pmm_alloc_pages, __VA_ARGS__)
#define pmm_alloc_page_0()
source
#define pmm_alloc_page_1(f)
source
Expansion
#define pmm_alloc_page_1(f) pmm_alloc_page_full((f))
#define pmm_alloc_page(...)
source
Expansion
#define pmm_alloc_page(...) PP_CALL(pmm_alloc_page, __VA_ARGS__)