18#include <l4/cxx/static_vector>
91 return reinterpret_cast<Mem_desc *
>(
reinterpret_cast<char *
>(kip) + kip->mem_descs);
96 char const *addr =
reinterpret_cast<char const *
>(kip) + kip->mem_descs;
97 return reinterpret_cast<Mem_desc const *
>(addr);
109 return kip->mem_descs_num;
120 kip->mem_descs_num =
count;
159 Mem_type t,
unsigned char st = 0,
bool virt =
false,
160 bool eager =
false) noexcept
161 : _l((
start & ~0x3ffUL) | (t & 0x0f) | ((st << 4) & 0x0f0)
162 | (virt ? 0x0200 : 0x0) | (eager ? 0x100 : 0x0)), _h(
end | 0x3ffUL)
170 unsigned long start() const noexcept {
return _l & ~0x3ffUL; }
177 unsigned long end() const noexcept {
return _h | 0x3ffUL; }
193 return static_cast<Mem_type>(_l & 0x0f);
201 unsigned char sub_type() const noexcept {
return (_l >> 4) & 0x0f; }
215 unsigned eager_map() const noexcept {
return _l & 0x100; }
230 Mem_type t,
unsigned char st = 0,
bool virt =
false,
231 bool eager =
false) noexcept
233 _l = (
start & ~0x3ffUL) | (t & 0x0f) | ((st << 4) & 0x0f0)
234 | (virt?0x0200:0x0) | (eager ? 0x0100 : 0x0);
Memory descriptors stored in the kernel interface page.
Mem_type type() const noexcept
Return type of the memory descriptor.
unsigned long end() const noexcept
Return end address of memory descriptor.
static cxx::static_vector< Mem_desc const > all(l4_kernel_info_t const *kip)
Return enumerable list of memory descriptors.
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.
void set(unsigned long start, unsigned long end, Mem_type t, unsigned char st=0, bool virt=false, bool eager=false) noexcept
Set values of a memory descriptor.
unsigned is_virtual() const noexcept
Return whether the memory descriptor describes a virtual or physical region.
Info_sub_type
Memory sub types for the Mem_type::Info type.
@ Info_acpi_rsdp
Physical address of the ACPI root pointer.
Mem_desc(unsigned long start, unsigned long end, Mem_type t, unsigned char st=0, bool virt=false, bool eager=false) noexcept
Initialize memory descriptor.
unsigned eager_map() const noexcept
Return whether the region shall be eligible for eager mapping in sigma0 or the root task.
@ 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.
static void count(l4_kernel_info_t *kip, unsigned count) noexcept
Set number of memory descriptors.
static unsigned long count(l4_kernel_info_t const *kip) noexcept
Return number of memory descriptors stored in the kernel info page.
static cxx::static_vector< Mem_desc > all(l4_kernel_info_t *kip)
Return enumerable list of memory descriptors.
unsigned long size() const noexcept
Return size of region described by the memory descriptor.
static Mem_desc * first(l4_kernel_info_t *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.
L4 Kernel Interface Page.
Kernel Info Page access functions.