boot2

Playing with the boostrap
git clone https://git.ryansepassi.com/git/boot2.git
Log | Files | Refs | README

syscall.h (3041B)


      1 /* -*-comment-start: "//";comment-end:""-*-
      2  * GNU Mes --- Maxwell Equations of Software
      3  * Copyright © 2017 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
      4  * Copyright © 2021 W. J. van der Laan <laanwj@protonmail.com>
      5  * Copyright © 2023 Andrius Štikonas <andrius@stikonas.eu>
      6  *
      7  * This file is part of GNU Mes.
      8  *
      9  * GNU Mes is free software; you can redistribute it and/or modify it
     10  * under the terms of the GNU General Public License as published by
     11  * the Free Software Foundation; either version 3 of the License, or (at
     12  * your option) any later version.
     13  *
     14  * GNU Mes is distributed in the hope that it will be useful, but
     15  * WITHOUT ANY WARRANTY; without even the implied warranty of
     16  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
     17  * GNU General Public License for more details.
     18  *
     19  * You should have received a copy of the GNU General Public License
     20  * along with GNU Mes.  If not, see <http://www.gnu.org/licenses/>.
     21  */
     22 #ifndef __MES_LINUX_RISCV_SYSCALL_H
     23 #define __MES_LINUX_RISCV_SYSCALL_H 1
     24 
     25 /** RISC-V uses the asm-generic syscalls (asm-generic/unistd.h) with the
     26     following configuration for 64-bit:
     27  * #define __ARCH_WANT_NEW_STAT
     28  * #define __ARCH_WANT_SET_GET_RLIMIT
     29  * #define __ARCH_WANT_SYS_CLONE3
     30  */
     31 
     32 #define MAKESTRING(s) #s
     33 #define MAKESTRING2(s) MAKESTRING (rd_a7 ! ## s addi)
     34 #define RISCV_SYSCALL(s) MAKESTRING2 (s)
     35 
     36 // libc-mini
     37 #ifndef SYS_exit
     38 #define SYS_exit        93
     39 #endif
     40 #ifndef SYS_write
     41 #define SYS_write       64
     42 #endif
     43 
     44 // libc
     45 #define SYS_clone          220
     46 #define SYS_read           63
     47 #define SYS_openat         56
     48 #define SYS_wait4          260
     49 #define SYS_execve         221
     50 #define SYS_fchmodat       53
     51 #define SYS_faccessat      48
     52 #define SYS_brk            214
     53 #define SYS_ioctl          29
     54 #define SYS_fsync          82
     55 #define SYS_newuname       160
     56 
     57 // libc+tcc
     58 #define SYS_close          57
     59 #define SYS_lseek          62
     60 #define SYS_unlinkat       35
     61 #define SYS_gettimeofday   169
     62 #define SYS_getcwd         17
     63 
     64 // libc+gnu
     65 
     66 #define SYS_chdir          49
     67 #define SYS_linkat         37
     68 #define SYS_getpid         172
     69 #define SYS_getuid         174
     70 #define SYS_kill           129
     71 #define SYS_renameat2      276
     72 #define SYS_mkdirat        34
     73 #define SYS_dup            23
     74 #define SYS_pipe2          59
     75 #define SYS_getgid         176
     76 #define SYS_rt_sigaction   134
     77 #define SYS_fcntl          25
     78 #define SYS_dup3           24
     79 #define SYS_getrusage      165
     80 #define SYS_newfstatat     79
     81 #define SYS_setitimer      103
     82 #define SYS_fstat          80
     83 #define SYS_nanosleep      101
     84 #define SYS_getdents64     61
     85 #define SYS_clock_gettime  113
     86 
     87 // bash
     88 #define SYS_setuid         146
     89 #define SYS_geteuid        175
     90 #define SYS_getegid        177
     91 #define SYS_setgid         144
     92 #define SYS_getppid        173
     93 
     94 // make+POSIX
     95 #define SYS_rt_sigprocmask 135
     96 
     97 // tar
     98 #define SYS_symlinkat      36
     99 #define SYS_readlinkat     78
    100 #define SYS_mknodat        33
    101 
    102 /* gash */
    103 #define SYS_umask          166
    104 #define SYS_utimensat      88
    105 
    106 #endif // __MES_LINUX_RISCV_SYSCALL_H