-
Notifications
You must be signed in to change notification settings - Fork 0
/
sel4cp.h
83 lines (66 loc) · 1.63 KB
/
sel4cp.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
/*
* Copyright 2021, Breakaway Consulting Pty. Ltd.
*
* SPDX-License-Identifier: BSD-2-Clause
*/
/* seL4 Core Platform interface */
#pragma once
#include <stdint.h>
#define __thread
#include <sel4/sel4.h>
typedef unsigned int sel4cp_channel;
typedef seL4_MessageInfo_t sel4cp_msginfo;
#define BASE_OUTPUT_NOTIFICATION_CAP 10
#define BASE_ENDPOINT_CAP 74
#define BASE_IRQ_CAP 138
#define SEL4CP_MAX_CHANNELS 63
/* User provided functions */
void init(void);
void notified(sel4cp_channel ch);
sel4cp_msginfo protected(sel4cp_channel ch, sel4cp_msginfo msginfo);
extern char sel4cp_name[16];
/*
* Output a single character on the debug console.
*/
void sel4cp_dbg_putc(int c);
/*
* Output a NUL terminated string to the debug console.
*/
void sel4cp_dbg_puts(const char *s);
static inline void
sel4cp_notify(sel4cp_channel ch)
{
seL4_Signal(BASE_OUTPUT_NOTIFICATION_CAP + ch);
}
static inline void
sel4cp_irq_ack(sel4cp_channel ch)
{
seL4_IRQHandler_Ack(BASE_IRQ_CAP + ch);
}
static inline sel4cp_msginfo
sel4cp_ppcall(sel4cp_channel ch, sel4cp_msginfo msginfo)
{
// mathieu: this is not very tight, the user could pass extra stuff in the
// message info.
return seL4_Call(BASE_ENDPOINT_CAP + ch, msginfo);
}
static inline sel4cp_msginfo
sel4cp_msginfo_new(uint64_t label, uint16_t count)
{
return seL4_MessageInfo_new(label, 0, 0, count);
}
static inline uint64_t
sel4cp_msginfo_get_label(sel4cp_msginfo msginfo)
{
return seL4_MessageInfo_get_label(msginfo);
}
static void
sel4cp_mr_set(uint8_t mr, uint64_t value)
{
seL4_SetMR(mr, value);
}
static uint64_t
sel4cp_mr_get(uint8_t mr)
{
return seL4_GetMR(mr);
}