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 #define SYSCALL_X86_FPU_TRAP_ON 7 ///< Turn FPU trap on (x86)
54 #define SYSCALL_X86_RELOAD_LDT 8 ///< Reload the LDT register (x86_64)
56 #define SYSCALL_COUNT 9 ///< Number of syscalls [0..SYSCALL_COUNT - 1]
59 * To understand system calls it might be helpful to know that there
60 * are four different levels of abstraction with multiplexing
61 * performed at three of them (compare with Tennenhouse: Layered
62 * Multiplexing Considered Harmful).
64 * At the bottom two levels of abstraction are the system call number
65 * as defined in this file. This is one point of multiplexing and two
66 * levels of abstraction; the second one comes about because the
67 * system calls defined here use non primitive C types such as
68 * "struct sysret" which have to be converted and dealt with by a
69 * level of abstraction to deal with the encoding used over the
70 * protection boundary. For example, on some architectures
71 * structures, including output structures, are passed by reference in
72 * the argument list. Therefore below the C abstraction of the system
73 * call there must be a translation to an abstraction which can cross
74 * the protection boundary.
76 * Above this is the invoke system call. It deals with two different
77 * ways of doing additional multiplexing, based on the type of the
78 * capability being invoked, and the command being invoked on the
79 * capability. This defines which kernel system call implementation
80 * is to be run. An aspect of this is that the arguments to the
81 * intended kernel code have to multiplexed up in user space onto the
82 * invoke system call and demultiplexed by the kernel, thus preventing
83 * direct dispatch to the intended implementation.
85 * Above this is the endpoint invocation in which the above system
86 * invocation system call is performed and demultiplexed, but the
87 * target capability is a special type in which the implementation
88 * code being called is not in the kernel; in this the arguments to
89 * the desired functionality must be marshalled in such a way that
90 * they can be delivered to the desired domain instead of the kernel.
92 * Knowing this will help the reader understand the various different
93 * marshalling and unmarshalling code found variously in
94 * monitor_invocations.h, invocations.h, syscalls.c, syscall_arch.h,
95 * syscall.c and related assembler.
98 #endif // BARRELFISH_SYSCALLS_H