LumaOS  v0.1.116
An experimental x86-64 OS
Loading...
Searching...
No Matches
pmm.h File Reference

Physical memory manager. More...

#include <limine/limine.h>
Include dependency graph for pmm.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  pmm_state
 Holds the state of the physical memory manager and information about its memory. More...

Macros

#define FRAME_SIZE   4096ULL
#define FRAME_SHIFT   12

Functions

void pmm_init (const struct limine_memmap_response *memmap_response)
 Initialize the physical memory manager.
struct pmm_state get_pmm_state (void)
 Get the current pmm state.
uint64_t pmm_alloc_frame (void)
 Allocate a frame from the physical memory manager.
uint64_t pmm_alloc_contiguous (uint64_t count)
 Allocates count contiguous frames from the physical memory manager.
uint64_t pmm_alloc_zeroed (void)
 Allocate and zero a frame from the physical memory manager.
uint64_t pmm_alloc_zeroed_contiguous (uint64_t count)
 Allocate and zero count contiguous frames from the physical memory manager.
void pmm_free_frame (uint64_t physical_addr)
 Frees a frame from the physical memory manager.

Detailed Description

Physical memory manager.

Author
Matheus Boscariol
Since
26/11/2026

Definition in file pmm.h.

Macro Definition Documentation

◆ FRAME_SHIFT

#define FRAME_SHIFT   12

Definition at line 16 of file pmm.h.

◆ FRAME_SIZE

#define FRAME_SIZE   4096ULL

Definition at line 15 of file pmm.h.

Function Documentation

◆ get_pmm_state()

struct pmm_state get_pmm_state ( void )

Get the current pmm state.

Returns
The current pmm state

Definition at line 19 of file pmm.c.

Here is the call graph for this function:

◆ pmm_alloc_contiguous()

uint64_t pmm_alloc_contiguous ( uint64_t count)

Allocates count contiguous frames from the physical memory manager.

Parameters
countNumber of contiguous frames to allocate
Returns
The physical address of the allocated frames

Definition at line 134 of file pmm.c.

◆ pmm_alloc_frame()

uint64_t pmm_alloc_frame ( void )

Allocate a frame from the physical memory manager.

Returns
The physical address of the allocated frame

Definition at line 112 of file pmm.c.

◆ pmm_alloc_zeroed()

uint64_t pmm_alloc_zeroed ( void )

Allocate and zero a frame from the physical memory manager.

Returns
The physical address of the allocated frame

Definition at line 204 of file pmm.c.

Here is the call graph for this function:

◆ pmm_alloc_zeroed_contiguous()

uint64_t pmm_alloc_zeroed_contiguous ( uint64_t count)

Allocate and zero count contiguous frames from the physical memory manager.

Parameters
countNumber of contiguous frames to allocate
Returns
The physical address of the allocated frame

Definition at line 215 of file pmm.c.

Here is the call graph for this function:

◆ pmm_free_frame()

void pmm_free_frame ( uint64_t physical_addr)

Frees a frame from the physical memory manager.

Parameters
physical_addrThe physical address of the frame to free

Definition at line 227 of file pmm.c.

◆ pmm_init()

void pmm_init ( const struct limine_memmap_response * memmap_response)

Initialize the physical memory manager.

Parameters
memmap_responseThe memory map from the bootloader

Definition at line 23 of file pmm.c.

Here is the call graph for this function: