1 /*
2  * Copyright 2014, General Dynamics C4 Systems
3  *
4  * SPDX-License-Identifier: GPL-2.0-only
5  */
6 
7 #pragma once
8 
9 #include <types.h>
10 #include <sel4/errors.h>
11 #include <sel4/constants.h>
12 /* These datatypes differ markedly from haskell, due to the
13  * different implementation of the various fault monads */
14 
15 
16 enum exception {
17     EXCEPTION_NONE,
18     EXCEPTION_FAULT,
19     EXCEPTION_LOOKUP_FAULT,
20     EXCEPTION_SYSCALL_ERROR,
21     EXCEPTION_PREEMPTED
22 };
23 typedef word_t exception_t;
24 
25 typedef word_t syscall_error_type_t;
26 
27 struct syscall_error {
28     word_t invalidArgumentNumber;
29     word_t  invalidCapNumber;
30     word_t rangeErrorMin;
31     word_t rangeErrorMax;
32     word_t memoryLeft;
33     bool_t failedLookupWasSource;
34 
35     syscall_error_type_t type;
36 };
37 typedef struct syscall_error syscall_error_t;
38 
39 #ifdef CONFIG_KERNEL_INVOCATION_REPORT_ERROR_IPC
40 struct debug_syscall_error {
41     word_t errorMessage[DEBUG_MESSAGE_MAXLEN];
42 };
43 typedef struct debug_syscall_error debug_syscall_error_t;
44 
45 extern debug_syscall_error_t current_debug_error;
46 #endif
47 extern lookup_fault_t current_lookup_fault;
48 extern seL4_Fault_t current_fault;
49 extern syscall_error_t current_syscall_error;
50 
51