[1] | 1 | /* |
---|
[16] | 2 | * syscalls.h - kernel services definition |
---|
[1] | 3 | * |
---|
| 4 | * Author Ghassan Almaless (2007,2008,2009,2010,2011,2012) |
---|
| 5 | * Alain Greiner (2016) |
---|
| 6 | * |
---|
| 7 | * Copyright (c) UPMC Sorbonne Universites |
---|
| 8 | * |
---|
| 9 | * This file is part of ALMOS-MKH. |
---|
| 10 | * |
---|
| 11 | * ALMOS-MKH is free software; you can redistribute it and/or modify it |
---|
| 12 | * under the terms of the GNU General Public License as published by |
---|
| 13 | * the Free Software Foundation; version 2.0 of the License. |
---|
| 14 | * |
---|
| 15 | * ALMOS-MKH is distributed in the hope that it will be useful, but |
---|
| 16 | * WITHOUT ANY WARRANTY; without even the implied warranty of |
---|
| 17 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
---|
| 18 | * General Public License for more details. |
---|
| 19 | * |
---|
| 20 | * You should have received a copy of the GNU General Public License |
---|
| 21 | * along with ALMOS-MKH; if not, write to the Free Software Foundation, |
---|
| 22 | * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
---|
| 23 | */ |
---|
| 24 | |
---|
[16] | 25 | #ifndef _SYSCALLS_H_ |
---|
| 26 | #define _SYSCALLS_H_ |
---|
[1] | 27 | |
---|
| 28 | /****************************************************************************************** |
---|
[16] | 29 | * This enum defines the mnemonics for the syscall indexes. |
---|
| 30 | * It must be kept consistent with the array defined in do_syscalls.c |
---|
[1] | 31 | *****************************************************************************************/ |
---|
| 32 | enum |
---|
| 33 | { |
---|
| 34 | SYS_EXIT, /* 0 */ |
---|
| 35 | SYS_MMAP, /* 1 */ |
---|
| 36 | SYS_CREATE, /* 2 */ |
---|
| 37 | SYS_JOIN, /* 3 */ |
---|
| 38 | SYS_DETACH, /* 4 */ |
---|
| 39 | SYS_YIELD, /* 5 */ |
---|
| 40 | SYS_SEMAPHORE, /* 6 */ |
---|
| 41 | SYS_COND_VAR, /* 7 */ |
---|
| 42 | SYS_BARRIER, /* 8 */ |
---|
| 43 | SYS_RWLOCK, /* 9 */ |
---|
| 44 | SYS_SLEEP, /* 10 */ |
---|
| 45 | SYS_WAKEUP, /* 11 */ |
---|
| 46 | SYS_OPEN, /* 12 */ |
---|
| 47 | SYS_CREAT, /* 13 */ |
---|
| 48 | SYS_READ, /* 14 */ |
---|
| 49 | SYS_WRITE, /* 15 */ |
---|
| 50 | SYS_LSEEK, /* 16 */ |
---|
| 51 | SYS_CLOSE, /* 17 */ |
---|
| 52 | SYS_UNLINK, /* 18 */ |
---|
| 53 | SYS_PIPE, /* 19 */ |
---|
| 54 | SYS_CHDIR, /* 20 */ |
---|
| 55 | SYS_MKDIR, /* 21 */ |
---|
| 56 | SYS_MKFIFO, /* 22 */ |
---|
| 57 | SYS_OPENDIR, /* 23 */ |
---|
| 58 | SYS_READDIR, /* 24 */ |
---|
| 59 | SYS_CLOSEDIR, /* 25 */ |
---|
| 60 | SYS_GETCWD, /* 26 */ |
---|
| 61 | SYS_CLOCK, /* 27 */ |
---|
| 62 | SYS_ALARM, /* 28 */ |
---|
| 63 | SYS_DMA_MEMCPY, /* 29 */ |
---|
| 64 | SYS_UTLS, /* 30 */ |
---|
| 65 | SYS_SIGRETURN, /* 31 */ |
---|
| 66 | SYS_SIGNAL, /* 32 */ |
---|
| 67 | SYS_SET_SIGRETURN, /* 33 */ |
---|
| 68 | SYS_KILL, /* 34 */ |
---|
| 69 | SYS_GETPID, /* 35 */ |
---|
| 70 | SYS_FORK, /* 36 */ |
---|
| 71 | SYS_EXEC, /* 37 */ |
---|
| 72 | SYS_GETATTR, /* 38 */ |
---|
| 73 | SYS_PS, /* 39 */ |
---|
| 74 | SYS_MADVISE, /* 40 */ |
---|
| 75 | SYS_PAGEINFO, /* 41 */ |
---|
| 76 | SYS_STAT, /* 42 */ |
---|
| 77 | SYS_MIGRATE, /* 43 */ |
---|
| 78 | SYS_SBRK, /* 44 */ |
---|
| 79 | SYS_RMDIR, /* 45 */ |
---|
| 80 | SYS_FTIME, /* 46 */ |
---|
| 81 | SYS_CHMOD, /* 47 */ |
---|
| 82 | SYS_FSYNC, /* 48 */ |
---|
| 83 | SYS_GET_TOD, /* 49 */ |
---|
| 84 | SYS_TIMES, /* 50 */ |
---|
| 85 | SYSCALLS_NR, |
---|
| 86 | }; |
---|
| 87 | |
---|
| 88 | /********************************************************************************************/ |
---|
| 89 | /******************** Process related system calls ***************************************/ |
---|
| 90 | /********************************************************************************************/ |
---|
| 91 | |
---|
[16] | 92 | |
---|
[1] | 93 | /********************************************************************************************* |
---|
[16] | 94 | * [0] This function TODO |
---|
[1] | 95 | ********************************************************************************************/ |
---|
[16] | 96 | int sys_thread_exit( void * ); |
---|
| 97 | |
---|
| 98 | /********************************************************************************************* |
---|
| 99 | * [1] This function TODO |
---|
| 100 | ********************************************************************************************/ |
---|
| 101 | int sys_mmap(); |
---|
| 102 | |
---|
| 103 | /********************************************************************************************* |
---|
| 104 | * [2] This function TODO |
---|
| 105 | ********************************************************************************************/ |
---|
| 106 | int sys_thread_create(); |
---|
| 107 | |
---|
| 108 | /********************************************************************************************* |
---|
| 109 | * [3] This function TODO |
---|
| 110 | ********************************************************************************************/ |
---|
| 111 | int sys_thread_join(); |
---|
| 112 | |
---|
| 113 | /********************************************************************************************* |
---|
| 114 | * [4] This function TODO |
---|
| 115 | ********************************************************************************************/ |
---|
| 116 | int sys_thread_detach(); |
---|
| 117 | |
---|
| 118 | /********************************************************************************************* |
---|
| 119 | * [5] This function TODO |
---|
| 120 | ********************************************************************************************/ |
---|
| 121 | int sys_thread_yield(); |
---|
| 122 | |
---|
| 123 | /********************************************************************************************* |
---|
| 124 | * [6] This function TODO |
---|
| 125 | ********************************************************************************************/ |
---|
| 126 | int sys_sem(); |
---|
| 127 | |
---|
| 128 | /********************************************************************************************* |
---|
| 129 | * [7] This function TODO |
---|
| 130 | ********************************************************************************************/ |
---|
| 131 | int sys_cond_var(); |
---|
| 132 | |
---|
| 133 | /********************************************************************************************* |
---|
| 134 | * [8] This function TODO |
---|
| 135 | ********************************************************************************************/ |
---|
| 136 | int sys_barrier(); |
---|
| 137 | |
---|
| 138 | /********************************************************************************************* |
---|
| 139 | * [9] This function TODO |
---|
| 140 | ********************************************************************************************/ |
---|
| 141 | int sys_rwlock(); |
---|
| 142 | |
---|
| 143 | /********************************************************************************************* |
---|
| 144 | * [10] This function TODO |
---|
| 145 | ********************************************************************************************/ |
---|
| 146 | int sys_thread_sleep(); |
---|
| 147 | |
---|
| 148 | /********************************************************************************************* |
---|
| 149 | * [11] This function TODO |
---|
| 150 | ********************************************************************************************/ |
---|
| 151 | int sys_thread_wakeup(); |
---|
| 152 | |
---|
| 153 | /********************************************************************************************* |
---|
| 154 | * [12] This function TODO |
---|
| 155 | ********************************************************************************************/ |
---|
| 156 | int sys_open(); |
---|
| 157 | |
---|
| 158 | /********************************************************************************************* |
---|
| 159 | * [13] This function TODO |
---|
| 160 | ********************************************************************************************/ |
---|
| 161 | int sys_creat(); |
---|
| 162 | |
---|
| 163 | /********************************************************************************************* |
---|
| 164 | * [14] This function TODO |
---|
| 165 | ********************************************************************************************/ |
---|
| 166 | int sys_read(); |
---|
| 167 | |
---|
| 168 | /********************************************************************************************* |
---|
| 169 | * [15] This function TODO |
---|
| 170 | ********************************************************************************************/ |
---|
| 171 | int sys_write(); |
---|
| 172 | |
---|
| 173 | /********************************************************************************************* |
---|
| 174 | * [16] This function TODO |
---|
| 175 | ********************************************************************************************/ |
---|
| 176 | int sys_lseek(); |
---|
| 177 | |
---|
| 178 | /********************************************************************************************* |
---|
| 179 | * [17] This function TODO |
---|
| 180 | ********************************************************************************************/ |
---|
| 181 | int sys_close(); |
---|
| 182 | |
---|
| 183 | /********************************************************************************************* |
---|
| 184 | * [18] This function TODO |
---|
| 185 | ********************************************************************************************/ |
---|
| 186 | int sys_unlink(); |
---|
| 187 | |
---|
| 188 | /********************************************************************************************* |
---|
| 189 | * [19] This function TODO |
---|
| 190 | ********************************************************************************************/ |
---|
| 191 | int sys_pipe(); |
---|
| 192 | |
---|
| 193 | /********************************************************************************************* |
---|
| 194 | * [20] This function TODO |
---|
| 195 | ********************************************************************************************/ |
---|
| 196 | int sys_chdir(); |
---|
| 197 | |
---|
| 198 | /********************************************************************************************* |
---|
| 199 | * [21] This function TODO |
---|
| 200 | ********************************************************************************************/ |
---|
| 201 | int sys_mkdir(); |
---|
| 202 | |
---|
| 203 | /********************************************************************************************* |
---|
| 204 | * [22] This function TODO |
---|
| 205 | ********************************************************************************************/ |
---|
| 206 | int sys_mkfifo(); |
---|
| 207 | |
---|
| 208 | /********************************************************************************************* |
---|
| 209 | * [23] This function TODO |
---|
| 210 | ********************************************************************************************/ |
---|
| 211 | int sys_opendir(); |
---|
| 212 | |
---|
| 213 | /********************************************************************************************* |
---|
| 214 | * [24] This function TODO |
---|
| 215 | ********************************************************************************************/ |
---|
| 216 | int sys_readdir(); |
---|
| 217 | |
---|
| 218 | /********************************************************************************************* |
---|
| 219 | * [25] This function TODO |
---|
| 220 | ********************************************************************************************/ |
---|
| 221 | int sys_closedir(); |
---|
| 222 | |
---|
| 223 | /********************************************************************************************* |
---|
| 224 | * [26] This function TODO |
---|
| 225 | ********************************************************************************************/ |
---|
| 226 | int sys_getcwd(); |
---|
| 227 | |
---|
| 228 | /********************************************************************************************* |
---|
| 229 | * [27] This function TODO |
---|
| 230 | ********************************************************************************************/ |
---|
| 231 | int sys_clock(); |
---|
| 232 | |
---|
| 233 | /********************************************************************************************* |
---|
| 234 | * [28] This function TODO |
---|
| 235 | ********************************************************************************************/ |
---|
| 236 | int sys_alarm(); |
---|
| 237 | |
---|
| 238 | /********************************************************************************************* |
---|
| 239 | * [29] This function TODO |
---|
| 240 | ********************************************************************************************/ |
---|
| 241 | int sys_dma_memcpy(); |
---|
| 242 | |
---|
| 243 | /********************************************************************************************* |
---|
| 244 | * [30] This function TODO |
---|
| 245 | ********************************************************************************************/ |
---|
| 246 | int sys_utls(); |
---|
| 247 | |
---|
| 248 | /********************************************************************************************* |
---|
| 249 | * [31] This function TODO |
---|
| 250 | ********************************************************************************************/ |
---|
| 251 | int sys_notAvailable(); |
---|
| 252 | |
---|
| 253 | /********************************************************************************************* |
---|
| 254 | * [32] This function TODO |
---|
| 255 | ********************************************************************************************/ |
---|
| 256 | int sys_signal(); |
---|
| 257 | |
---|
| 258 | /********************************************************************************************* |
---|
| 259 | * [33] This function TODO |
---|
| 260 | ********************************************************************************************/ |
---|
| 261 | int sys_sigreturn_setup(); |
---|
| 262 | |
---|
| 263 | /********************************************************************************************* |
---|
| 264 | * [34] This function implements the "kill" system call. |
---|
| 265 | * It register the signal identified by the <sig> argument in all thread descriptors |
---|
| 266 | * of process identified by the <pid> argument. |
---|
| 267 | ********************************************************************************************* |
---|
| 268 | * @ pid : target process identifier. |
---|
| 269 | * @ sig : signal index. |
---|
| 270 | ********************************************************************************************/ |
---|
| 271 | int sys_kill( pid_t pid, |
---|
| 272 | uint32_t sig ); |
---|
| 273 | |
---|
| 274 | /********************************************************************************************* |
---|
| 275 | * [35] This function TODO |
---|
| 276 | ********************************************************************************************/ |
---|
[1] | 277 | int sys_getpid(); |
---|
| 278 | |
---|
| 279 | /********************************************************************************************* |
---|
[16] | 280 | * [36] This function implement the "fork" system call. |
---|
[1] | 281 | * The calling process descriptor (parent process), and the associated thread descriptor are |
---|
| 282 | * replicated in the same cluster as the calling thread, but the new process (child process) |
---|
| 283 | * is registered in another target cluster, that will become the process owner. |
---|
| 284 | * The child process and the associated main thread will be migrated to the target cluster |
---|
| 285 | * later, when the child process makes an "exec" or any other system call. |
---|
| 286 | * The target cluster depends on the "fork_user" flag and "fork_cxy" variable that can be |
---|
| 287 | * stored in the calling thread descriptor by the specific fork_place() system call. |
---|
| 288 | * If not, the sys_fork() function makes a query to the DQDT to select the target cluster. |
---|
| 289 | ********************************************************************************************* |
---|
| 290 | * @ returns child process PID if success / returns -1 if failure |
---|
| 291 | ********************************************************************************************/ |
---|
| 292 | int sys_fork(); |
---|
| 293 | |
---|
| 294 | /********************************************************************************************* |
---|
[16] | 295 | * [37] This function implement the "exec" system call. |
---|
[1] | 296 | * It is executed in the client cluster, but the new process descriptor and main thread |
---|
| 297 | * must be created in a server cluster, that is generally another cluster, using a RPC. |
---|
| 298 | * - If the server_cluster is the client cluster, call directly make_exec() in local |
---|
| 299 | * mode, to change the process image and launch a new thread in local cluster. |
---|
| 300 | * finally, the old thread is deleted. |
---|
| 301 | * - If the target_cluster is remote, call rpc_process_exec_client() to execute the |
---|
| 302 | * make_exec() in remote mode on the remote cluster, to create a new process |
---|
| 303 | * descriptor and a new thread on remote cluster. Finally, both the local |
---|
| 304 | * process descriptor and the local thread descriptor are deleted. |
---|
| 305 | * In both case this function build an exec_info_t structure containing all informations |
---|
| 306 | * required to build the new process descriptor and the associated thread, including |
---|
| 307 | * the mode (local/remote). |
---|
[16] | 308 | ********************************************************************************************* |
---|
[1] | 309 | * @ filename : string pointer on .elf filename (virtual pointer in user space) |
---|
| 310 | * @ argv : array of strings on process arguments (virtual pointers in user space) |
---|
| 311 | * @ envp : array of strings on Renvironment variables (virtual pointers in user space) |
---|
| 312 | * @ returns O if success / returns non-zero if error. |
---|
| 313 | ********************************************************************************************/ |
---|
| 314 | int sys_exec( char * filename, |
---|
| 315 | char ** argv, |
---|
| 316 | char ** envp ); |
---|
| 317 | |
---|
[16] | 318 | /********************************************************************************************* |
---|
| 319 | * [38] This function TODO |
---|
| 320 | ********************************************************************************************/ |
---|
| 321 | int sys_thread_getattr(); |
---|
[1] | 322 | |
---|
| 323 | /********************************************************************************************* |
---|
[16] | 324 | * [39] This function implements the ps system call. |
---|
[1] | 325 | ********************************************************************************************/ |
---|
| 326 | int sys_ps( uint32_t cmd, |
---|
| 327 | pid_t pid, |
---|
| 328 | uint32_t tid ); |
---|
| 329 | |
---|
[16] | 330 | /********************************************************************************************* |
---|
| 331 | * [40] This function TODO |
---|
| 332 | ********************************************************************************************/ |
---|
| 333 | int sys_madvise(); |
---|
[1] | 334 | |
---|
[16] | 335 | /********************************************************************************************* |
---|
| 336 | * [41] This function TODO |
---|
| 337 | ********************************************************************************************/ |
---|
| 338 | int sys_mcntl(); |
---|
[1] | 339 | |
---|
[16] | 340 | /********************************************************************************************* |
---|
| 341 | * [42] This function TODO |
---|
| 342 | ********************************************************************************************/ |
---|
| 343 | int sys_stat(); |
---|
| 344 | |
---|
| 345 | /********************************************************************************************* |
---|
| 346 | * [43] This function TODO |
---|
| 347 | ********************************************************************************************/ |
---|
| 348 | int sys_thread_migrate(); |
---|
| 349 | |
---|
| 350 | /********************************************************************************************* |
---|
| 351 | * [44] This function TODO |
---|
| 352 | ********************************************************************************************/ |
---|
| 353 | int sys_sbrk(); |
---|
| 354 | |
---|
| 355 | /********************************************************************************************* |
---|
| 356 | * [45] This function TODO |
---|
| 357 | ********************************************************************************************/ |
---|
| 358 | int sys_rmdir(); |
---|
| 359 | |
---|
| 360 | /********************************************************************************************* |
---|
| 361 | * [46] This function TODO |
---|
| 362 | ********************************************************************************************/ |
---|
| 363 | int sys_ftime(); |
---|
| 364 | |
---|
| 365 | /********************************************************************************************* |
---|
| 366 | * [47] This function TODO |
---|
| 367 | ********************************************************************************************/ |
---|
| 368 | int sys_chmod(); |
---|
| 369 | |
---|
| 370 | /********************************************************************************************* |
---|
| 371 | * [48] This function TODO |
---|
| 372 | ********************************************************************************************/ |
---|
| 373 | int sys_fsync(); |
---|
| 374 | |
---|
| 375 | /********************************************************************************************* |
---|
| 376 | * [49] This function TODO |
---|
| 377 | ********************************************************************************************/ |
---|
| 378 | int sys_gettimeofday(); |
---|
| 379 | |
---|
| 380 | /********************************************************************************************* |
---|
| 381 | * [50] This function TODO |
---|
| 382 | ********************************************************************************************/ |
---|
| 383 | int sys_times(); |
---|
| 384 | |
---|
| 385 | |
---|
| 386 | #endif // _SYSCALLS_H_ |
---|