MOS Source Code
Loading...
Searching...
No Matches
buddy.h File Reference
#include "mos/mm/physical/pmm.h"
#include <mos/types.h>
+ Include dependency graph for buddy.h:
+ This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Functions

void buddy_dump_all ()
 Dump the state of the buddy allocator.
 
void buddy_init (size_t max_nframes)
 Initialize the buddy allocator with the given maximum number of frames.
 
void buddy_reserve_n (pfn_t pfn, size_t nframes)
 Reserve several frames at the given physical frame number.
 
phyframe_tbuddy_alloc_n_exact (size_t nframes)
 Allocate nframes of contiguous physical memory.
 
void buddy_free_n (pfn_t pfn, size_t nframes)
 Free nframes of contiguous physical memory.
 

Function Documentation

◆ buddy_dump_all()

void buddy_dump_all ( )

Dump the state of the buddy allocator.

Definition at line 301 of file buddy_core.c.

Referenced by pmm_dump_lists().

+ Here is the call graph for this function:

◆ buddy_init()

void buddy_init ( size_t max_nframes)

Initialize the buddy allocator with the given maximum number of frames.

Parameters
max_nframesThe maximum number of frames that are addressable on the system.

Definition at line 309 of file buddy_core.c.

Referenced by pmm_init().

+ Here is the call graph for this function:

◆ buddy_reserve_n()

void buddy_reserve_n ( pfn_t pfn,
size_t nframes )

Reserve several frames at the given physical frame number.

Parameters
pfnThe physical frame number to reserve.
nframesThe number of frames to reserve.

Definition at line 323 of file buddy_core.c.

Referenced by pmm_reserve_frames().

+ Here is the call graph for this function:

◆ buddy_alloc_n_exact()

phyframe_t * buddy_alloc_n_exact ( size_t nframes)

Allocate nframes of contiguous physical memory.

Parameters
nframesThe number of frames to allocate.
Returns
phyframe_t * The first frame in the contiguous block.
Note
nframes will be allocated exactly, and each frame can be freed individually. (unlike buddy_alloc_n_compound)

Definition at line 331 of file buddy_core.c.

Referenced by pmm_allocate_frames().

+ Here is the call graph for this function:

◆ buddy_free_n()

void buddy_free_n ( pfn_t pfn,
size_t nframes )

Free nframes of contiguous physical memory.

Parameters
pfnThe physical frame number of the first frame in the contiguous block.
nframesThe number of frames to free.
Note
// !! The number of frames freed must be the same as the number of frames allocated. // TODO

Definition at line 370 of file buddy_core.c.

Referenced by pmm_free_frames().

+ Here is the call graph for this function: