3 * \brief System call numbers.
7 * Copyright (c) 2007, 2008, 2009, 2010, ETH Zurich.
10 * This file is distributed under the terms in the attached LICENSE file.
11 * If you do not find this file, copies can be found by writing to:
12 * ETH Zurich D-INFK, Haldeneggsteig 4, CH-8092 Zurich. Attn: Systems Group.
15 #ifndef BARRELFISH_SYSCALLS_H
16 #define BARRELFISH_SYSCALLS_H
21 #include <errors/errno.h>
23 /// return type from a system call: two words
29 /// Macro used for constructing return values from single-value syscalls
30 #define SYSRET(x) (struct sysret){ /*error*/ x, /*value*/ 0 }
31 #endif // __ASSEMBLER__
34 * These are the system call ordinals. Please keep the space contiguous
35 * as far as possible and make sure SYSCALL_COUNT is the number of system
36 * calls. Lower layers may build direct-mapped syscall tables and so
37 * compactness is a virtue.
40 /* Proper Barrelfish system calls */
41 #define SYSCALL_INVOKE 0 ///< Invoke a cap
42 #define SYSCALL_YIELD 1 ///< Yield the CPU
43 #define SYSCALL_LRPC 2 ///< Fast LRPC
45 /* Debug/Benchmarking system calls */
46 #define SYSCALL_DEBUG 3 ///< Benchmarking and debug syscalls
47 #define SYSCALL_REBOOT 4 ///< Reboot the machine
48 #define SYSCALL_NOP 5 ///< No operation
49 #define SYSCALL_PRINT 6 ///< Write to console
51 /* Architecture-specific syscalls
52 * FIXME: shouldn't these be in an arch-specific header? -AB */
53 #ifdef __ARM_ARCH_7M__ //cortex-m3 on pandaboard
54 //overwrite unused syscall instead of creating yet another global one
55 #define SYSCALL_RESUME_CONTEXT 7 ///< Resume a context that the dispatcher can't
57 #define SYSCALL_X86_FPU_TRAP_ON 7 ///< Turn FPU trap on (x86)
58 #endif //__ARM_ARCH_7M__
61 #define SYSCALL_X86_RELOAD_LDT 8 ///< Reload the LDT register (x86_64)
62 #define SYSCALL_SUSPEND 9 ///< Suspend the CPU
63 #define SYSCALL_GET_ABS_TIME 10 ///< Get time elapsed since boot
65 #define SYSCALL_DEBUG_PRINT_CAPABILITIES 11
67 #define SYSCALL_COUNT 12 ///< Number of syscalls [0..SYSCALL_COUNT - 1]
70 * To understand system calls it might be helpful to know that there
71 * are four different levels of abstraction with multiplexing
72 * performed at three of them (compare with Tennenhouse: Layered
73 * Multiplexing Considered Harmful).
75 * At the bottom two levels of abstraction are the system call number
76 * as defined in this file. This is one point of multiplexing and two
77 * levels of abstraction; the second one comes about because the
78 * system calls defined here use non primitive C types such as
79 * "struct sysret" which have to be converted and dealt with by a
80 * level of abstraction to deal with the encoding used over the
81 * protection boundary. For example, on some architectures
82 * structures, including output structures, are passed by reference in
83 * the argument list. Therefore below the C abstraction of the system
84 * call there must be a translation to an abstraction which can cross
85 * the protection boundary.
87 * Above this is the invoke system call. It deals with two different
88 * ways of doing additional multiplexing, based on the type of the
89 * capability being invoked, and the command being invoked on the
90 * capability. This defines which kernel system call implementation
91 * is to be run. An aspect of this is that the arguments to the
92 * intended kernel code have to multiplexed up in user space onto the
93 * invoke system call and demultiplexed by the kernel, thus preventing
94 * direct dispatch to the intended implementation.
96 * Above this is the endpoint invocation in which the above system
97 * invocation system call is performed and demultiplexed, but the
98 * target capability is a special type in which the implementation
99 * code being called is not in the kernel; in this the arguments to
100 * the desired functionality must be marshalled in such a way that
101 * they can be delivered to the desired domain instead of the kernel.
103 * Knowing this will help the reader understand the various different
104 * marshalling and unmarshalling code found variously in
105 * monitor_invocations.h, invocations.h, syscalls.c, syscall_arch.h,
106 * syscall.c and related assembler.
109 #endif // BARRELFISH_SYSCALLS_H