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