Loading...
Searching...
No Matches
consts.h
Go to the documentation of this file.
/*
* (c) 2008-2009 Adam Lackorzynski <adam@os.inf.tu-dresden.de>,
* Alexander Warg <warg@os.inf.tu-dresden.de>,
* Björn Döbel <doebel@os.inf.tu-dresden.de>,
* Torsten Frenzel <frenzel@os.inf.tu-dresden.de>
* economic rights: Technische Universität Dresden (Germany)
*
* License: see LICENSE.spdx (in this directory or the directories above)
*/
#ifndef __L4_SYS__INCLUDE__CONSTS_H__
#define __L4_SYS__INCLUDE__CONSTS_H__
#include <l4/sys/compiler.h>
#include <l4/sys/l4int.h>
enum l4_syscall_flags_t
{
L4_SYSF_NONE = 0x00,
L4_SYSF_SEND = 0x01,
L4_SYSF_RECV = 0x02,
L4_SYSF_OPEN_WAIT = 0x04,
L4_SYSF_REPLY = 0x08,
L4_SYSF_CALL = L4_SYSF_SEND | L4_SYSF_RECV,
L4_SYSF_WAIT = L4_SYSF_OPEN_WAIT | L4_SYSF_RECV,
L4_SYSF_SEND_AND_WAIT = L4_SYSF_OPEN_WAIT | L4_SYSF_CALL,
L4_SYSF_REPLY_AND_WAIT = L4_SYSF_WAIT | L4_SYSF_SEND | L4_SYSF_REPLY
};
enum l4_cap_consts_t
{
L4_CAP_SHIFT = 12UL,
L4_CAP_SIZE = 1UL << L4_CAP_SHIFT,
L4_CAP_OFFSET = 1UL << L4_CAP_SHIFT,
L4_CAP_MASK = ~0UL << (L4_CAP_SHIFT - 1),
L4_INVALID_CAP = ~0UL << (L4_CAP_SHIFT - 1),
L4_INVALID_CAP_BIT = 1UL << (L4_CAP_SHIFT - 1),
};
enum l4_sched_consts_t
{
L4_SCHED_MIN_PRIO = 1,
L4_SCHED_MAX_PRIO = 255,
};
enum l4_unmap_flags_t
{
L4_FP_ALL_SPACES = 0x80000000UL,
L4_FP_DELETE_OBJ = 0xc0000000UL,
L4_FP_OTHER_SPACES = 0x0UL
};
enum l4_msg_item_consts_t
{
L4_ITEM_MAP = 8,
L4_ITEM_CONT = 1,
// send
L4_MAP_ITEM_GRANT = 2,
L4_MAP_ITEM_MAP = 0,
// receive
L4_RCV_ITEM_FORWARD_MAPPINGS = 1,
L4_RCV_ITEM_SINGLE_CAP = L4_ITEM_MAP | 2,
L4_RCV_ITEM_LOCAL_ID = 4,
};
enum l4_buffer_desc_consts_t
{
L4_BDR_MEM_SHIFT = 0,
L4_BDR_IO_SHIFT = 5,
L4_BDR_OBJ_SHIFT = 10,
L4_BDR_OFFSET_MASK = (1UL << 20) - 1,
};
enum l4_default_caps_t
{
L4_BASE_TASK_CAP = 1UL << L4_CAP_SHIFT,
L4_BASE_FACTORY_CAP = 2UL << L4_CAP_SHIFT,
L4_BASE_THREAD_CAP = 3UL << L4_CAP_SHIFT,
L4_BASE_PAGER_CAP = 4UL << L4_CAP_SHIFT,
L4_BASE_LOG_CAP = 5UL << L4_CAP_SHIFT,
L4_BASE_ICU_CAP = 6UL << L4_CAP_SHIFT,
L4_BASE_SCHEDULER_CAP = 7UL << L4_CAP_SHIFT,
L4_BASE_IOMMU_CAP = 8UL << L4_CAP_SHIFT,
L4_BASE_DEBUGGER_CAP = 10UL << L4_CAP_SHIFT,
L4_BASE_ARM_SMCCC_CAP = 11UL << L4_CAP_SHIFT,
L4_BASE_CAPS_LAST_P1,
L4_BASE_CAPS_LAST = L4_BASE_CAPS_LAST_P1 - 1
};
#define L4_PAGESIZE (1UL << L4_PAGESHIFT)
#define L4_PAGEMASK (~(L4_PAGESIZE - 1))
#define L4_LOG2_PAGESIZE L4_PAGESHIFT
#define L4_SUPERPAGESIZE (1UL << L4_SUPERPAGESHIFT)
#define L4_SUPERPAGEMASK (~(L4_SUPERPAGESIZE - 1))
#define L4_LOG2_SUPERPAGESIZE L4_SUPERPAGESHIFT
L4_INLINE l4_addr_t l4_trunc_page(l4_addr_t address) L4_NOTHROW;
L4_INLINE l4_addr_t l4_trunc_page(l4_addr_t address) L4_NOTHROW
{ return address & L4_PAGEMASK; }
L4_INLINE l4_addr_t l4_trunc_size(l4_addr_t address, unsigned char bits) L4_NOTHROW;
L4_INLINE l4_addr_t l4_trunc_size(l4_addr_t address, unsigned char bits) L4_NOTHROW
{ return address & (~0UL << bits); }
L4_INLINE l4_addr_t l4_round_page(l4_addr_t address) L4_NOTHROW;
L4_INLINE l4_addr_t l4_round_page(l4_addr_t address) L4_NOTHROW
{ return (address + L4_PAGESIZE - 1) & L4_PAGEMASK; }
L4_INLINE l4_addr_t l4_round_size(l4_addr_t value, unsigned char bits) L4_NOTHROW;
L4_INLINE l4_addr_t l4_round_size(l4_addr_t value, unsigned char bits) L4_NOTHROW
{ return (value + (1UL << bits) - 1) & (~0UL << bits); }
L4_INLINE unsigned l4_bytes_to_mwords(unsigned size) L4_NOTHROW;
L4_INLINE unsigned l4_bytes_to_mwords(unsigned size) L4_NOTHROW
{ return (size + sizeof(l4_umword_t) - 1) / sizeof(l4_umword_t); }
enum l4_addr_consts_t {
L4_INVALID_ADDR = ~0UL
};
#define L4_INVALID_PTR ((void *)L4_INVALID_ADDR)
#ifndef NULL
#ifndef __cplusplus
# define NULL ((void *)0)
#elif __cplusplus >= 201103L
# define NULL nullptr
#else
# define NULL 0
#endif
#endif
#endif /* ! __L4_SYS__INCLUDE__CONSTS_H__ */
compiler.h
L4 compiler related defines.
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_default_caps_t
l4_default_caps_t
Default capabilities setup for the initial tasks.
Definition consts.h:325
l4_cap_consts_t
l4_cap_consts_t
Constants related to capability selectors.
Definition consts.h:140
L4_BASE_IOMMU_CAP
@ L4_BASE_IOMMU_CAP
Capability selector for the IO-MMU cap.
Definition consts.h:358
L4_BASE_THREAD_CAP
@ L4_BASE_THREAD_CAP
Capability selector for the first thread.
Definition consts.h:331
L4_BASE_DEBUGGER_CAP
@ L4_BASE_DEBUGGER_CAP
Capability selector for the debugger cap.
Definition consts.h:366
L4_BASE_PAGER_CAP
@ L4_BASE_PAGER_CAP
Capability selector for the pager gate.
Definition consts.h:339
L4_BASE_FACTORY_CAP
@ L4_BASE_FACTORY_CAP
Capability selector for the factory.
Definition consts.h:329
L4_BASE_CAPS_LAST
@ L4_BASE_CAPS_LAST
Last capability index used for base capabilities.
Definition consts.h:378
L4_BASE_SCHEDULER_CAP
@ L4_BASE_SCHEDULER_CAP
Capability selector for the scheduler cap.
Definition consts.h:351
L4_BASE_TASK_CAP
@ L4_BASE_TASK_CAP
Capability selector for the current task.
Definition consts.h:327
L4_BASE_ARM_SMCCC_CAP
@ L4_BASE_ARM_SMCCC_CAP
Capability selector for the ARM SMCCC cap.
Definition consts.h:373
L4_BASE_LOG_CAP
@ L4_BASE_LOG_CAP
Capability selector for the log object.
Definition consts.h:347
L4_BASE_ICU_CAP
@ L4_BASE_ICU_CAP
Capability selector for the base icu object.
Definition consts.h:349
L4_CAP_SIZE
@ L4_CAP_SIZE
Definition consts.h:144
L4_CAP_OFFSET
@ L4_CAP_OFFSET
Offset of two consecutive capability selectors.
Definition consts.h:146
L4_CAP_MASK
@ L4_CAP_MASK
Mask to get only the relevant bits of an l4_cap_idx_t.
Definition consts.h:151
L4_CAP_SHIFT
@ L4_CAP_SHIFT
Capability index shift.
Definition consts.h:142
L4_INVALID_CAP
@ L4_INVALID_CAP
Invalid capability selector.
Definition consts.h:153
l4_syscall_flags_t
l4_syscall_flags_t
Capability selector flags.
Definition consts.h:51
L4_SYSF_SEND_AND_WAIT
@ L4_SYSF_SEND_AND_WAIT
Send-and-wait flags.
Definition consts.h:124
L4_SYSF_WAIT
@ L4_SYSF_WAIT
Wait flags (combines receive and open wait).
Definition consts.h:116
L4_SYSF_REPLY
@ L4_SYSF_REPLY
Reply flag.
Definition consts.h:100
L4_SYSF_CALL
@ L4_SYSF_CALL
Call flags (combines send and receive).
Definition consts.h:108
L4_SYSF_SEND
@ L4_SYSF_SEND
Send-phase flag.
Definition consts.h:69
L4_SYSF_REPLY_AND_WAIT
@ L4_SYSF_REPLY_AND_WAIT
Reply-and-wait flags.
Definition consts.h:132
L4_SYSF_RECV
@ L4_SYSF_RECV
Receive-phase flag.
Definition consts.h:80
L4_SYSF_OPEN_WAIT
@ L4_SYSF_OPEN_WAIT
Open-wait flag.
Definition consts.h:91
L4_SYSF_NONE
@ L4_SYSF_NONE
Empty set of flags.
Definition consts.h:56
l4_bytes_to_mwords
unsigned l4_bytes_to_mwords(unsigned size) L4_NOTHROW
Determine how many machine words (l4_umword_t) are required to store a buffer of 'size' bytes.
Definition consts.h:496
l4_addr_consts_t
l4_addr_consts_t
Address related constants.
Definition consts.h:503
l4_trunc_page
l4_addr_t l4_trunc_page(l4_addr_t address) L4_NOTHROW
Round an address down to the next lower page boundary.
Definition consts.h:448
l4_trunc_size
l4_addr_t l4_trunc_size(l4_addr_t address, unsigned char bits) L4_NOTHROW
Round an address down to the next lower flexpage with size bits.
Definition consts.h:459
l4_round_page
l4_addr_t l4_round_page(l4_addr_t address) L4_NOTHROW
Round address up to the next page.
Definition consts.h:473
L4_PAGESIZE
#define L4_PAGESIZE
Minimal page size (in bytes).
Definition consts.h:391
L4_PAGEMASK
#define L4_PAGEMASK
Mask for the page number.
Definition consts.h:400
l4_round_size
l4_addr_t l4_round_size(l4_addr_t value, unsigned char bits) L4_NOTHROW
Round value up to the next alignment with bits size.
Definition consts.h:484
L4_INVALID_ADDR
@ L4_INVALID_ADDR
Invalid address.
Definition consts.h:505
l4_msg_item_consts_t
l4_msg_item_consts_t
Constants for message items.
Definition consts.h:213
L4_MAP_ITEM_GRANT
@ L4_MAP_ITEM_GRANT
Flag as grant instead of map operation.
Definition consts.h:245
L4_RCV_ITEM_FORWARD_MAPPINGS
@ L4_RCV_ITEM_FORWARD_MAPPINGS
This flag specifies if received capabilities shall be mapped to a particular task instead of the invo...
Definition consts.h:260
L4_ITEM_MAP
@ L4_ITEM_MAP
Identify a message item as map item.
Definition consts.h:214
L4_RCV_ITEM_LOCAL_ID
@ L4_RCV_ITEM_LOCAL_ID
The receiver requests to receive a local ID instead of a mapping whenever possible.
Definition consts.h:296
L4_ITEM_CONT
@ L4_ITEM_CONT
Denote that the following item shall be put into the same receive item as this one.
Definition consts.h:220
L4_MAP_ITEM_MAP
@ L4_MAP_ITEM_MAP
Flag as usual map operation.
Definition consts.h:247
L4_RCV_ITEM_SINGLE_CAP
@ L4_RCV_ITEM_SINGLE_CAP
Mark the receive buffer to be a small receive item that describes a buffer for a single object capabi...
Definition consts.h:275
l4_unmap_flags_t
l4_unmap_flags_t
Flags for the unmap operation.
Definition consts.h:170
L4_FP_DELETE_OBJ
@ L4_FP_DELETE_OBJ
Flag that indicates that an unmap operation on object capabilities shall try to delete the correspond...
Definition consts.h:197
L4_FP_ALL_SPACES
@ L4_FP_ALL_SPACES
Flag to tell the unmap operation to revoke permissions from all child mappings including the mapping ...
Definition consts.h:183
L4_FP_OTHER_SPACES
@ L4_FP_OTHER_SPACES
Counterpart to L4_FP_ALL_SPACES; revoke permissions from child mappings only.
Definition consts.h:205
l4_buffer_desc_consts_t
l4_buffer_desc_consts_t
Constants for buffer descriptors.
Definition consts.h:304
L4_BDR_IO_SHIFT
@ L4_BDR_IO_SHIFT
Bit offset for the IO-buffer index.
Definition consts.h:306
L4_BDR_MEM_SHIFT
@ L4_BDR_MEM_SHIFT
Bit offset for the memory-buffer index.
Definition consts.h:305
L4_BDR_OBJ_SHIFT
@ L4_BDR_OBJ_SHIFT
Bit offset for the capability-buffer index.
Definition consts.h:307
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
l4int.h
Fixed sized integer types, generic version.