1/*
2 * Copyright 2014, General Dynamics C4 Systems
3 *
4 * This software may be distributed and modified according to the terms of
5 * the GNU General Public License version 2. Note that NO WARRANTY is provided.
6 * See "LICENSE_GPLv2.txt" for details.
7 *
8 * @TAG(GD_GPL)
9 */
10
11#ifndef __FAILURES_H
12#define __FAILURES_H
13
14#include <types.h>
15#include <api/errors.h>
16/* These datatypes differ markedly from haskell, due to the
17 * different implementation of the various fault monads */
18
19
20enum exception {
21    EXCEPTION_NONE,
22    EXCEPTION_FAULT,
23    EXCEPTION_LOOKUP_FAULT,
24    EXCEPTION_SYSCALL_ERROR,
25    EXCEPTION_PREEMPTED
26};
27typedef word_t exception_t;
28
29typedef word_t syscall_error_type_t;
30
31struct syscall_error {
32    word_t invalidArgumentNumber;
33    word_t  invalidCapNumber;
34    word_t rangeErrorMin;
35    word_t rangeErrorMax;
36    word_t memoryLeft;
37    bool_t failedLookupWasSource;
38
39    syscall_error_type_t type;
40};
41typedef struct syscall_error syscall_error_t;
42
43extern lookup_fault_t current_lookup_fault;
44extern seL4_Fault_t current_fault;
45extern syscall_error_t current_syscall_error;
46
47#endif
48