WIP syscalls...

So..., does RISC-V64 actually have the old interface too?
This commit is contained in:
Jan (janneke) Nieuwenhuizen 2022-05-04 16:32:11 +02:00
parent 5291f5917b
commit 3acbc2d68a
4 changed files with 80 additions and 12 deletions

51
include/linux/SYSCALLS Normal file
View File

@ -0,0 +1,51 @@
#+COMMENT: -*- org -*-
#+TITLE: Linux System Calls
|--------------+----------+-----+--------+-----+---------|
| name | old | x86 | x86_64 | arm | riscv64 |
|--------------+----------+-----+--------+-----+---------|
| exit | | 1 | 60 | 1 | 1 |
| fork | | 2 | 57 | 2 | 2 |
| open | | 5 | 2 | 5 | 5 |
| waitpid | | 7 | | | |
| link | | 9 | 86 | 9 | 9 |
| unlink | | 10 | 87 | 10 | 10 |
| time | | 13 | 201 | 13 | |
| mknod | | 14 | 133 | 14 | 14 |
| chmod | | 15 | 90 | 15 | 15 |
| access | | 33 | 21 | 33 | 33 |
| rename | | 38 | 82 | 38 | 38 |
| mkdir | | 39 | 83 | 39 | 39 |
| rmdir | | 40 | 84 | 40 | 40 |
| pipe | | 42 | 22 | 42 | 42 |
| dup2 | | 63 | 33 | 63 | 63 |
| gettimeofday | time | 78 | 96 | 78 | 78 |
| symlink | | 83 | 88 | 83 | 83 |
| readlink | | 85 | 89 | 85 | 85 |
| stat | | 106 | 4 | 106 | 106 |
| lstat | | 107 | 6 | 107 | 107 |
| wait4 | waitpid | 114 | 61 | 114 | 114 |
| clone | fork | 120 | 56 | 120 | 120 |
| getdents | | 141 | 78 | 141 | 141 |
| getdents64 | getdents | 220 | 217 | 217 | 220 |
| openat | open | 295 | 257 | 322 | 288 |
| mkdirat | mkdir | 296 | 258 | 323 | 289 |
| mknodat | mknod | 297 | 259 | 324 | 290 |
| unlinkat | rmdir | 301 | 263 | 328 | 294 |
| unlinkat | unlink | 301 | 263 | 328 | 294 |
| renameat | rename | 302 | 264 | 329 | 295 |
| linkat | link | 303 | 265 | 330 | 296 |
| symlinkat | symlink | 304 | 266 | 331 | 297 |
| readlinkat | readlink | 305 | 267 | 332 | 298 |
| fchmodat | chmod | 306 | 268 | 333 | 299 |
| faccessat | access | 307 | 269 | 334 | 300 |
| dup3 | dup2 | 330 | 292 | 358 | 326 |
| pipe2 | pipe | 331 | 293 | 359 | 325 |
|--------------+----------+-----+--------+-----+---------|
* Legalese
Copyright © 2022 Jan (janneke) Nieuwenhuizen <[[mailto:janneke@gnu.org][janneke@gnu.org]]>
Copying and distribution of this file, with or without modification,
are permitted in any medium without royalty provided the copyright
notice and this notice are preserved.

View File

@ -18,11 +18,14 @@
* You should have received a copy of the GNU General Public License
* along with GNU Mes. If not, see <http://www.gnu.org/licenses/>.
*/
/* Commentary:
* See https://github.com/torvalds/linux/blob/v4.19/arch/arm/tools/syscall.tbl
*
* Code:
*/
#ifndef __MES_LINUX_ARM_SYSCALL_H
#define __MES_LINUX_ARM_SYSCALL_H 1
/* See https://github.com/torvalds/linux/blob/v4.19/arch/arm/tools/syscall.tbl */
/* libc-mini */
#ifndef SYS_exit
#define SYS_exit 0x01

View File

@ -17,6 +17,11 @@
* You should have received a copy of the GNU General Public License
* along with GNU Mes. If not, see <http://www.gnu.org/licenses/>.
*/
/* Commentary:
* See https://github.com/torvalds/linux/blob/v4.19/arch/x86/entry/syscalls/syscall_32.tbl
*
* Code:
*/
#ifndef __MES_LINUX_X86_SYSCALL_H
#define __MES_LINUX_X86_SYSCALL_H 1

View File

@ -1,6 +1,6 @@
/* -*-comment-start: "//";comment-end:""-*-
* GNU Mes --- Maxwell Equations of Software
* Copyright © 2018 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
* Copyright © 2018,2022 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
*
* This file is part of GNU Mes.
*
@ -17,12 +17,21 @@
* You should have received a copy of the GNU General Public License
* along with GNU Mes. If not, see <http://www.gnu.org/licenses/>.
*/
/* Commentary:
* See https://github.com/torvalds/linux/blob/v4.19/arch/x86/entry/syscalls/syscall_64.tbl
*
* Code:
*/
#ifndef __MES_LINUX_X86_64_SYSCALL_H
#define __MES_LINUX_X86_64_SYSCALL_H 1
// libc-mini
// #define SYS_write 0x01
// #define SYS_exit 0x3c
#ifndef SYS_write
#define SYS_write 0x01
#endif
#ifndef SYS_exit
#define SYS_exit 0x3c
#endif
// libc
#define SYS_fork 0x39
@ -36,16 +45,19 @@
#define SYS_brk 0x0c
#define SYS_ioctl 0x10
#define SYS_fsync 0x4a
#define SYS_getcwd 0x4f
#define SYS_dup 0x20
#define SYS_dup2 0x21
#define SYS_unlink 0x57
#define SYS_gettimeofday 0x60
#define SYS_clock_gettime 0xe4
#define SYS_time 0xc9
// libc+tcc
#define SYS_close 0x03
#define SYS_time 0xc9
#define SYS_lseek 0x08
#define SYS_unlink 0x57
#define SYS_rmdir 0x54
#define SYS_gettimeofday 0x60
#define SYS_stat 0x04
#define SYS_getcwd 0x4f
// libc+gnu
#define SYS_chdir 0x50
@ -55,20 +67,17 @@
#define SYS_kill 0x3e
#define SYS_rename 0x52
#define SYS_mkdir 0x53
#define SYS_dup 0x20
#define SYS_pipe 0x16
#define SYS_getgid 0x68
#define SYS_rt_sigaction 0x0d
#define SYS_rt_sigreturn 0x0f
#define SYS_fcntl 0x48
#define SYS_dup2 0x21
#define SYS_getrusage 0x62
#define SYS_lstat 0x06
#define SYS_setitimer 0x26
#define SYS_fstat 0x05
#define SYS_nanosleep 0x33
#define SYS_getdents 0x4e
#define SYS_clock_gettime 0xe4
// bash
#define SYS_setuid 0x69