1/*
2 * Copyright 2017, Data61
3 * Commonwealth Scientific and Industrial Research Organisation (CSIRO)
4 * ABN 41 687 119 230.
5 *
6 * This software may be distributed and modified according to the terms of
7 * the BSD 2-Clause license. Note that NO WARRANTY is provided.
8 * See "LICENSE_BSD2.txt" for details.
9 *
10 * @TAG(DATA61_BSD)
11 */
12
13#ifndef __LIBSEL4_SHARED_TYPES_H
14#define __LIBSEL4_SHARED_TYPES_H
15
16/* this file is shared between the kernel and libsel4 */
17
18typedef struct seL4_IPCBuffer_ {
19    seL4_MessageInfo_t tag;
20    seL4_Word msg[seL4_MsgMaxLength];
21    seL4_Word userData;
22    seL4_Word caps_or_badges[seL4_MsgMaxExtraCaps];
23    seL4_CPtr receiveCNode;
24    seL4_CPtr receiveIndex;
25    seL4_Word receiveDepth;
26    seL4_Word reserved;
27} seL4_IPCBuffer __attribute__ ((__aligned__ (sizeof(struct seL4_IPCBuffer_))));
28
29enum {
30    seL4_CapFault_IP,
31    seL4_CapFault_Addr,
32    seL4_CapFault_InRecvPhase,
33    seL4_CapFault_LookupFailureType,
34    seL4_CapFault_BitsLeft,
35    seL4_CapFault_DepthMismatch_BitsFound,
36    seL4_CapFault_GuardMismatch_GuardFound = seL4_CapFault_DepthMismatch_BitsFound,
37    seL4_CapFault_GuardMismatch_BitsFound,
38    SEL4_FORCE_LONG_ENUM(seL4_CapFault_Msg),
39} seL4_CapFault_Msg;
40
41#define seL4_ReadWrite seL4_CapRights_new(0, 1, 1)
42#define seL4_AllRights seL4_CapRights_new(1, 1, 1)
43#define seL4_CanRead   seL4_CapRights_new(0, 1, 0)
44#define seL4_CanWrite  seL4_CapRights_new(0, 0, 1)
45#define seL4_CanGrant  seL4_CapRights_new(1, 0, 0)
46#define seL4_NoWrite   seL4_CapRights_new(1, 1, 0)
47#define seL4_NoRead    seL4_CapRights_new(1, 0, 1)
48#define seL4_NoRights  seL4_CapRights_new(0, 0, 0)
49
50#endif
51