LF OS
Hobby operating system for amd64 with high ambitions
Loading...
Searching...
No Matches
mm.h File Reference

(29312b1 fbconsole, panic: render panic after framebuffer was given to userspace - without clearing screen contents)

#include <stdint.h>
+ Include dependency graph for mm.h:
+ This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Macros

#define KiB   (1024)
 
#define MiB   (1024ULL * KiB)
 
#define GiB   (1024ULL * MiB)
 
#define TiB   (1024ULL * GiB)
 

Enumerations

enum  mm_page_status_t { MM_UNKNOWN , MM_FREE , MM_RESERVED , MM_UEFI_MAPPING_REQUIRED }
 
enum  mm_caching_mode_t { MM_UNCACHED , MM_WRITETHROUGH , MM_WRITEBACK }
 

Functions

void * mm_alloc_pages (uint64_t count)
 
void mm_set_caching_mode (mm_caching_mode_t mode, ptr_t start, size_t len)
 
void mm_mark_physical_pages (ptr_t start, uint64_t count, mm_page_status_t status)
 
void mm_make_writeable (ptr_t address, int writeable)
 
void mm_print_physical_free_regions (void)
 
void mm_bootstrap (ptr_t usable_page)
 
ptr_t mm_highest_address (void)
 

Macro Definition Documentation

◆ GiB

#define GiB   (1024ULL * MiB)

Definition at line 8 of file mm.h.

◆ KiB

#define KiB   (1024)

Definition at line 6 of file mm.h.

◆ MiB

#define MiB   (1024ULL * KiB)

Definition at line 7 of file mm.h.

◆ TiB

#define TiB   (1024ULL * GiB)

Definition at line 9 of file mm.h.

Enumeration Type Documentation

◆ mm_caching_mode_t

Enumerator
MM_UNCACHED 
MM_WRITETHROUGH 
MM_WRITEBACK 

Definition at line 18 of file mm.h.

◆ mm_page_status_t

Enumerator
MM_UNKNOWN 
MM_FREE 
MM_RESERVED 
MM_UEFI_MAPPING_REQUIRED 

Definition at line 11 of file mm.h.

Function Documentation

◆ mm_alloc_pages()

void * mm_alloc_pages ( uint64_t  count)

Definition at line 24 of file mm.c.

References mm_page_list_entry_t::count, mm_del_page_list_entry(), MM_FREE, mm_physical_page_list, mm_page_list_entry_t::next, panic_message(), mm_page_list_entry_t::start, and mm_page_list_entry_t::status.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ mm_bootstrap()

void mm_bootstrap ( ptr_t  usable_page)

Definition at line 76 of file mm.c.

References mm_page_list_entry_t::count, mm_physical_page_list, MM_UNKNOWN, mm_page_list_entry_t::next, mm_page_list_entry_t::start, and mm_page_list_entry_t::status.

+ Here is the caller graph for this function:

◆ mm_highest_address()

ptr_t mm_highest_address ( void  )

Definition at line 166 of file mm.c.

References mm_page_list_entry_t::count, mm_physical_page_list, mm_page_list_entry_t::next, and mm_page_list_entry_t::start.

+ Here is the caller graph for this function:

◆ mm_make_writeable()

void mm_make_writeable ( ptr_t  address,
int  writeable 
)

Make page writeable

Parameters
addressAddress to modify
writeableShall the page be writeable or readonly?

◆ mm_mark_physical_pages()

void mm_mark_physical_pages ( ptr_t  start,
uint64_t  count,
mm_page_status_t  status 
)

Mark physical pages with information from loader memory map

Parameters
startStart of the physical memory region to mark
countNumber of pages
statusPage status of the given memory region

Definition at line 93 of file mm.c.

References mm_page_list_entry_t::count, entry, mm_bootstrap(), mm_del_page_list_entry(), MM_FREE, mm_get_page_list_entry(), mm_physical_page_list, mm_page_list_entry_t::next, panic_message(), mm_page_list_entry_t::start, and mm_page_list_entry_t::status.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ mm_print_physical_free_regions()

void mm_print_physical_free_regions ( void  )

◆ mm_set_caching_mode()

void mm_set_caching_mode ( mm_caching_mode_t  mode,
ptr_t  start,
size_t  len 
)

set the caching mode for the pages starting at start until start + len

Parameters
modecaching mode to set
startstart address
lennumber of bytes