CHERIoT RTOS
A compartmentalised RTOS for CHERIoT hardware
Loading...
Searching...
No Matches
__compartment-macros.h File Reference

Helper macros used by compartment-macros.h. More...

#include <__cheri_sealed.h>
#include <cdefs.h>
#include <stdbool.h>

Go to the source code of this file.

Macros

#define IMPORT_CAPABILITY_WITH_PERMISSIONS_HELPER(type, name, prefix, mangledName, permitLoad, permitStore, permitLoadStoreCapabilities, permitLoadMutable, permitLoadGlobal)
#define CHERIOT_COMPARTMENT_MACROS_PERMIT_FLAG_true(flag)
#define CHERIOT_COMPARTMENT_MACROS_PERMIT_FLAG_1(flag)
#define CHERIOT_COMPARTMENT_MACROS_PERMIT_FLAG_false(flag)
#define CHERIOT_COMPARTMENT_MACROS_PERMIT_FLAG_0(flag)
#define CHERIOT_COMPARTMENT_MACROS_PERMIT_FLAG(cond, flag)
#define CHERIOT_COMPARTMENT_MACROS_JOIN_FLAGS(pL, pS, pC, pM, pG)
#define CHERIOT_COMPARTMENT_MACROS_TOKEN_PASTE_INNER(x, y)
#define CHERIOT_COMPARTMENT_MACROS_TOKEN_PASTE(x, y)
#define MMIO_CAPABILITY_WITH_PERMISSIONS_HELPER( type, name, mangledName, permitLoad, permitStore, permitLoadStoreCapabilities, permitLoadMutable, permitLoadGlobal)
#define CHERIOT_EMIT_STATIC_SEALING_TYPE(name)
#define COMPARTMENT_NAME_STRING   __XSTRING(__CHERI_COMPARTMENT__)

Detailed Description

Helper macros used by compartment-macros.h.

Do not use any of the macros in this file directly.

These are separated to make the documentation of compartment-macros.h cleaner.

Definition in file __compartment-macros.h.

Macro Definition Documentation

◆ CHERIOT_COMPARTMENT_MACROS_JOIN_FLAGS

#define CHERIOT_COMPARTMENT_MACROS_JOIN_FLAGS ( pL,
pS,
pC,
pM,
pG )
Value:
CHERIOT_COMPARTMENT_MACROS_PERMIT_FLAG(pL, "R") \
CHERIOT_COMPARTMENT_MACROS_PERMIT_FLAG(pS, "W") \
CHERIOT_COMPARTMENT_MACROS_PERMIT_FLAG(pC, "c") \
CHERIOT_COMPARTMENT_MACROS_PERMIT_FLAG(pM, "m") \
CHERIOT_COMPARTMENT_MACROS_PERMIT_FLAG(pG, "g")

Definition at line 71 of file __compartment-macros.h.

◆ CHERIOT_COMPARTMENT_MACROS_PERMIT_FLAG

#define CHERIOT_COMPARTMENT_MACROS_PERMIT_FLAG ( cond,
flag )
Value:
CHERIOT_COMPARTMENT_MACROS_PERMIT_FLAG_##cond(flag)

Definition at line 67 of file __compartment-macros.h.

◆ CHERIOT_COMPARTMENT_MACROS_PERMIT_FLAG_0

#define CHERIOT_COMPARTMENT_MACROS_PERMIT_FLAG_0 ( flag)
Value:
""

Definition at line 65 of file __compartment-macros.h.

◆ CHERIOT_COMPARTMENT_MACROS_PERMIT_FLAG_1

#define CHERIOT_COMPARTMENT_MACROS_PERMIT_FLAG_1 ( flag)
Value:
flag

Definition at line 63 of file __compartment-macros.h.

◆ CHERIOT_COMPARTMENT_MACROS_PERMIT_FLAG_false

#define CHERIOT_COMPARTMENT_MACROS_PERMIT_FLAG_false ( flag)
Value:
""

Definition at line 64 of file __compartment-macros.h.

◆ CHERIOT_COMPARTMENT_MACROS_PERMIT_FLAG_true

#define CHERIOT_COMPARTMENT_MACROS_PERMIT_FLAG_true ( flag)
Value:
flag

Definition at line 62 of file __compartment-macros.h.

◆ CHERIOT_COMPARTMENT_MACROS_TOKEN_PASTE

#define CHERIOT_COMPARTMENT_MACROS_TOKEN_PASTE ( x,
y )
Value:
CHERIOT_COMPARTMENT_MACROS_TOKEN_PASTE_INNER(x, y)

Definition at line 79 of file __compartment-macros.h.

◆ CHERIOT_COMPARTMENT_MACROS_TOKEN_PASTE_INNER

#define CHERIOT_COMPARTMENT_MACROS_TOKEN_PASTE_INNER ( x,
y )
Value:
x##y

Definition at line 78 of file __compartment-macros.h.

◆ CHERIOT_EMIT_STATIC_SEALING_TYPE

#define CHERIOT_EMIT_STATIC_SEALING_TYPE ( name)

Definition at line 190 of file __compartment-macros.h.

◆ COMPARTMENT_NAME_STRING

#define COMPARTMENT_NAME_STRING   __XSTRING(__CHERI_COMPARTMENT__)

Definition at line 231 of file __compartment-macros.h.

◆ IMPORT_CAPABILITY_WITH_PERMISSIONS_HELPER

#define IMPORT_CAPABILITY_WITH_PERMISSIONS_HELPER ( type,
name,
prefix,
mangledName,
permitLoad,
permitStore,
permitLoadStoreCapabilities,
permitLoadMutable,
permitLoadGlobal )
Value:
({ \
type *ret; /* NOLINT(bugprone-macro-parentheses) */ \
__asm(".ifndef " mangledName "\n" \
" .type " mangledName ",@object\n" \
" .section .compartment_imports." #name \
",\"awG\",@progbits," mangledName ",comdat\n" \
" .globl " mangledName "\n" \
" .p2align 3\n" mangledName ":\n" \
" .word " #prefix #name "\n" \
" .word " #prefix #name "_end - " #prefix #name " + %c1\n" \
" .size " mangledName ", 8\n" \
" .previous\n" \
".endif\n" \
"1:" \
" auipcc %0," \
" %%cheriot_compartment_hi(" mangledName ")\n" \
" clc %0, %%cheriot_compartment_lo_i(1b)(%0)\n" \
: "=C"(ret) \
: "i"(((permitLoad) ? (1 << 31) : 0) + \
((permitStore) ? (1 << 30) : 0) + \
((permitLoadStoreCapabilities) ? (1 << 29) : 0) + \
((permitLoadMutable) ? (1 << 28) : 0) + \
((permitLoadGlobal) ? (1 << 27) : 0))); \
ret; \
})

Definition at line 26 of file __compartment-macros.h.

◆ MMIO_CAPABILITY_WITH_PERMISSIONS_HELPER

#define MMIO_CAPABILITY_WITH_PERMISSIONS_HELPER ( type,
name,
mangledName,
permitLoad,
permitStore,
permitLoadStoreCapabilities,
permitLoadMutable,
permitLoadGlobal )
Value:
IMPORT_CAPABILITY_WITH_PERMISSIONS_HELPER(type, \
name, \
__export_mem_, \
mangledName, \
permitLoad, \
permitStore, \
permitLoadStoreCapabilities, \
permitLoadMutable, \
permitLoadGlobal)

Definition at line 124 of file __compartment-macros.h.