Move system calls to the SDK and normalize their names
[monolithium.git] / sdk / syscalls.h
1 /*
2  * syscalls.h
3  *
4  * Copyright (C) 2017 Aleksandar Andrejevic <theflash@sdf.lonestar.org>
5  *
6  * This program is free software: you can redistribute it and/or modify
7  * it under the terms of the GNU Affero General Public License as
8  * published by the Free Software Foundation, either version 3 of the
9  * License, or (at your option) any later version.
10  *
11  * This program is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14  * GNU Affero General Public License for more details.
15  *
16  * You should have received a copy of the GNU Affero General Public License
17  * along with this program.  If not, see <http://www.gnu.org/licenses/>.
18  */
19
20 #ifndef __MONOLITHIUM_SYSCALLS_H__
21 #define __MONOLITHIUM_SYSCALLS_H__
22
23 #include "defs.h"
24
25 #define MAX_PARAMETERS 16
26 #define SYSCALL_INTERRUPT 0xE5
27
28 typedef enum
29 {
30     SYSCALL_ALLOC_MEMORY,
31     SYSCALL_CLOCK_GET_TIME,
32     SYSCALL_CLOCK_SET_TIME,
33     SYSCALL_CLOSE_OBJECT,
34     SYSCALL_COMMIT_MEMORY,
35     SYSCALL_CREATE_MEMORY_SECTION,
36     SYSCALL_CREATE_PIPE,
37     SYSCALL_CREATE_PROCESS,
38     SYSCALL_CREATE_SEMAPHORE,
39     SYSCALL_CREATE_THREAD,
40     SYSCALL_CREATE_USER,
41     SYSCALL_DELETE_FILE,
42     SYSCALL_DELETE_USER,
43     SYSCALL_DEVICE_IOCTL,
44     SYSCALL_DUPLICATE_HANDLE,
45     SYSCALL_ENUM_PROCESSES,
46     SYSCALL_FLUSH_MEMORY_SECTION,
47     SYSCALL_FREE_MEMORY,
48     SYSCALL_FREEZE_THREAD,
49     SYSCALL_GET_EXCEPTION_INFO,
50     SYSCALL_GET_MILLISECONDS,
51     SYSCALL_GET_NANOSECONDS,
52     SYSCALL_GET_PROCESS_ID,
53     SYSCALL_GET_THREAD_ID,
54     SYSCALL_GET_USER_ID,
55     SYSCALL_LIST_DIRECTORY,
56     SYSCALL_LOGON_USER,
57     SYSCALL_MAP_MEMORY_SECTION,
58     SYSCALL_MOUNT,
59     SYSCALL_OPEN_FILE,
60     SYSCALL_OPEN_MEMORY_SECTION,
61     SYSCALL_OPEN_PIPE,
62     SYSCALL_OPEN_PROCESS,
63     SYSCALL_OPEN_SEMAPHORE,
64     SYSCALL_OPEN_THREAD,
65     SYSCALL_POWER_CONTROL,
66     SYSCALL_QUERY_FILE,
67     SYSCALL_QUERY_HANDLE,
68     SYSCALL_QUERY_MEMORY,
69     SYSCALL_QUERY_PROCESS,
70     SYSCALL_QUERY_THREAD,
71     SYSCALL_QUERY_USER,
72     SYSCALL_RAISE_EXCEPTION,
73     SYSCALL_READ_FILE,
74     SYSCALL_READ_MEMORY,
75     SYSCALL_READ_PIPE,
76     SYSCALL_RELEASE_SEMAPHORE,
77     SYSCALL_RESTORE_EXCEPTION_HANDLER,
78     SYSCALL_REVERT_USER,
79     SYSCALL_SAVE_EXCEPTION_HANDLER,
80     SYSCALL_SET_FILE,
81     SYSCALL_SET_MEMORY_FLAGS,
82     SYSCALL_SET_THREAD,
83     SYSCALL_SET_USER_ID,
84     SYSCALL_SLEEP,
85     SYSCALL_TERMINATE,
86     SYSCALL_TERMINATE_THREAD,
87     SYSCALL_THAW_THREAD,
88     SYSCALL_UNCOMMIT_MEMORY,
89     SYSCALL_UNMOUNT,
90     SYSCALL_WAIT_DIRECTORY_EVENT,
91     SYSCALL_WAIT_PROCESS,
92     SYSCALL_WAIT_SEMAPHORE,
93     SYSCALL_WAIT_THREAD,
94     SYSCALL_WRITE_FILE,
95     SYSCALL_WRITE_MEMORY,
96     SYSCALL_WRITE_PIPE,
97     SYSCALL_YIELD_QUANTUM,
98
99     SERVICE_COUNT
100 } syscall_number_t;
101
102 sysret_t syscall(syscall_number_t num, ...);
103
104 #endif