L4Re Operating System Framework
Interface and Usage Documentation
Loading...
Searching...
No Matches
types.h
Go to the documentation of this file.
1/*****************************************************************************/
8/*
9 * (c) 2008-2013 Adam Lackorzynski <adam@os.inf.tu-dresden.de>,
10 * Alexander Warg <warg@os.inf.tu-dresden.de>,
11 * Björn Döbel <doebel@os.inf.tu-dresden.de>,
12 * Torsten Frenzel <frenzel@os.inf.tu-dresden.de>
13 * economic rights: Technische Universität Dresden (Germany)
14 *
15 * License: see LICENSE.spdx (in this directory or the directories above)
16 */
17/*****************************************************************************/
18#pragma once
19
20#include <l4/sys/l4int.h>
21#include <l4/sys/compiler.h>
22#include <l4/sys/consts.h>
23
30
37
38
46
86
87enum L4_varg_type
88{
89 L4_VARG_TYPE_NIL = 0x00,
90 L4_VARG_TYPE_UMWORD = 0x01,
91 L4_VARG_TYPE_MWORD = 0x81,
92 L4_VARG_TYPE_STRING = 0x02,
93 L4_VARG_TYPE_FPAGE = 0x03,
94
95 L4_VARG_TYPE_SIGN = 0x80,
96};
97
98
104{
105 // flags for received IPC
111
112 // flags for sending IPC
144 L4_MSGTAG_PROPAGATE = 0x4000,
145
151};
152
153typedef struct l4_msgtag_t l4_msgtag_t;
154
164
174
184
196
210
220
230
240
250
251
269{
271#ifdef __cplusplus
273 long label() const L4_NOTHROW { return l4_msgtag_label(*this); }
275 void label(long v) L4_NOTHROW { raw = (raw & 0x0ffff) | ((l4_umword_t)v << 16); }
277 unsigned words() const L4_NOTHROW { return l4_msgtag_words(*this); }
279 unsigned items() const L4_NOTHROW { return l4_msgtag_items(*this); }
286 unsigned flags() const L4_NOTHROW { return l4_msgtag_flags(*this); }
289 { return l4_msgtag_is_page_fault(*this); }
290
292 { return l4_msgtag_is_exception(*this); }
293
294 bool is_sigma0() const L4_NOTHROW { return l4_msgtag_is_sigma0(*this); }
297 { return l4_msgtag_is_io_page_fault(*this); }
298
302 bool has_error() const L4_NOTHROW { return l4_msgtag_has_error(*this); }
303#endif
304};
305
306// The following declaration should be _after_ the definition of struct
307// l4_msgtag_t. Circumvents a clang warning about a *potentially*
308// incompatibility with C if the type is incomplete when the function is
309// declared.
310
322L4_INLINE l4_msgtag_t l4_msgtag(long label, unsigned words, unsigned items,
323 unsigned flags) L4_NOTHROW;
324
325
338
372typedef unsigned long l4_cap_idx_t;
373
384
395
410
420
421/* ************************************************************************* */
422/* Implementation */
423
424L4_INLINE unsigned
426{ return c & L4_INVALID_CAP_BIT; }
427
428L4_INLINE unsigned
430{ return !(c & L4_INVALID_CAP_BIT); }
431
432L4_INLINE unsigned
435
436
441l4_msgtag_t l4_msgtag(long label, unsigned words, unsigned items,
442 unsigned flags) L4_NOTHROW
443{
444 return (l4_msgtag_t){ (l4_mword_t)((l4_umword_t)label << 16)
445 | (l4_mword_t)(words & 0x3f)
446 | (l4_mword_t)((items & 0x3f) << 6)
447 | (l4_mword_t)(flags & 0xf000)};
448}
449
450
451
454{
455#if defined(__cplusplus) && (__cplusplus >= 202002L)
456 return t.raw >> 16;
457#else
458 return t.raw < 0 ? ~(~t.raw >> 16) : t.raw >> 16;
459#endif
460}
461
464{ return t.raw & 0x3f; }
465
468{ return (t.raw >> 6) & 0x3f; }
469
472{ return t.raw & 0xf000; }
473
474
478
479
480
483
486
489
492
495
496#include <l4/sys/__l4_fpage.h>
497#include <l4/sys/__timeout.h>
L4 compiler related defines.
unsigned long l4_umword_t
Unsigned machine word.
Definition l4int.h:40
signed long l4_mword_t
Signed machine word.
Definition l4int.h:37
signed short int l4_int16_t
Signed 16bit value.
Definition l4int.h:26
#define L4_CAP_OFFSET
Offset of two consecutive capability selectors.
Definition consts.h:154
unsigned long l4_cap_idx_t
Capability selector type.
Definition types.h:372
unsigned l4_is_invalid_cap(l4_cap_idx_t c) L4_NOTHROW
Test if a capability selector is the invalid capability.
Definition types.h:425
unsigned l4_capability_equal(l4_cap_idx_t c1, l4_cap_idx_t c2) L4_NOTHROW
Test if the capability indices of two capability selectors are equal.
Definition types.h:433
unsigned l4_is_valid_cap(l4_cap_idx_t c) L4_NOTHROW
Test if a capability selector is a valid selector.
Definition types.h:429
#define L4_CAP_SHIFT
Capability index shift; see l4_cap_idx_t.
Definition consts.h:143
unsigned l4_msgtag_is_sigma0(l4_msgtag_t t) L4_NOTHROW
Test for sigma0 protocol.
Definition types.h:487
unsigned l4_msgtag_is_exception(l4_msgtag_t t) L4_NOTHROW
Test for exception protocol.
Definition types.h:484
L4_msgtag_flags
Flags for message tags.
Definition types.h:104
unsigned l4_msgtag_items(l4_msgtag_t t) L4_NOTHROW
Get the number of typed items.
Definition types.h:467
unsigned l4_msgtag_is_io_page_fault(l4_msgtag_t t) L4_NOTHROW
Test for IO-page-fault protocol.
Definition types.h:490
unsigned l4_msgtag_has_error(l4_msgtag_t t) L4_NOTHROW
Test for error indicator flag.
Definition types.h:476
l4_msgtag_t l4_msgtag(long label, unsigned words, unsigned items, unsigned flags) L4_NOTHROW
Create a message tag from the specified values.
Definition types.h:441
unsigned l4_msgtag_words(l4_msgtag_t t) L4_NOTHROW
Get the number of untyped words.
Definition types.h:463
L4_msgtag_protocol
Message tag for IPC operations.
Definition types.h:54
unsigned l4_msgtag_flags(l4_msgtag_t t) L4_NOTHROW
Get the flags.
Definition types.h:471
long l4_msgtag_label(l4_msgtag_t t) L4_NOTHROW
Get the protocol of tag.
Definition types.h:453
unsigned l4_msgtag_is_page_fault(l4_msgtag_t t) L4_NOTHROW
Test for page-fault protocol.
Definition types.h:481
@ L4_MSGTAG_FLAGS
Mask for all flags.
Definition types.h:150
@ L4_MSGTAG_ERROR
Error indicator flag.
Definition types.h:110
@ L4_MSGTAG_SCHEDULE
Enable schedule in IPC flag.
Definition types.h:131
@ L4_MSGTAG_TRANSFER_FPU
Enable FPU transfer flag for IPC.
Definition types.h:122
@ L4_PROTO_PLATFORM_CTL
Platform control.
Definition types.h:59
@ L4_PROTO_IRQ
IRQ message.
Definition types.h:60
@ L4_PROTO_FACTORY
Protocol for messages to a factory object.
Definition types.h:73
@ L4_PROTO_DMA_SPACE
Protocol for (creating) kernel DMA space objects.
Definition types.h:75
@ L4_PROTO_SCHEDULER
Protocol for messages to a scheduler object.
Definition types.h:72
@ L4_PROTO_EXCEPTION
Exception.
Definition types.h:64
@ L4_PROTO_IRQ_SENDER
Protocol for IRQ senders (IRQ -> IPC).
Definition types.h:76
@ L4_PROTO_KOBJECT
Protocol for messages to a generic kobject.
Definition types.h:68
@ L4_PROTO_TASK
Protocol for messages to a task object.
Definition types.h:69
@ L4_PROTO_IO_PAGE_FAULT
I/O page fault message.
Definition types.h:66
@ L4_PROTO_NONE
Default protocol tag to reply to kernel.
Definition types.h:55
@ L4_PROTO_VM
Protocol for messages to a virtual machine object.
Definition types.h:74
@ L4_PROTO_SIGMA0
Sigma0 protocol.
Definition types.h:65
@ L4_PROTO_THREAD_GROUP
Protocol for messages to a thread group obj.
Definition types.h:67
@ L4_PROTO_THREAD
Protocol for messages to a thread object.
Definition types.h:70
@ L4_PROTO_PF_EXCEPTION
Make an exception out of a page fault.
Definition types.h:57
@ L4_PROTO_META
Meta information protocol.
Definition types.h:79
@ L4_PROTO_PAGE_FAULT
Page fault message.
Definition types.h:61
@ L4_PROTO_IOMMU
Protocol ID for IO-MMUs.
Definition types.h:80
@ L4_PROTO_PI_MUTEX
Protocol for priority inheritance mutex.
Definition types.h:84
@ L4_PROTO_ALLOW_SYSCALL
Allow an alien the system call.
Definition types.h:56
@ L4_PROTO_SEMAPHORE
Protocol for semaphore objects.
Definition types.h:78
@ L4_PROTO_LOG
Protocol for messages to a log object.
Definition types.h:71
@ L4_PROTO_DEBUGGER
Protocol ID for the debugger.
Definition types.h:81
@ L4_PROTO_VCPU_CONTEXT
Protocol for hardware vCPU contexts.
Definition types.h:83
@ L4_PROTO_SMCCC
Protocol ID for ARM SMCCC calls.
Definition types.h:82
#define L4_NOTHROW
Mark a function declaration and definition as never throwing an exception.
Definition compiler.h:167
#define L4_INLINE
L4 Inline function attribute.
Definition compiler.h:51
Common constants.
Fixed sized integer types, generic version.
l4_cap_idx_t l4_capability_next(l4_cap_idx_t c) L4_NOTHROW
Get the next capability selector after c.
Definition types.h:493
l4_int16_t l4_proto_t
Prototype value for RPC calls.
Definition types.h:36
l4_int16_t l4_ret_t
Return value of an IPC call as well as an RPC call.
Definition types.h:29
Message tag data structure.
Definition types.h:269
long label() const L4_NOTHROW
Get the protocol value.
Definition types.h:273
bool is_page_fault() const L4_NOTHROW
Test if protocol indicates page-fault protocol.
Definition types.h:288
bool is_sigma0() const L4_NOTHROW
Test if protocol indicates sigma0 protocol.
Definition types.h:294
bool has_error() const L4_NOTHROW
Test if flags indicate an error.
Definition types.h:302
void label(long v) L4_NOTHROW
Set the protocol value.
Definition types.h:275
bool is_exception() const L4_NOTHROW
Test if protocol indicates exception protocol.
Definition types.h:291
unsigned words() const L4_NOTHROW
Get the number of untyped words.
Definition types.h:277
bool is_io_page_fault() const L4_NOTHROW
Test if protocol indicates IO-page-fault protocol.
Definition types.h:296
unsigned items() const L4_NOTHROW
Get the number of typed items.
Definition types.h:279
l4_mword_t raw
raw value
Definition types.h:270
unsigned flags() const L4_NOTHROW
Get the flags value.
Definition types.h:286