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

Memory management: physical page allocator, direct map, virtual addresses. More...

Namespaces

namespace  anonymous_namespace{phys.cpp}
 Allocator state.

Classes

class  direct
 Direct map: physical memory at kernel virtual offset. More...
class  phys
 Physical page frame allocator. More...

Typedefs

using phys_t = igros_quad_t
 Physical address (64-bit: physical memory may lie above 4 GB).

Enumerations

enum class  virt_t : igros_usize_t
 Virtual address: translated by paging, never dereferenced through this type. More...

Functions

template<class T>
auto virtOf (const T *const object) noexcept -> virt_t
 Virtual address of object.
constexpr auto address (const virt_t virt) noexcept -> igros_usize_t
 Numeric value of virtual address.
constexpr auto operator+ (const virt_t virt, const igros_usize_t offset) noexcept -> virt_t
 Virtual address at offset.

Variables

constexpr auto PAGE_SHIFT {12_usize}
 Page size bits.
constexpr auto PAGE_SIZE {1_usize << PAGE_SHIFT}
 Page size in bytes.
constexpr auto LOW_MEMORY_LIMIT {0x400000_u64}
 Physical memory mapped by boot code at kernel virtual offset (see boot.s).
constexpr auto LOW_MEMORY_RESERVED {0x100000_u64}
 Physical memory never given out (BIOS, video memory, ROMs).

Detailed Description

Memory management: physical page allocator, direct map, virtual addresses.

Typedef Documentation

◆ phys_t

Physical address (64-bit: physical memory may lie above 4 GB).

Definition at line 36 of file phys.hpp.

Enumeration Type Documentation

◆ virt_t

enum class igros::mem::virt_t : igros_usize_t
strong

Virtual address: translated by paging, never dereferenced through this type.

Distinct type, so physical addresses (phys_t), plain integers and virtual addresses can't be mixed up (phys_t and igros_usize_t are the same type on x86_64)

Definition at line 30 of file virt.hpp.

Function Documentation

◆ address()

auto igros::mem::address ( const virt_t virt) ->igros_usize_t
nodiscardconstexprnoexcept

Numeric value of virtual address.

Parameters
virtVirtual address
Returns
Address value

Definition at line 47 of file virt.hpp.

◆ operator+()

auto igros::mem::operator+ ( const virt_t virt,
const igros_usize_t offset )->virt_t
nodiscardconstexprnoexcept

Virtual address at offset.

Parameters
virtVirtual address
offsetOffset in bytes
Returns
Virtual address at offset

Definition at line 56 of file virt.hpp.

◆ virtOf()

template<class T>
auto igros::mem::virtOf ( const T *const object) ->virt_t
inlinenodiscardnoexcept

Virtual address of object.

Template Parameters
TObject type
Parameters
objectObject
Returns
Virtual address

Definition at line 39 of file virt.hpp.

Variable Documentation

◆ LOW_MEMORY_LIMIT

auto igros::mem::LOW_MEMORY_LIMIT {0x400000_u64}
constexpr

Physical memory mapped by boot code at kernel virtual offset (see boot.s).

Definition at line 43 of file phys.hpp.

◆ LOW_MEMORY_RESERVED

auto igros::mem::LOW_MEMORY_RESERVED {0x100000_u64}
constexpr

Physical memory never given out (BIOS, video memory, ROMs).

Definition at line 45 of file phys.hpp.

◆ PAGE_SHIFT

auto igros::mem::PAGE_SHIFT {12_usize}
constexpr

Page size bits.

Definition at line 39 of file phys.hpp.

◆ PAGE_SIZE

auto igros::mem::PAGE_SIZE {1_usize << PAGE_SHIFT}
constexpr

Page size in bytes.

Definition at line 40 of file phys.hpp.