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
20 /// return type from a system call: two words
26 /// Macro used for constructing return values from single-value syscalls
27 #define SYSRET(x) (struct sysret){ .error = x, .value = 0 }
28 #endif // __ASSEMBLER__
31 * These are the system call ordinals. Please keep the space contiguous
32 * as far as possible and make sure SYSCALL_COUNT is the number of system
33 * calls. Lower layers may build direct-mapped syscall tables and so
34 * compactness is a virtue.
37 /* Proper Barrelfish system calls */
38 #define SYSCALL_INVOKE 0 ///< Invoke a cap
39 #define SYSCALL_YIELD 1 ///< Yield the CPU
40 #define SYSCALL_LRPC 2 ///< Fast LRPC
42 /* Debug/Benchmarking system calls */
43 #define SYSCALL_DEBUG 3 ///< Benchmarking and debug syscalls
44 #define SYSCALL_REBOOT 4 ///< Reboot the machine
45 #define SYSCALL_NOP 5 ///< No operation
46 #define SYSCALL_PRINT 6 ///< Write to console
48 /* Architecture-specific syscalls
49 * FIXME: shouldn't these be in an arch-specific header? -AB */
50 #define SYSCALL_X86_FPU_TRAP_ON 7 ///< Turn FPU trap on (x86)
51 #define SYSCALL_X86_RELOAD_LDT 8 ///< Reload the LDT register (x86_64)
53 #define SYSCALL_COUNT 9 ///< Number of syscalls [0..SYSCALL_COUNT - 1]
56 * To understand system calls it might be helpful to know that there
57 * are four different levels of abstraction with multiplexing
58 * performed at three of them (compare with Tennenhouse: Layered
59 * Multiplexing Considered Harmful).
61 * At the bottom two levels of abstraction are the system call number
62 * as defined in this file. This is one point of multiplexing and two
63 * levels of abstraction; the second one comes about because the
64 * system calls defined here use non primitive C types such as
65 * "struct sysret" which have to be converted and dealt with by a
66 * level of abstraction to deal with the encoding used over the
67 * protection boundary. For example, on some architectures
68 * structures, including output structures, are passed by reference in
69 * the argument list. Therefore below the C abstraction of the system
70 * call there must be a translation to an abstraction which can cross
71 * the protection boundary.
73 * Above this is the invoke system call. It deals with two different
74 * ways of doing additional multiplexing, based on the type of the
75 * capability being invoked, and the command being invoked on the
76 * capability. This defines which kernel system call implementation
77 * is to be run. An aspect of this is that the arguments to the
78 * intended kernel code have to multiplexed up in user space onto the
79 * invoke system call and demultiplexed by the kernel, thus preventing
80 * direct dispatch to the intended implementation.
82 * Above this is the endpoint invocation in which the above system
83 * invocation system call is performed and demultiplexed, but the
84 * target capability is a special type in which the implementation
85 * code being called is not in the kernel; in this the arguments to
86 * the desired functionality must be marshalled in such a way that
87 * they can be delivered to the desired domain instead of the kernel.
89 * Knowing this will help the reader understand the various different
90 * marshalling and unmarshalling code found variously in
91 * monitor_invocations.h, invocations.h, syscalls.c, syscall_arch.h,
92 * syscall.c and related assembler.
95 #endif // BARRELFISH_SYSCALLS_H