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

Physical memory manager. More...

#include <stddef.h>
#include <mm/pmm.h>
#include <limine/limine.h>
#include <kernel/panic.h>
#include "kernel/log.h"
Include dependency graph for pmm.c:

Go to the source code of this file.

Functions

struct pmm_state get_pmm_state (void)
 Get the current pmm state.
void pmm_init (const struct limine_memmap_response *memmap_response)
 Initialize the physical memory manager.
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.

Variables

struct pmm_state state

Detailed Description

Physical memory manager.

Author
Matheus Boscariol
Since
26/11/2026

Definition in file pmm.c.

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:

Variable Documentation

◆ state

struct pmm_state state

Definition at line 17 of file pmm.c.