30#include <l4/cxx/static_vector>
92 static unsigned long &memory_info(
void *kip)
noexcept
93 {
return *((
unsigned long *)kip + 21); }
95 static unsigned long memory_info(
void const *kip)
noexcept
96 {
return *((
unsigned long const *)kip + 21); }
109 + (memory_info(kip) >> ((
sizeof(
unsigned long) / 2) * 8)));
114 return (
Mem_desc const *)((
char const *)kip
115 + (memory_info(kip) >> ((
sizeof(
unsigned long) / 2) * 8)));
125 static unsigned long count(
void const *kip)
noexcept
127 return memory_info(kip)
128 & ((1UL << ((
sizeof(
unsigned long) / 2) * 8)) - 1);
139 unsigned long &mi = memory_info(kip);
140 mi = (mi & ~((1UL << ((
sizeof(
unsigned long) / 2) * 8)) - 1)) |
count;
176 Mem_type t,
unsigned char st = 0,
bool virt =
false) noexcept
177 : _l((
start & ~0x3ffUL) | (t & 0x0f) | ((st << 4) & 0x0f0)
178 | (virt ? 0x0200 : 0x0)), _h(
end | 0x3ffUL)
186 unsigned long start() const noexcept {
return _l & ~0x3ffUL; }
193 unsigned long end() const noexcept {
return _h | 0x3ffUL; }
214 unsigned char sub_type() const noexcept {
return (_l >> 4) & 0x0f; }
234 Mem_type t,
unsigned char st = 0,
bool virt =
false) noexcept
236 _l = (
start & ~0x3ffUL) | (t & 0x0f) | ((st << 4) & 0x0f0)
Memory descriptors stored in the kernel interface page.
Mem_type type() const noexcept
Return type of the memory descriptor.
static void count(void *kip, unsigned count) noexcept
Set number of memory descriptors.
void set(unsigned long start, unsigned long end, Mem_type t, unsigned char st=0, bool virt=false) noexcept
Set values of a memory descriptor.
unsigned long end() const noexcept
Return end address of memory descriptor.
unsigned long start() const noexcept
Return start address of memory descriptor.
Arch_sub_type_common
Common sub types across all architectures for the Mem_type::Arch type.
@ Arch_acpi_tables
Firmware ACPI tables.
@ Arch_acpi_nvs
Firmware reserved address space.
static cxx::static_vector< Mem_desc const > all(void const *kip)
Return enumerable list of memory descriptors.
unsigned is_virtual() const noexcept
Return whether the memory descriptor describes a virtual or physical region.
Mem_desc(unsigned long start, unsigned long end, Mem_type t, unsigned char st=0, bool virt=false) noexcept
Initialize memory descriptor.
Info_sub_type
Memory sub types for the Mem_type::Info type.
@ Info_acpi_rsdp
Physical address of the ACPI root pointer.
static cxx::static_vector< Mem_desc > all(void *kip)
Return enumerable list of memory descriptors.
@ Reserved
Reserved region, do not use this memory.
@ Conventional
Conventional memory.
@ Info
Info by boot loader.
@ Undefined
Undefined memory.
@ Arch
Architecture specific memory.
@ Bootloader
Memory belongs to the boot loader.
unsigned long size() const noexcept
Return size of region described by the memory descriptor.
static unsigned long count(void const *kip) noexcept
Return number of memory descriptors stored in the kernel info page.
static Mem_desc * first(void *kip) noexcept
Get first memory descriptor.
unsigned char sub_type() const noexcept
Return sub-type of the memory descriptor.
Simple encapsulation for a dynamically allocated array.
L4 low-level kernel interface.