CHERIoT RTOS
A compartmentalised RTOS for CHERIoT hardware
Toggle main menu visibility
Loading...
Searching...
No Matches
sdk
include
simulator.h
1
// Copyright Microsoft and CHERIoT Contributors.
2
// SPDX-License-Identifier: MIT
3
4
#pragma once
5
#include <compartment.h>
6
#include <errno.h>
7
#include <stdint.h>
8
9
#ifdef SIMULATION
10
/**
11
* Exit simulation, reporting the error code given as the argument.
12
*/
13
[[cheriot::interrupt_state(disabled)]]
int
__cheri_compartment(
"scheduler"
)
14
scheduler_simulation_exit(uint32_t code __if_cxx(= 0));
15
#endif
16
17
/**
18
* Exit the simulation, if we can, or fall back to an infinite loop.
19
*/
20
static
inline
void
__attribute__((noreturn))
21
simulation_exit(uint32_t code __if_cxx(= 0))
22
{
23
#ifdef SIMULATION
24
/*
25
* This fails only if either we are out of (trusted) stack space for the
26
* cross-call or the platform is misconfigured. If either of those happen,
27
* fall back to infinite looping.
28
*/
29
(void)scheduler_simulation_exit(code);
30
#endif
31
32
while
(
true
)
33
{
34
yield();
35
}
36
};
Generated by
1.18.0