The manual
ginnOS
The reference: libc, the libraries and the kernel
Loading...
Searching...
No Matches
syscall.h
Go to the documentation of this file.
1#pragma once
2
3#include "common/stdint.h"
4
5// syscall vector number (int 0x80)
6#define SYSCALL_VECTOR 0x80
7
8// syscall numbers (EAX)
9#define SYS_EXIT 0
10#define SYS_WRITE 1
11#define SYS_READ 2
12#define SYS_OPEN 3
13#define SYS_CLOSE 4
14#define SYS_STAT 5
15#define SYS_CREATE 6 // retired: create() is open(O_CREAT | O_WRONLY | O_TRUNC)
16#define SYS_MKDIR 7
17#define SYS_EXEC 8
18#define SYS_GETPID 9
19#define SYS_WAITPID 10
20#define SYS_SBRK 11
21#define SYS_GETCWD 12
22#define SYS_CHDIR 13
23#define SYS_READDIR 14 // retired: use SYS_GETDENTS
24#define SYS_UNLINK 15
25#define SYS_RMDIR 16
26#define SYS_TTYCTL 17 // retired: ttyctl() is a libc wrapper over termios
27#define SYS_PIPE 18
28#define SYS_DUP2 19
29#define SYS_FTRUNCATE 20
30#define SYS_LSEEK 21
31#define SYS_POLLKEY 22
32#define SYS_IOCTL 23
33#define SYS_MMAP 24
34#define SYS_MUNMAP 25
35#define SYS_MPROTECT 26
36#define SYS_FORK 27
37#define SYS_EXECVE 28
38#define SYS_GETPPID 29
39#define SYS_SCHED_YIELD 30
40#define SYS_FCNTL 31
41#define SYS_FSTAT 32
42#define SYS_RENAME 33
43#define SYS_ACCESS 34
44#define SYS_PREAD 35
45#define SYS_PWRITE 36
46#define SYS_FSYNC 37
47#define SYS_GETDENTS 38
48#define SYS_POLL 39
49#define SYS_KILL 40
50#define SYS_SIGACTION 41
51#define SYS_SIGPROCMASK 42
52#define SYS_SIGRETURN 43
53#define SYS_SIGPENDING 44
54#define SYS_SIGSUSPEND 45
55#define SYS_ALARM 46
56#define SYS_SETPGID 47
57#define SYS_GETPGID 48
58#define SYS_SETSID 49
59#define SYS_GETSID 50
60#define SYS_CLOCK_GETTIME 51
61#define SYS_NANOSLEEP 52
62#define SYS_TIMES 53
63#define SYS_GETUID 54
64#define SYS_GETEUID 55
65#define SYS_GETGID 56
66#define SYS_GETEGID 57
67#define SYS_SETUID 58
68#define SYS_SETGID 59
69#define SYS_SETEUID 60
70#define SYS_SETEGID 61
71#define SYS_CHMOD 62
72#define SYS_FCHMOD 63
73#define SYS_CHOWN 64
74#define SYS_UMASK 65
75#define SYS_REBOOT 66 // restart the machine (root only)
76#define SYS_SHM_CREATE 67 // make a shared memory object, return its fd
77#define SYS_SOCKET 68 // make a Unix domain socket
78#define SYS_BIND 69 // give a socket a name
79#define SYS_LISTEN 70 // let a bound socket take connections
80#define SYS_ACCEPT 71 // take a connection (accept4 flags)
81#define SYS_CONNECT 72 // connect to a named socket
82#define SYS_SOCKETPAIR 73 // make two connected sockets
83#define SYS_SENDMSG 74 // send data and files
84#define SYS_RECVMSG 75 // receive data and files
85#define SYS_UNAME 76 // the name, release and machine of the system
86#define SYS_OPENAT 77 // the *at calls: a path relative to a directory fd
87#define SYS_MKDIRAT 78
88#define SYS_UNLINKAT 79
89#define SYS_RENAMEAT 80
90#define SYS_FSTATAT 81
91#define SYS_FACCESSAT 82
92#define SYS_FCHMODAT 83
93#define SYS_FCHOWNAT 84
94#define SYS_FCHOWN 85
95#define SYS_SYMLINKAT 86 // links: a symbolic link, its target, a hard link
96#define SYS_READLINKAT 87
97#define SYS_LINKAT 88
98#define SYS_UTIMENSAT 89 // set a file's times
99#define SYS_CLOCK_SETTIME 90 // set the realtime clock (root)
100#define SYS_SETHOSTNAME 91 // set the host name (root)
101#define SYS_GETPRIORITY 92 // the nice value of processes
102#define SYS_SETPRIORITY 93
103#define SYS_FLOCK 94 // an advisory lock on a whole file
104#define SYS_MKNODAT 95 // a named pipe or a device node
105#define SYS_CHROOT 96 // change the root directory (root)
106#define SYS_CLONE 97 // make a thread (the Linux flags for one)
107#define SYS_EXIT_GROUP 98 // end every thread of the process
108#define SYS_GETTID 99 // the calling thread's id
109#define SYS_TGKILL 100 // send a signal to one thread
110#define SYS_SET_TLS 101 // set the thread pointer (thread-local storage)
111#define SYS_FUTEX 102 // wait on or wake a word in user memory
112#define SYS_GETSOCKNAME 103 // the address of a socket, and of its peer
113#define SYS_GETPEERNAME 104
114#define SYS_SETSOCKOPT 105 // socket options
115#define SYS_GETSOCKOPT 106
116#define SYS_SHUTDOWN 107 // stop reading or writing on a socket
117#define SYS_GETRANDOM 108 // random bytes
118
119// total number of syscalls defined
120#define SYSCALL_COUNT 109
121
122/**
123 * initialize the system call interface.
124 * registers the int 0x80 handler and opens the gate to ring 3.
125 * must be called after isr_initialize().
126 */
127void syscall_initialize(void);
128
129/**
130 * set up the system call entry of the core that runs the call (the MSRs of
131 * the syscall instruction on x86_64). syscall_initialize() does it for the
132 * boot core; each other core calls this when it starts.
133 */
134void syscall_init_core(void);
void syscall_initialize(void)
initialize the system call interface.
Definition syscall_dispatch.c:199
void syscall_init_core(void)
set up the system call entry of the core that runs the call (the MSRs of the syscall instruction on x...
Definition syscall_dispatch.c:222