L4Re - L4 Runtime Environment
consts.h
Go to the documentation of this file.
1 
6 /*
7  * (c) 2008-2009 Adam Lackorzynski <adam@os.inf.tu-dresden.de>,
8  * Alexander Warg <warg@os.inf.tu-dresden.de>,
9  * Björn Döbel <doebel@os.inf.tu-dresden.de>,
10  * Torsten Frenzel <frenzel@os.inf.tu-dresden.de>
11  * economic rights: Technische Universität Dresden (Germany)
12  *
13  * This file is part of TUD:OS and distributed under the terms of the
14  * GNU General Public License 2.
15  * Please see the COPYING-GPL-2 file for details.
16  *
17  * As a special exception, you may use this file as part of a free software
18  * library without restriction. Specifically, if other files instantiate
19  * templates or use macros or inline functions from this file, or you compile
20  * this file and link it with other files to produce an executable, this
21  * file does not by itself cause the resulting executable to be covered by
22  * the GNU General Public License. This exception does not however
23  * invalidate any other reasons why the executable file might be covered by
24  * the GNU General Public License.
25  */
26 #ifndef __L4_SYS__INCLUDE__CONSTS_H__
27 #define __L4_SYS__INCLUDE__CONSTS_H__
28 
29 #include <l4/sys/compiler.h>
30 #include <l4/sys/l4int.h>
31 
40 {
48  L4_SYSF_NONE = 0x00,
49 
58  L4_SYSF_SEND = 0x01,
59 
69  L4_SYSF_RECV = 0x02,
70 
81 
89  L4_SYSF_REPLY = 0x08,
90 
98 
106 
114 
122 };
123 
129 {
131  L4_CAP_SHIFT = 12UL,
134  L4_CAP_OFFSET = 1UL << L4_CAP_SHIFT,
139  L4_CAP_MASK = ~0UL << (L4_CAP_SHIFT - 1),
141  L4_INVALID_CAP = ~0UL << (L4_CAP_SHIFT - 1),
142 
143  L4_INVALID_CAP_BIT = 1UL << (L4_CAP_SHIFT - 1),
144 };
145 
146 enum l4_sched_consts_t
147 {
148  L4_SCHED_MIN_PRIO = 0,
149  L4_SCHED_MAX_PRIO = 255,
150 };
151 
158 {
165  L4_FP_ALL_SPACES = 0x80000000UL,
166 
173  L4_FP_DELETE_OBJ = 0xc0000000UL,
174 
180  L4_FP_OTHER_SPACES = 0x0UL
181 };
182 
188 {
190 
196 
197  // send
200 
201  // receive
207 
213 };
214 
220 {
224  L4_BDR_OFFSET_MASK = (1UL << 20) - 1,
225 };
226 
241 {
290 
292  L4_BASE_CAPS_LAST_P1,
294  L4_BASE_CAPS_LAST = L4_BASE_CAPS_LAST_P1 - 1
295 };
296 
307 #define L4_PAGESIZE (1UL << L4_PAGESHIFT)
308 
316 #define L4_PAGEMASK (~(L4_PAGESIZE - 1))
317 
325 #define L4_LOG2_PAGESIZE L4_PAGESHIFT
326 
334 #define L4_SUPERPAGESIZE (1UL << L4_SUPERPAGESHIFT)
335 
343 #define L4_SUPERPAGEMASK (~(L4_SUPERPAGESIZE - 1))
344 
351 #define L4_LOG2_SUPERPAGESIZE L4_SUPERPAGESHIFT
352 
363 L4_INLINE l4_addr_t l4_trunc_page(l4_addr_t address) L4_NOTHROW;
365 { return address & L4_PAGEMASK; }
366 
374 L4_INLINE l4_addr_t l4_trunc_size(l4_addr_t address, unsigned char bits) L4_NOTHROW;
375 L4_INLINE l4_addr_t l4_trunc_size(l4_addr_t address, unsigned char bits) L4_NOTHROW
376 { return address & (~0UL << bits); }
377 
388 L4_INLINE l4_addr_t l4_round_page(l4_addr_t address) L4_NOTHROW;
390 { return (address + L4_PAGESIZE - 1) & L4_PAGEMASK; }
391 
399 L4_INLINE l4_addr_t l4_round_size(l4_addr_t value, unsigned char bits) L4_NOTHROW;
400 L4_INLINE l4_addr_t l4_round_size(l4_addr_t value, unsigned char bits) L4_NOTHROW
401 { return (value + (1UL << bits) - 1) & (~0UL << bits); }
402 
411 L4_INLINE unsigned l4_bytes_to_mwords(unsigned size) L4_NOTHROW;
412 L4_INLINE unsigned l4_bytes_to_mwords(unsigned size) L4_NOTHROW
413 { return (size + sizeof(l4_umword_t) - 1) / sizeof(l4_umword_t); }
414 
421  L4_INVALID_ADDR = ~0UL
422 };
423 
428 #define L4_INVALID_PTR ((void *)L4_INVALID_ADDR)
429 
430 #ifndef NULL
431 #ifndef __cplusplus
432 # define NULL ((void *)0)
436 #else
437 # define NULL 0
438 #endif
439 #endif
440 
441 #endif /* ! __L4_SYS__INCLUDE__CONSTS_H__ */
L4_SYSF_SEND_AND_WAIT
@ L4_SYSF_SEND_AND_WAIT
Send-and-wait flags.
Definition: consts.h:113
L4_BASE_SCHEDULER_CAP
@ L4_BASE_SCHEDULER_CAP
Capability selector for the scheduler cap.
Definition: consts.h:267
L4_NOTHROW
#define L4_NOTHROW
Mark a function declaration and definition as never throwing an exception.
Definition: compiler.h:186
L4_BASE_FACTORY_CAP
@ L4_BASE_FACTORY_CAP
Capability selector for the factory.
Definition: consts.h:245
L4_INVALID_ADDR
@ L4_INVALID_ADDR
Invalid address.
Definition: consts.h:421
l4_msg_item_consts_t
l4_msg_item_consts_t
Constants for message items.
Definition: consts.h:188
L4_BDR_IO_SHIFT
@ L4_BDR_IO_SHIFT
Bit offset for the IO-buffer index.
Definition: consts.h:222
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 flex page with size bits.
Definition: consts.h:375
L4_BASE_IOMMU_CAP
@ L4_BASE_IOMMU_CAP
Capability selector for the IO-MMU cap.
Definition: consts.h:274
L4_CAP_SIZE
@ L4_CAP_SIZE
Offset of two consecutive capability selectors.
Definition: consts.h:133
L4_BASE_DEBUGGER_CAP
@ L4_BASE_DEBUGGER_CAP
Capability selector for the debugger cap.
Definition: consts.h:282
L4_BASE_THREAD_CAP
@ L4_BASE_THREAD_CAP
Capability selector for the first thread.
Definition: consts.h:247
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:412
L4_SYSF_RECV
@ L4_SYSF_RECV
Receive-phase flag.
Definition: consts.h:69
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:212
L4_SYSF_OPEN_WAIT
@ L4_SYSF_OPEN_WAIT
Open-wait flag.
Definition: consts.h:80
L4_FP_ALL_SPACES
@ L4_FP_ALL_SPACES
Flag to tell the unmap operation to unmap all child mappings including the mapping in the invoked tas...
Definition: consts.h:165
L4_SYSF_REPLY_AND_WAIT
@ L4_SYSF_REPLY_AND_WAIT
Reply-and-wait flags.
Definition: consts.h:121
L4_BASE_TASK_CAP
@ L4_BASE_TASK_CAP
Capability selector for the current task.
Definition: consts.h:243
L4_SYSF_REPLY
@ L4_SYSF_REPLY
Reply flag.
Definition: consts.h:89
L4_PAGESIZE
#define L4_PAGESIZE
Minimal page size (in bytes).
Definition: consts.h:307
L4_FP_DELETE_OBJ
@ L4_FP_DELETE_OBJ
Flag that indicates that the unmap operation on a capability shall try to delete the corresponding ob...
Definition: consts.h:173
l4_buffer_desc_consts_t
l4_buffer_desc_consts_t
Constants for buffer descriptors.
Definition: consts.h:220
L4_MAP_ITEM_GRANT
@ L4_MAP_ITEM_GRANT
Flag as grant instead of map operation.
Definition: consts.h:198
L4_CAP_SHIFT
@ L4_CAP_SHIFT
Capability index shift.
Definition: consts.h:131
L4_SYSF_NONE
@ L4_SYSF_NONE
Default flags (call to a kernel object).
Definition: consts.h:48
L4_INVALID_CAP
@ L4_INVALID_CAP
Invalid capability selector.
Definition: consts.h:141
L4_MAP_ITEM_MAP
@ L4_MAP_ITEM_MAP
Flag as usual map operation.
Definition: consts.h:199
L4_SYSF_SEND
@ L4_SYSF_SEND
Send-phase flag.
Definition: consts.h:58
l4_syscall_flags_t
l4_syscall_flags_t
Capability selector flags.
Definition: consts.h:40
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 capability.
Definition: consts.h:206
L4_SYSF_CALL
@ L4_SYSF_CALL
Call flags (combines send and receive).
Definition: consts.h:97
l4_addr_t
unsigned long l4_addr_t
Address type.
Definition: l4int.h:45
compiler.h
L4 compiler related defines.
L4_CAP_MASK
@ L4_CAP_MASK
Mask to get only the relevant bits of an l4_cap_idx_t.
Definition: consts.h:139
l4_addr_consts_t
l4_addr_consts_t
Address related constants.
Definition: consts.h:419
L4_BASE_LOG_CAP
@ L4_BASE_LOG_CAP
Capability selector for the log object.
Definition: consts.h:263
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:195
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:389
l4_default_caps_t
l4_default_caps_t
Default capabilities setup for the initial tasks.
Definition: consts.h:241
L4_BASE_PAGER_CAP
@ L4_BASE_PAGER_CAP
Capability selector for the pager gate.
Definition: consts.h:255
L4_FP_OTHER_SPACES
@ L4_FP_OTHER_SPACES
Counterpart to L4_FP_ALL_SPACES, unmap only child mappings.
Definition: consts.h:180
L4_ITEM_MAP
@ L4_ITEM_MAP
Identify a message item as map item.
Definition: consts.h:189
L4_PAGEMASK
#define L4_PAGEMASK
Mask for the page number.
Definition: consts.h:316
L4_SYSF_WAIT
@ L4_SYSF_WAIT
Wait flags (combines receive and open wait).
Definition: consts.h:105
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:364
L4_BASE_ARM_SMCCC_CAP
@ L4_BASE_ARM_SMCCC_CAP
Capability selector for the ARM SMCCC cap.
Definition: consts.h:289
l4_cap_consts_t
l4_cap_consts_t
Constants related to capability selectors.
Definition: consts.h:129
l4_umword_t
unsigned long l4_umword_t
Unsigned machine word.
Definition: l4int.h:52
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:400
L4_BASE_ICU_CAP
@ L4_BASE_ICU_CAP
Capability selector for the base icu object.
Definition: consts.h:265
L4_BDR_MEM_SHIFT
@ L4_BDR_MEM_SHIFT
Bit offset for the memory-buffer index.
Definition: consts.h:221
L4_BDR_OBJ_SHIFT
@ L4_BDR_OBJ_SHIFT
Bit offset for the capability-buffer index.
Definition: consts.h:223
l4_unmap_flags_t
l4_unmap_flags_t
Flags for the unmap operation.
Definition: consts.h:158
L4_BASE_CAPS_LAST
@ L4_BASE_CAPS_LAST
Last capability index used for base capabilities.
Definition: consts.h:294