IgrOS-Kernel 0.1.34.545
Simple C++20 Kernel for i386/x86_64
Loading...
Searching...
No Matches
igros::mem::direct Class Referencefinal

Direct map: physical memory at kernel virtual offset. More...

#include <mem/direct.hpp>

Public Member Functions

 ~direct () noexcept=default
 D-tor.
 direct (const direct &other)=delete
 Copy c-tor.
auto operator= (const direct &other) -> direct &=delete
 Copy assignment.

Static Public Member Functions

static auto end () noexcept -> phys_t
 End of directly mapped physical memory.
static void setEnd (const phys_t end) noexcept
 Set end of directly mapped physical memory (paging mapped more memory).
static auto isMapped (const phys_t phys, const phys_t size) noexcept -> bool
 Check if whole physical range is directly mapped.
template<class T>
static auto pointer (const phys_t phys, const phys_t size=sizeof(T)) noexcept -> T *
 Pointer to physical memory (nullptr if range is not directly mapped).
static auto string (const phys_t phys) noexcept -> const char *
 String at physical memory (nullptr if not directly mapped up to null terminator).
template<class T>
static auto physOf (const T *const object) noexcept -> phys_t
 Physical address of directly mapped object.

Static Private Attributes

static constinit phys_t mEnd {LOW_MEMORY_LIMIT}
 End of directly mapped physical memory.

Detailed Description

Direct map: physical memory at kernel virtual offset.

(boot code maps low memory, paging extends it up to top of RAM). Bootloader data may lie anywhere in physical memory, so every pointer is checked against directly mapped range

Definition at line 35 of file direct.hpp.

Member Function Documentation

◆ end()

auto igros::mem::direct::end ( ) ->phys_t
inlinestaticnodiscardnoexcept

End of directly mapped physical memory.

Returns
Physical address where direct map ends

Definition at line 92 of file direct.hpp.

◆ isMapped()

auto igros::mem::direct::isMapped ( const phys_t phys,
const phys_t size )->bool
inlinestaticnodiscardnoexcept

Check if whole physical range is directly mapped.

Parameters
physPhysical address
sizeRange size
Returns
true if range is directly mapped

Definition at line 104 of file direct.hpp.

◆ physOf()

template<class T>
auto igros::mem::direct::physOf ( const T *const object) ->phys_t
inlinestaticnodiscardnoexcept

Physical address of directly mapped object.

Template Parameters
TObject type
Parameters
objectDirectly mapped object
Returns
Physical address

Definition at line 141 of file direct.hpp.

◆ pointer()

template<class T>
auto igros::mem::direct::pointer ( const phys_t phys,
const phys_t size = sizeof(T) )->T *
inlinestaticnodiscardnoexcept

Pointer to physical memory (nullptr if range is not directly mapped).

Template Parameters
TObject type
Parameters
physPhysical address
sizeRange that must be mapped
Returns
Pointer, nullptr if not directly mapped

Definition at line 112 of file direct.hpp.

◆ setEnd()

void igros::mem::direct::setEnd ( const phys_t end)
inlinestaticnoexcept

Set end of directly mapped physical memory (paging mapped more memory).

Parameters
endPhysical address where direct map ends

Definition at line 97 of file direct.hpp.

◆ string()

auto igros::mem::direct::string ( const phys_t phys) ->constchar *
inlinestaticnodiscardnoexcept

String at physical memory (nullptr if not directly mapped up to null terminator).

Parameters
physPhysical address
Returns
String, nullptr if not directly mapped

Definition at line 121 of file direct.hpp.

Member Data Documentation

◆ mEnd

phys_t igros::mem::direct::mEnd {LOW_MEMORY_LIMIT}
inlinestaticconstinitprivate

End of directly mapped physical memory.

Definition at line 38 of file direct.hpp.


The documentation for this class was generated from the following file: