Loading...
Searching...
No Matches
memdesc.h
Go to the documentation of this file.
/*
* (c) 2007-2009 Adam Lackorzynski <adam@os.inf.tu-dresden.de>,
* Alexander Warg <warg@os.inf.tu-dresden.de>
* economic rights: Technische Universität Dresden (Germany)
*
* License: see LICENSE.spdx (in this directory or the directories above)
*/
#ifndef __L4SYS__MEMDESC_H__
#define __L4SYS__MEMDESC_H__
#include <l4/sys/kip.h>
enum l4_mem_type_t
{
l4_mem_type_undefined = 0x0,
l4_mem_type_conventional = 0x1,
l4_mem_type_reserved = 0x2,
l4_mem_type_dedicated = 0x3,
l4_mem_type_shared = 0x4,
l4_mem_type_info = 0xd,
l4_mem_type_bootloader = 0xe,
l4_mem_type_archspecific = 0xf,
};
enum l4_mem_info_sub_type_t
{
l4_mem_info_acpi_rsdp = 0
};
enum l4_mem_archspecific_sub_type_common_t
{
l4_mem_archspecific_acpi_tables = 3,
l4_mem_archspecific_acpi_nvs = 4,
};
typedef struct l4_kernel_info_mem_desc_t
{
l4_umword_t l;
l4_umword_t h;
} l4_kernel_info_mem_desc_t;
L4_INLINE
l4_kernel_info_mem_desc_t *
l4_kernel_info_get_mem_descs(l4_kernel_info_t *kip) L4_NOTHROW;
L4_INLINE
unsigned
l4_kernel_info_get_num_mem_descs(l4_kernel_info_t *kip) L4_NOTHROW;
L4_INLINE
void
l4_kernel_info_set_mem_desc(l4_kernel_info_mem_desc_t *md,
l4_addr_t start,
l4_addr_t end,
unsigned type,
unsigned virt,
unsigned sub_type) L4_NOTHROW;
L4_INLINE
l4_umword_t
l4_kernel_info_get_mem_desc_start(l4_kernel_info_mem_desc_t *md) L4_NOTHROW;
L4_INLINE
l4_umword_t
l4_kernel_info_get_mem_desc_end(l4_kernel_info_mem_desc_t *md) L4_NOTHROW;
L4_INLINE
l4_umword_t
l4_kernel_info_get_mem_desc_type(l4_kernel_info_mem_desc_t *md) L4_NOTHROW;
L4_INLINE
l4_umword_t
l4_kernel_info_get_mem_desc_subtype(l4_kernel_info_mem_desc_t *md) L4_NOTHROW;
L4_INLINE
l4_umword_t
l4_kernel_info_get_mem_desc_is_virtual(l4_kernel_info_mem_desc_t *md) L4_NOTHROW;
/*************************************************************************
* Implementations
*************************************************************************/
L4_INLINE
l4_kernel_info_mem_desc_t *
l4_kernel_info_get_mem_descs(l4_kernel_info_t *kip) L4_NOTHROW
{
return (l4_kernel_info_mem_desc_t *)((l4_addr_t)kip + kip->mem_descs);
}
L4_INLINE
unsigned
l4_kernel_info_get_num_mem_descs(l4_kernel_info_t *kip) L4_NOTHROW
{
return kip->mem_descs_num;
}
L4_INLINE
void
l4_kernel_info_set_mem_desc(l4_kernel_info_mem_desc_t *md,
l4_addr_t start,
l4_addr_t end,
unsigned type,
unsigned virt,
unsigned sub_type) L4_NOTHROW
{
md->l = (start & ~0x3ffUL) | (type & 0x0f) | ((sub_type << 4) & 0x0f0)
| (virt ? 0x200 : 0x0);
md->h = end;
}
L4_INLINE
l4_umword_t
l4_kernel_info_get_mem_desc_start(l4_kernel_info_mem_desc_t *md) L4_NOTHROW
{
return md->l & ~0x3ffUL;
}
L4_INLINE
l4_umword_t
l4_kernel_info_get_mem_desc_end(l4_kernel_info_mem_desc_t *md) L4_NOTHROW
{
return md->h | 0x3ffUL;
}
L4_INLINE
l4_umword_t
l4_kernel_info_get_mem_desc_type(l4_kernel_info_mem_desc_t *md) L4_NOTHROW
{
return md->l & 0xf;
}
L4_INLINE
l4_umword_t
l4_kernel_info_get_mem_desc_subtype(l4_kernel_info_mem_desc_t *md) L4_NOTHROW
{
return (md->l & 0xf0) >> 4;
}
L4_INLINE
l4_umword_t
l4_kernel_info_get_mem_desc_is_virtual(l4_kernel_info_mem_desc_t *md) L4_NOTHROW
{
return md->l & 0x200;
}
#endif /* ! __L4SYS__MEMDESC_H__ */
l4_umword_t
unsigned long l4_umword_t
Unsigned machine word.
Definition l4int.h:40
l4_addr_t
unsigned long l4_addr_t
Address type.
Definition l4int.h:34
l4_kernel_info_get_mem_desc_subtype
l4_umword_t l4_kernel_info_get_mem_desc_subtype(l4_kernel_info_mem_desc_t *md) L4_NOTHROW
Get sub-type of memory region.
Definition memdesc.h:229
l4_mem_archspecific_sub_type_common_t
l4_mem_archspecific_sub_type_common_t
Memory sub types for l4_mem_type_archspecific descriptors.
Definition memdesc.h:60
l4_kernel_info_get_mem_descs
l4_kernel_info_mem_desc_t * l4_kernel_info_get_mem_descs(l4_kernel_info_t *kip) L4_NOTHROW
Get pointer to memory descriptors from KIP.
Definition memdesc.h:179
l4_mem_info_sub_type_t
l4_mem_info_sub_type_t
Memory sub types for l4_mem_type_info descriptors.
Definition memdesc.h:51
l4_kernel_info_get_mem_desc_is_virtual
l4_umword_t l4_kernel_info_get_mem_desc_is_virtual(l4_kernel_info_mem_desc_t *md) L4_NOTHROW
Get virtual flag of the memory descriptor.
Definition memdesc.h:236
l4_kernel_info_set_mem_desc
void l4_kernel_info_set_mem_desc(l4_kernel_info_mem_desc_t *md, l4_addr_t start, l4_addr_t end, unsigned type, unsigned virt, unsigned sub_type) L4_NOTHROW
Populate a memory descriptor.
Definition memdesc.h:193
l4_kernel_info_get_mem_desc_end
l4_umword_t l4_kernel_info_get_mem_desc_end(l4_kernel_info_mem_desc_t *md) L4_NOTHROW
Get end address of the region described by the memory descriptor.
Definition memdesc.h:215
l4_kernel_info_get_num_mem_descs
unsigned l4_kernel_info_get_num_mem_descs(l4_kernel_info_t *kip) L4_NOTHROW
Get number of memory descriptors in KIP.
Definition memdesc.h:186
l4_mem_type_t
l4_mem_type_t
Type of a memory descriptor.
Definition memdesc.h:34
l4_kernel_info_get_mem_desc_type
l4_umword_t l4_kernel_info_get_mem_desc_type(l4_kernel_info_mem_desc_t *md) L4_NOTHROW
Get type of the memory region.
Definition memdesc.h:222
l4_kernel_info_get_mem_desc_start
l4_umword_t l4_kernel_info_get_mem_desc_start(l4_kernel_info_mem_desc_t *md) L4_NOTHROW
Get start address of the region described by the memory descriptor.
Definition memdesc.h:208
l4_mem_archspecific_acpi_tables
@ l4_mem_archspecific_acpi_tables
Firmware ACPI tables.
Definition memdesc.h:61
l4_mem_archspecific_acpi_nvs
@ l4_mem_archspecific_acpi_nvs
Firmware reserved address space.
Definition memdesc.h:62
l4_mem_info_acpi_rsdp
@ l4_mem_info_acpi_rsdp
Physical address of the ACPI root pointer.
Definition memdesc.h:52
l4_mem_type_archspecific
@ l4_mem_type_archspecific
Architecture specific memory (e.g., ACPI memory).
Definition memdesc.h:43
l4_mem_type_conventional
@ l4_mem_type_conventional
Conventional memory.
Definition memdesc.h:36
l4_mem_type_info
@ l4_mem_type_info
Info from the boot loader.
Definition memdesc.h:41
l4_mem_type_undefined
@ l4_mem_type_undefined
Undefined, unused descriptor.
Definition memdesc.h:35
l4_mem_type_dedicated
@ l4_mem_type_dedicated
Dedicated memory (some device memory).
Definition memdesc.h:38
l4_mem_type_reserved
@ l4_mem_type_reserved
Reserved memory for kernel etc.
Definition memdesc.h:37
l4_mem_type_bootloader
@ l4_mem_type_bootloader
Memory owned by the boot loader.
Definition memdesc.h:42
l4_mem_type_shared
@ l4_mem_type_shared
Shared memory (not implemented).
Definition memdesc.h:39
L4_NOTHROW
#define L4_NOTHROW
Mark a function declaration and definition as never throwing an exception.
Definition compiler.h:161
L4_INLINE
#define L4_INLINE
L4 Inline function attribute.
Definition compiler.h:51
l4_kernel_info_mem_desc_t
Memory descriptor data structure.
Definition memdesc.h:74
l4_kernel_info_t
L4 Kernel Interface Page.
Definition kip.h:37
kip.h
Kernel Info Page access functions.