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 __API_SYSCALL_H
12#define __API_SYSCALL_H
13
14#include <config.h> // for arch/api/syscall.h
15#include <machine.h>
16#include <api/failures.h>
17#include <model/statedata.h>
18#include <kernel/vspace.h>
19#include <arch/api/syscall.h>
20#include <api/debug.h>
21
22exception_t handleSyscall(syscall_t syscall);
23exception_t handleInterruptEntry(void);
24exception_t handleUnknownSyscall(word_t w);
25exception_t handleUserLevelFault(word_t w_a, word_t w_b);
26exception_t handleVMFaultEvent(vm_fault_type_t vm_faultType);
27
28static inline word_t PURE
29getSyscallArg(word_t i, word_t* ipc_buffer)
30{
31    if (i < n_msgRegisters) {
32        return getRegister(NODE_STATE(ksCurThread), msgRegisters[i]);
33    }
34
35    assert(ipc_buffer != NULL);
36    return ipc_buffer[i + 1];
37}
38
39extern extra_caps_t current_extra_caps;
40
41#endif
42