1 /*
2  * Copyright 2020, Data61, CSIRO (ABN 41 687 119 230)
3  * Copyright 2015, 2016 Hesham Almatary <heshamelmatary@gmail.com>
4  *
5  * SPDX-License-Identifier: BSD-2-Clause
6  */
7 
8 #pragma once
9 
10 #include <autoconf.h>
11 #include <sel4/macros.h>
12 
13 #define seL4_WordBits           64
14 /* log 2 bits in a word */
15 #define seL4_WordSizeBits       3
16 
17 #define seL4_SlotBits           5
18 #ifdef CONFIG_KERNEL_MCS
19 #define seL4_NotificationBits   6
20 #define seL4_ReplyBits          5
21 #else
22 #define seL4_NotificationBits   5
23 #endif
24 #define seL4_EndpointBits       4
25 #define seL4_IPCBufferSizeBits  10
26 #ifdef CONFIG_HAVE_FPU
27 #define seL4_TCBBits            11
28 #else
29 #define seL4_TCBBits            10
30 #endif
31 
32 /* Sv39/Sv48 pages/ptes sizes */
33 #define seL4_PageTableEntryBits 3
34 #define seL4_PageTableIndexBits 9
35 
36 #define seL4_PageBits          12
37 #define seL4_LargePageBits     21
38 #define seL4_HugePageBits      30
39 #define seL4_TeraPageBits      39
40 #define seL4_PageTableBits     12
41 #define seL4_VSpaceBits        seL4_PageTableBits
42 
43 #define seL4_NumASIDPoolsBits   7
44 #define seL4_ASIDPoolIndexBits  9
45 #define seL4_ASIDPoolBits       12
46 
47 /* Untyped size limits */
48 #define seL4_MinUntypedBits     4
49 #define seL4_MaxUntypedBits     38
50 #ifndef __ASSEMBLER__
51 
52 typedef enum {
53     seL4_VMFault_IP,
54     seL4_VMFault_Addr,
55     seL4_VMFault_PrefetchFault,
56     seL4_VMFault_FSR,
57     seL4_VMFault_Length,
58 } seL4_VMFault_Msg;
59 
60 typedef enum {
61     seL4_UnknownSyscall_FaultIP,
62     seL4_UnknownSyscall_SP,
63     seL4_UnknownSyscall_RA,
64     seL4_UnknownSyscall_A0,
65     seL4_UnknownSyscall_A1,
66     seL4_UnknownSyscall_A2,
67     seL4_UnknownSyscall_A3,
68     seL4_UnknownSyscall_A4,
69     seL4_UnknownSyscall_A5,
70     seL4_UnknownSyscall_A6,
71     seL4_UnknownSyscall_Syscall,
72     seL4_UnknownSyscall_Length,
73 } seL4_UnknownSyscall_Msg;
74 
75 typedef enum {
76     seL4_UserException_FaultIP,
77     seL4_UserException_SP,
78     seL4_UserException_Number,
79     seL4_UserException_Code,
80     seL4_UserException_Length,
81 } seL4_UserException_Msg;
82 
83 #ifdef CONFIG_KERNEL_MCS
84 typedef enum {
85     seL4_TimeoutReply_FaultIP,
86     seL4_TimeoutReply_LR,
87     seL4_TimeoutReply_SP,
88     seL4_TimeoutReply_GP,
89     seL4_TimeoutReply_s0,
90     seL4_TimeoutReply_s1,
91     seL4_TimeoutReply_s2,
92     seL4_TimeoutReply_s3,
93     seL4_TimeoutReply_s4,
94     seL4_TimeoutReply_s5,
95     seL4_TimeoutReply_s6,
96     seL4_TimeoutReply_s7,
97     seL4_TimeoutReply_s8,
98     seL4_TimeoutReply_s9,
99     seL4_TimeoutReply_s10,
100     seL4_TimeoutReply_s11,
101     seL4_TimeoutReply_a0,
102     seL4_TimeoutReply_a1,
103     seL4_TimeoutReply_a2,
104     seL4_TimeoutReply_a3,
105     seL4_TimeoutReply_a4,
106     seL4_TimeoutReply_a5,
107     seL4_TimeoutReply_a6,
108     seL4_TimeoutReply_a7,
109     seL4_TimeoutReply_t0,
110     seL4_TimeoutReply_t1,
111     seL4_TimeoutReply_t2,
112     seL4_TimeoutReply_t3,
113     seL4_TimeoutReply_t4,
114     seL4_TimeoutReply_t5,
115     seL4_TimeoutReply_t6,
116     seL4_TimeoutReply_TP,
117     seL4_TimeoutReply_Length,
118 } seL4_TimeoutReply_Msg;
119 
120 typedef enum {
121     seL4_Timeout_Data,
122     seL4_Timeout_Consumed,
123     seL4_Timeout_Length,
124 } seL4_TimeoutMsg;
125 #endif
126 #endif /* __ASSEMBLER__ */
127 
128 /* First address in the virtual address space that is not accessible to user level */
129 #define seL4_UserTop 0x0000003ffffff000
130 
131 #ifdef CONFIG_ENABLE_BENCHMARKS
132 /* size of kernel log buffer in bytes */
133 #define seL4_LogBufferSize (LIBSEL4_BIT(20))
134 #endif /* CONFIG_ENABLE_BENCHMARKS */
135