IgrOS-Kernel 0.1.34.545
Simple C++20 Kernel for i386/x86_64
Loading...
Searching...
No Matches
igros::mem::anonymous_namespace{phys.cpp} Namespace Reference

Allocator state. More...

Typedefs

using word_t = igros_dword_t
 Bitmap word.

Functions

auto isFree (const igros_usize_t page) noexcept -> bool
 Check if page is free.
void setFree (const igros_usize_t page) noexcept
 Mark page as free.
void setUsed (const igros_usize_t page) noexcept
 Mark page as used.
void markUsedString (const phys_t address) noexcept
 Mark boot string as used (only first byte if string is not directly mapped).
void markUsedModules (const multiboot::info_t &info) noexcept
 Mark modules list, modules and their names as used.

Variables

constexpr auto WORD_BITS {static_cast<igros_usize_t>(std::numeric_limits<word_t>::digits)}
 Pages per bitmap word.
constexpr auto PAGES {static_cast<igros_usize_t>(phys::MEMORY_LIMIT >> PAGE_SHIFT)}
 Number of tracked pages.
constinit std::array< word_t, PAGES/WORD_BITS > freeMap {}
 Free pages bitmap (bit set - page is free).
constinit igros_usize_t freeCount {0_usize}
 Number of free pages.
constinit igros_usize_t searchHint {0_usize}
 No free pages in words below this one.
constinit phys_t memoryTop {0_u64}
 End of highest memory marked free.

Detailed Description

Allocator state.

Typedef Documentation

◆ word_t

using igros::mem::anonymous_namespace{phys.cpp}::word_t = igros_dword_t

Bitmap word.

Definition at line 41 of file phys.cpp.

Function Documentation

◆ isFree()

auto igros::mem::anonymous_namespace{phys.cpp}::isFree ( const igros_usize_t page) ->bool
nodiscardnoexcept

Check if page is free.

Parameters
pagePage number
Returns
true if page is free

Definition at line 64 of file phys.cpp.

◆ markUsedModules()

void igros::mem::anonymous_namespace{phys.cpp}::markUsedModules ( const multiboot::info_t & info)
noexcept

Mark modules list, modules and their names as used.

Parameters
infoMultiboot information

Definition at line 92 of file phys.cpp.

◆ markUsedString()

void igros::mem::anonymous_namespace{phys.cpp}::markUsedString ( const phys_t address)
noexcept

Mark boot string as used (only first byte if string is not directly mapped).

Parameters
addressString physical address

Definition at line 85 of file phys.cpp.

◆ setFree()

void igros::mem::anonymous_namespace{phys.cpp}::setFree ( const igros_usize_t page)
noexcept

Mark page as free.

Parameters
pagePage number

Definition at line 70 of file phys.cpp.

◆ setUsed()

void igros::mem::anonymous_namespace{phys.cpp}::setUsed ( const igros_usize_t page)
noexcept

Mark page as used.

Parameters
pagePage number

Definition at line 78 of file phys.cpp.

Variable Documentation

◆ freeCount

igros_usize_t igros::mem::anonymous_namespace{phys.cpp}::freeCount {0_usize}
constinit

Number of free pages.

Definition at line 53 of file phys.cpp.

◆ freeMap

std::array<word_t, PAGES / WORD_BITS> igros::mem::anonymous_namespace{phys.cpp}::freeMap {}
constinit

Free pages bitmap (bit set - page is free).

Zero-initialized (.bss): all memory is used until init

Definition at line 51 of file phys.cpp.

◆ memoryTop

phys_t igros::mem::anonymous_namespace{phys.cpp}::memoryTop {0_u64}
constinit

End of highest memory marked free.

Definition at line 57 of file phys.cpp.

◆ PAGES

auto igros::mem::anonymous_namespace{phys.cpp}::PAGES {static_cast<igros_usize_t>(phys::MEMORY_LIMIT >> PAGE_SHIFT)}
constexpr

Number of tracked pages.

Definition at line 46 of file phys.cpp.

◆ searchHint

igros_usize_t igros::mem::anonymous_namespace{phys.cpp}::searchHint {0_usize}
constinit

No free pages in words below this one.

Definition at line 55 of file phys.cpp.

◆ WORD_BITS

auto igros::mem::anonymous_namespace{phys.cpp}::WORD_BITS {static_cast<igros_usize_t>(std::numeric_limits<word_t>::digits)}
constexpr

Pages per bitmap word.

Definition at line 44 of file phys.cpp.