1
0
mirror of https://github.com/rcore-os/rCore.git synced 2024-11-23 00:16:17 +04:00

Use Linux syscall number for mips N32 ABI, update user app

Signed-off-by: Harry Chen <i@harrychen.xyz>
This commit is contained in:
Harry Chen 2019-04-07 17:08:03 +08:00
parent a0f298f6dd
commit 88bda7c4a0
4 changed files with 418 additions and 281 deletions

69
kernel/Cargo.lock generated
View File

@ -251,6 +251,26 @@ name = "os_bootinfo"
version = "0.2.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
[[package]]
name = "paste"
version = "0.1.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"paste-impl 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)",
"proc-macro-hack 0.5.4 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "paste-impl"
version = "0.1.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"proc-macro-hack 0.5.4 (registry+https://github.com/rust-lang/crates.io-index)",
"proc-macro2 0.4.27 (registry+https://github.com/rust-lang/crates.io-index)",
"quote 0.6.11 (registry+https://github.com/rust-lang/crates.io-index)",
"syn 0.15.30 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "pc-keyboard"
version = "0.5.0"
@ -264,6 +284,24 @@ dependencies = [
"bitflags 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "proc-macro-hack"
version = "0.5.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"proc-macro2 0.4.27 (registry+https://github.com/rust-lang/crates.io-index)",
"quote 0.6.11 (registry+https://github.com/rust-lang/crates.io-index)",
"syn 0.15.30 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "proc-macro2"
version = "0.4.27"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"unicode-xid 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "pulldown-cmark"
version = "0.0.3"
@ -272,6 +310,14 @@ dependencies = [
"getopts 0.2.18 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "quote"
version = "0.6.11"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"proc-macro2 0.4.27 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "rand"
version = "0.4.6"
@ -328,6 +374,7 @@ dependencies = [
"log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)",
"mips 0.1.0 (git+https://github.com/Harry-Chen/rust-mips)",
"once 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)",
"paste 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)",
"pc-keyboard 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)",
"pci 0.0.1 (git+https://github.com/rcore-os/pci-rs)",
"raw-cpuid 6.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
@ -468,6 +515,16 @@ name = "static_assertions"
version = "0.3.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
[[package]]
name = "syn"
version = "0.15.30"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"proc-macro2 0.4.27 (registry+https://github.com/rust-lang/crates.io-index)",
"quote 0.6.11 (registry+https://github.com/rust-lang/crates.io-index)",
"unicode-xid 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "tempdir"
version = "0.3.7"
@ -501,6 +558,11 @@ name = "unicode-width"
version = "0.1.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
[[package]]
name = "unicode-xid"
version = "0.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
[[package]]
name = "usize_conversions"
version = "0.2.0"
@ -630,9 +692,14 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
"checksum nodrop 0.1.13 (registry+https://github.com/rust-lang/crates.io-index)" = "2f9667ddcc6cc8a43afc9b7917599d7216aa09c463919ea32c59ed6cac8bc945"
"checksum once 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)" = "931fb7a4cf34610cf6cbe58d52a8ca5ef4c726d4e2e178abd0dc13a6551c6d73"
"checksum os_bootinfo 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "66481dbeb5e773e7bd85b63cd6042c30786f834338288c5ec4f3742673db360a"
"checksum paste 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)" = "1f4a4a1c555c6505821f9d58b8779d0f630a6b7e4e1be24ba718610acf01fa79"
"checksum paste-impl 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)" = "26e796e623b8b257215f27e6c80a5478856cae305f5b59810ff9acdaa34570e6"
"checksum pc-keyboard 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)" = "c48392db76c4e9a69e0b3be356c5f97ebb7b14413c5e4fd0af4755dbf86e2fce"
"checksum pci 0.0.1 (git+https://github.com/rcore-os/pci-rs)" = "<none>"
"checksum proc-macro-hack 0.5.4 (registry+https://github.com/rust-lang/crates.io-index)" = "3e90aa19cd73dedc2d0e1e8407473f073d735fef0ab521438de6da8ee449ab66"
"checksum proc-macro2 0.4.27 (registry+https://github.com/rust-lang/crates.io-index)" = "4d317f9caece796be1980837fd5cb3dfec5613ebdb04ad0956deea83ce168915"
"checksum pulldown-cmark 0.0.3 (registry+https://github.com/rust-lang/crates.io-index)" = "8361e81576d2e02643b04950e487ec172b687180da65c731c03cf336784e6c07"
"checksum quote 0.6.11 (registry+https://github.com/rust-lang/crates.io-index)" = "cdd8e04bd9c52e0342b406469d494fcb033be4bdbe5c606016defbb1681411e1"
"checksum rand 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)" = "552840b97013b1a26992c11eac34bdd778e464601a4c2054b5f0bff7c6761293"
"checksum rand_core 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)" = "7a6fdeb83b075e8266dcc8762c22776f6877a63111121f5f8c7411e5be7eed4b"
"checksum rand_core 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "d0e7a549d590831370895ab7ba4ea0c1b6b011d106b5ff2da6eee112615e6dc0"
@ -651,11 +718,13 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
"checksum spin 0.4.10 (registry+https://github.com/rust-lang/crates.io-index)" = "ceac490aa12c567115b40b7b7fceca03a6c9d53d5defea066123debc83c5dc1f"
"checksum spin 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)" = "44363f6f51401c34e7be73db0db371c04705d35efbe9f7d6082e03a921a32c55"
"checksum static_assertions 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)" = "389ce475f424f267dbed6479cbd8f126c5e1afb053b0acdaa019c74305fc65d1"
"checksum syn 0.15.30 (registry+https://github.com/rust-lang/crates.io-index)" = "66c8865bf5a7cbb662d8b011950060b3c8743dca141b054bf7195b20d314d8e2"
"checksum tempdir 0.3.7 (registry+https://github.com/rust-lang/crates.io-index)" = "15f2b5fb00ccdf689e0149d1b1b3c03fead81c2b37735d812fa8bddbbf41b6d8"
"checksum tock-registers 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "3a385d94f3f62e60445a0adb9ff8d9621faa272234530d4c0f848ec98f88e316"
"checksum typenum 1.10.0 (registry+https://github.com/rust-lang/crates.io-index)" = "612d636f949607bdf9b123b4a6f6d966dedf3ff669f7f045890d3a4a73948169"
"checksum uart_16550 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "269f953d8de3226f7c065c589c7b4a3e83d10a419c7c3b5e2e0f197e6acc966e"
"checksum unicode-width 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)" = "882386231c45df4700b275c7ff55b6f3698780a650026380e72dabe76fa46526"
"checksum unicode-xid 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "fc72304796d0818e357ead4e000d19c9c174ab23dc11093ac919054d20a6a7fc"
"checksum usize_conversions 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "f70329e2cbe45d6c97a5112daad40c34cd9a4e18edb5a2a18fefeb584d8d25e5"
"checksum ux 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)" = "88dfeb711b61ce620c0cb6fd9f8e3e678622f0c971da2a63c4b3e25e88ed012f"
"checksum volatile 0.2.6 (registry+https://github.com/rust-lang/crates.io-index)" = "6af0edf5b4faacc31fc51159244d78d65ec580f021afcef7bd53c04aeabc7f29"

View File

@ -79,6 +79,7 @@ bcm2837 = { git = "https://github.com/rcore-os/bcm2837", optional = true }
[target.'cfg(target_arch = "mips")'.dependencies]
mips = { git = "https://github.com/Harry-Chen/rust-mips" }
paste = "0.1"
[package.metadata.bootimage]
default-target = "targets/x86_64.json"

View File

@ -1,284 +1,351 @@
//! RISCV32 syscall ids
//! Reference: https://github.com/riscv/riscv-musl/blob/staging/arch/riscv32/bits/syscall.h.in
//! MIPS N32 ABI syscall ids
//! Reference: https://git.linux-mips.org/cgit/ralf/linux.git/tree/arch/mips/include/uapi/asm/unistd.h
pub const SYS_IO_SETUP: usize = 0;
pub const SYS_IO_DESTROY: usize = 1;
pub const SYS_IO_SUBMIT: usize = 2;
pub const SYS_IO_CANCEL: usize = 3;
pub const SYS_IO_GETEVENTS: usize = 4;
pub const SYS_SETXATTR: usize = 5;
pub const SYS_LSETXATTR: usize = 6;
pub const SYS_FSETXATTR: usize = 7;
pub const SYS_GETXATTR: usize = 8;
pub const SYS_LGETXATTR: usize = 9;
pub const SYS_FGETXATTR: usize = 10;
pub const SYS_LISTXATTR: usize = 11;
pub const SYS_LLISTXATTR: usize = 12;
pub const SYS_FLISTXATTR: usize = 13;
pub const SYS_REMOVEXATTR: usize = 14;
pub const SYS_LREMOVEXATTR: usize = 15;
pub const SYS_FREMOVEXATTR: usize = 16;
pub const SYS_GETCWD: usize = 17;
pub const SYS_LOOKUP_DCOOKIE: usize = 18;
pub const SYS_EVENTFD2: usize = 19;
pub const SYS_EPOLL_CREATE1: usize = 20;
pub const SYS_EPOLL_CTL: usize = 21;
pub const SYS_EPOLL_PWAIT: usize = 22;
pub const SYS_DUP: usize = 23;
pub const SYS_DUP3: usize = 24;
pub const SYS_FCNTL: usize = 25;
pub const SYS_INOTIFY_INIT1: usize = 26;
pub const SYS_INOTIFY_ADD_WATCH: usize = 27;
pub const SYS_INOTIFY_RM_WATCH: usize = 28;
pub const SYS_IOCTL: usize = 29;
pub const SYS_IOPRIO_SET: usize = 30;
pub const SYS_IOPRIO_GET: usize = 31;
pub const SYS_FLOCK: usize = 32;
pub const SYS_MKNODAT: usize = 33;
pub const SYS_MKDIRAT: usize = 34;
pub const SYS_UNLINKAT: usize = 35;
pub const SYS_SYMLINKAT: usize = 36;
pub const SYS_LINKAT: usize = 37;
pub const SYS_RENAMEAT: usize = 38; // FIXME
pub const SYS_UMOUNT2: usize = 39;
pub const SYS_MOUNT: usize = 40;
pub const SYS_PIVOT_ROOT: usize = 41;
pub const SYS_NFSSERVCTL: usize = 42;
pub const SYS_STATFS: usize = 43;
pub const SYS_FSTATFS: usize = 44;
pub const SYS_TRUNCATE: usize = 45;
pub const SYS_FTRUNCATE: usize = 46;
pub const SYS_FALLOCATE: usize = 47;
pub const SYS_FACCESSAT: usize = 48;
pub const SYS_CHDIR: usize = 49;
pub const SYS_FCHDIR: usize = 50;
pub const SYS_CHROOT: usize = 51;
pub const SYS_FCHMOD: usize = 52;
pub const SYS_FCHMODAT: usize = 53;
pub const SYS_FCHOWNAT: usize = 54;
pub const SYS_FCHOWN: usize = 55;
pub const SYS_OPENAT: usize = 56;
pub const SYS_CLOSE: usize = 57;
pub const SYS_VHANGUP: usize = 58;
pub const SYS_PIPE2: usize = 59;
pub const SYS_QUOTACTL: usize = 60;
pub const SYS_GETDENTS64: usize = 61;
pub const SYS_LSEEK: usize = 62;
pub const SYS_READ: usize = 63;
pub const SYS_WRITE: usize = 64;
pub const SYS_READV: usize = 65;
pub const SYS_WRITEV: usize = 66;
pub const SYS_PREAD64: usize = 67;
pub const SYS_PWRITE64: usize = 68;
pub const SYS_PREADV: usize = 69;
pub const SYS_PWRITEV: usize = 70;
pub const SYS_SENDFILE: usize = 71;
pub const SYS_PSELECT6: usize = 72;
pub const SYS_PPOLL: usize = 73;
pub const SYS_SIGNALFD4: usize = 74;
pub const SYS_VMSPLICE: usize = 75;
pub const SYS_SPLICE: usize = 76;
pub const SYS_TEE: usize = 77;
pub const SYS_READLINKAT: usize = 78;
pub const SYS_NEWFSTATAT: usize = 79;
pub const SYS_FSTAT: usize = 80;
pub const SYS_SYNC: usize = 81;
pub const SYS_FSYNC: usize = 82;
pub const SYS_FDATASYNC: usize = 83;
pub const SYS_SYNC_FILE_RANGE: usize = 84;
pub const SYS_TIMERFD_CREATE: usize = 85;
pub const SYS_TIMERFD_SETTIME: usize = 86;
pub const SYS_TIMERFD_GETTIME: usize = 87;
pub const SYS_UTIMENSAT: usize = 88;
pub const SYS_ACCT: usize = 89;
pub const SYS_CAPGET: usize = 90;
pub const SYS_CAPSET: usize = 91;
pub const SYS_PERSONALITY: usize = 92;
pub const SYS_EXIT: usize = 93;
pub const SYS_EXIT_GROUP: usize = 94;
pub const SYS_WAITID: usize = 95;
pub const SYS_SET_TID_ADDRESS: usize = 96;
pub const SYS_UNSHARE: usize = 97;
pub const SYS_FUTEX: usize = 98;
pub const SYS_SET_ROBUST_LIST: usize = 99;
pub const SYS_GET_ROBUST_LIST: usize = 100;
pub const SYS_NANOSLEEP: usize = 101;
pub const SYS_GETITIMER: usize = 102;
pub const SYS_SETITIMER: usize = 103;
pub const SYS_KEXEC_LOAD: usize = 104;
pub const SYS_INIT_MODULE: usize = 105;
pub const SYS_DELETE_MODULE: usize = 106;
pub const SYS_TIMER_CREATE: usize = 107;
pub const SYS_TIMER_GETTIME: usize = 108;
pub const SYS_TIMER_GETOVERRUN: usize = 109;
pub const SYS_TIMER_SETTIME: usize = 110;
pub const SYS_TIMER_DELETE: usize = 111;
pub const SYS_CLOCK_SETTIME: usize = 112;
pub const SYS_CLOCK_GETTIME: usize = 113;
pub const SYS_CLOCK_GETRES: usize = 114;
pub const SYS_CLOCK_NANOSLEEP: usize = 115;
pub const SYS_SYSLOG: usize = 116;
pub const SYS_PTRACE: usize = 117;
pub const SYS_SCHED_SETPARAM: usize = 118;
pub const SYS_SCHED_SETSCHEDULER: usize = 119;
pub const SYS_SCHED_GETSCHEDULER: usize = 120;
pub const SYS_SCHED_GETPARAM: usize = 121;
pub const SYS_SCHED_SETAFFINITY: usize = 122;
pub const SYS_SCHED_GETAFFINITY: usize = 123;
pub const SYS_SCHED_YIELD: usize = 124;
pub const SYS_SCHED_GET_PRIORITY_MAX: usize = 125;
pub const SYS_SCHED_GET_PRIORITY_MIN: usize = 126;
pub const SYS_SCHED_RR_GET_INTERVAL: usize = 127;
pub const SYS_RESTART_SYSCALL: usize = 128;
pub const SYS_KILL: usize = 129;
pub const SYS_TKILL: usize = 130;
pub const SYS_TGKILL: usize = 131;
pub const SYS_SIGALTSTACK: usize = 132;
pub const SYS_RT_SIGSUSPEND: usize = 133;
pub const SYS_RT_SIGACTION: usize = 134;
pub const SYS_RT_SIGPROCMASK: usize = 135;
pub const SYS_RT_SIGPENDING: usize = 136;
pub const SYS_RT_SIGTIMEDWAIT: usize = 137;
pub const SYS_RT_SIGQUEUEINFO: usize = 138;
pub const SYS_RT_SIGRETURN: usize = 139;
pub const SYS_SETPRIORITY: usize = 140;
pub const SYS_GETPRIORITY: usize = 141;
pub const SYS_REBOOT: usize = 142;
pub const SYS_SETREGID: usize = 143;
pub const SYS_SETGID: usize = 144;
pub const SYS_SETREUID: usize = 145;
pub const SYS_SETUID: usize = 146;
pub const SYS_SETRESUID: usize = 147;
pub const SYS_GETRESUID: usize = 148;
pub const SYS_SETRESGID: usize = 149;
pub const SYS_GETRESGID: usize = 150;
pub const SYS_SETFSUID: usize = 151;
pub const SYS_SETFSGID: usize = 152;
pub const SYS_TIMES: usize = 153;
pub const SYS_SETPGID: usize = 154;
pub const SYS_GETPGID: usize = 155;
pub const SYS_GETSID: usize = 156;
pub const SYS_SETSID: usize = 157;
pub const SYS_GETGROUPS: usize = 158;
pub const SYS_SETGROUPS: usize = 159;
pub const SYS_UNAME: usize = 160;
pub const SYS_SETHOSTNAME: usize = 161;
pub const SYS_SETDOMAINNAME: usize = 162;
pub const SYS_GETRLIMIT: usize = 163;
pub const SYS_SETRLIMIT: usize = 164;
pub const SYS_GETRUSAGE: usize = 165;
pub const SYS_UMASK: usize = 166;
pub const SYS_PRCTL: usize = 167;
pub const SYS_GETCPU: usize = 168;
pub const SYS_GETTIMEOFDAY: usize = 169;
pub const SYS_SETTIMEOFDAY: usize = 170;
pub const SYS_ADJTIMEX: usize = 171;
pub const SYS_GETPID: usize = 172;
pub const SYS_GETPPID: usize = 173;
pub const SYS_GETUID: usize = 174;
pub const SYS_GETEUID: usize = 175;
pub const SYS_GETGID: usize = 176;
pub const SYS_GETEGID: usize = 177;
pub const SYS_GETTID: usize = 178;
pub const SYS_SYSINFO: usize = 179;
pub const SYS_MQ_OPEN: usize = 180;
pub const SYS_MQ_UNLINK: usize = 181;
pub const SYS_MQ_TIMEDSEND: usize = 182;
pub const SYS_MQ_TIMEDRECEIVE: usize = 183;
pub const SYS_MQ_NOTIFY: usize = 184;
pub const SYS_MQ_GETSETATTR: usize = 185;
pub const SYS_MSGGET: usize = 186;
pub const SYS_MSGCTL: usize = 187;
pub const SYS_MSGRCV: usize = 188;
pub const SYS_MSGSND: usize = 189;
pub const SYS_SEMGET: usize = 190;
pub const SYS_SEMCTL: usize = 191;
pub const SYS_SEMTIMEDOP: usize = 192;
pub const SYS_SEMOP: usize = 193;
pub const SYS_SHMGET: usize = 194;
pub const SYS_SHMCTL: usize = 195;
pub const SYS_SHMAT: usize = 196;
pub const SYS_SHMDT: usize = 197;
pub const SYS_SOCKET: usize = 198;
pub const SYS_SOCKETPAIR: usize = 199;
pub const SYS_BIND: usize = 200;
pub const SYS_LISTEN: usize = 201;
pub const SYS_ACCEPT: usize = 202;
pub const SYS_CONNECT: usize = 203;
pub const SYS_GETSOCKNAME: usize = 204;
pub const SYS_GETPEERNAME: usize = 205;
pub const SYS_SENDTO: usize = 206;
pub const SYS_RECVFROM: usize = 207;
pub const SYS_SETSOCKOPT: usize = 208;
pub const SYS_GETSOCKOPT: usize = 209;
pub const SYS_SHUTDOWN: usize = 210;
pub const SYS_SENDMSG: usize = 211;
pub const SYS_RECVMSG: usize = 212;
pub const SYS_READAHEAD: usize = 213;
pub const SYS_BRK: usize = 214;
pub const SYS_MUNMAP: usize = 215;
pub const SYS_MREMAP: usize = 216;
pub const SYS_ADD_KEY: usize = 217;
pub const SYS_REQUEST_KEY: usize = 218;
pub const SYS_KEYCTL: usize = 219;
pub const SYS_CLONE: usize = 220;
pub const SYS_EXECVE: usize = 221;
pub const SYS_MMAP: usize = 222;
pub const SYS_FADVISE64: usize = 223;
pub const SYS_SWAPON: usize = 224;
pub const SYS_SWAPOFF: usize = 225;
pub const SYS_MPROTECT: usize = 226;
pub const SYS_MSYNC: usize = 227;
pub const SYS_MLOCK: usize = 228;
pub const SYS_MUNLOCK: usize = 229;
pub const SYS_MLOCKALL: usize = 230;
pub const SYS_MUNLOCKALL: usize = 231;
pub const SYS_MINCORE: usize = 232;
pub const SYS_MADVISE: usize = 233;
pub const SYS_REMAP_FILE_PAGES: usize = 234;
pub const SYS_MBIND: usize = 235;
pub const SYS_GET_MEMPOLICY: usize = 236;
pub const SYS_SET_MEMPOLICY: usize = 237;
pub const SYS_MIGRATE_PAGES: usize = 238;
pub const SYS_MOVE_PAGES: usize = 239;
pub const SYS_RT_TGSIGQUEUEINFO: usize = 240;
pub const SYS_PERF_EVENT_OPEN: usize = 241;
pub const SYS_ACCEPT4: usize = 242;
pub const SYS_RECVMMSG: usize = 243;
pub const SYS_ARCH_SPECIFIC_SYSCALL: usize = 244;
pub const SYS_WAIT4: usize = 260;
pub const SYS_PRLIMIT64: usize = 261;
pub const SYS_FANOTIFY_INIT: usize = 262;
pub const SYS_FANOTIFY_MARK: usize = 263;
pub const SYS_NAME_TO_HANDLE_AT: usize = 264;
pub const SYS_OPEN_BY_HANDLE_AT: usize = 265;
pub const SYS_CLOCK_ADJTIME: usize = 266;
pub const SYS_SYNCFS: usize = 267;
pub const SYS_SETNS: usize = 268;
pub const SYS_SENDMMSG: usize = 269;
pub const SYS_PROCESS_VM_READV: usize = 270;
pub const SYS_PROCESS_VM_WRITEV: usize = 271;
pub const SYS_KCMP: usize = 272;
pub const SYS_FINIT_MODULE: usize = 273;
pub const SYS_SCHED_SETATTR: usize = 274;
pub const SYS_SCHED_GETATTR: usize = 275;
pub const SYS_RENAMEAT2: usize = 276;
pub const SYS_SECCOMP: usize = 277;
pub const SYS_GETRANDOM: usize = 278;
pub const SYS_MEMFD_CREATE: usize = 279;
pub const SYS_BPF: usize = 280;
pub const SYS_EXECVEAT: usize = 281;
pub const SYS_USERFAULTFD: usize = 282;
pub const SYS_MEMBARRIER: usize = 283;
pub const SYS_MLOCK2: usize = 284;
pub const SYS_COPY_FILE_RANGE: usize = 285;
pub const SYS_PREADV2: usize = 286;
pub const SYS_PWRITEV2: usize = 287;
pub const SYS_PKEY_MPROTECT: usize = 288;
pub const SYS_PKEY_ALLOC: usize = 289;
pub const SYS_PKEY_FREE: usize = 290;
pub const SYS_SYSRISCV: usize = SYS_ARCH_SPECIFIC_SYSCALL;
pub const SYS_RISCV_FLUSH_ICACHE: usize = SYS_SYSRISCV + 15;
extern crate paste;
pub const MIPS_SYSCALL_OFFSET: usize = 6000;
macro_rules! define_syscall {
($name: ident, $id: expr) => {
paste::item! {
pub const [<SYS_ $name>] : usize = MIPS_SYSCALL_OFFSET + $id;
}
};
}
define_syscall!(READ, 0);
define_syscall!(WRITE, 1);
define_syscall!(OPEN, 2);
define_syscall!(CLOSE, 3);
define_syscall!(STAT, 4);
define_syscall!(FSTAT, 5);
define_syscall!(LSTAT, 6);
define_syscall!(POLL, 7);
define_syscall!(LSEEK, 8);
define_syscall!(MMAP, 9);
define_syscall!(MPROTECT, 10);
define_syscall!(MUNMAP, 11);
define_syscall!(BRK, 12);
define_syscall!(RT_SIGACTION, 13);
define_syscall!(RT_SIGPROCMASK, 14);
define_syscall!(IOCTL, 15);
define_syscall!(PREAD64, 16);
define_syscall!(PWRITE64, 17);
define_syscall!(READV, 18);
define_syscall!(WRITEV, 19);
define_syscall!(ACCESS, 20);
define_syscall!(PIPE, 21);
define_syscall!(_NEWSELECT, 22);
define_syscall!(SCHED_YIELD, 23);
define_syscall!(MREMAP, 24);
define_syscall!(MSYNC, 25);
define_syscall!(MINCORE, 26);
define_syscall!(MADVISE, 27);
define_syscall!(SHMGET, 28);
define_syscall!(SHMAT, 29);
define_syscall!(SHMCTL, 30);
define_syscall!(DUP, 31);
define_syscall!(DUP2, 32);
define_syscall!(PAUSE, 33);
define_syscall!(NANOSLEEP, 34);
define_syscall!(GETITIMER, 35);
define_syscall!(SETITIMER, 36);
define_syscall!(ALARM, 37);
define_syscall!(GETPID, 38);
define_syscall!(SENDFILE, 39);
define_syscall!(SOCKET, 40);
define_syscall!(CONNECT, 41);
define_syscall!(ACCEPT, 42);
define_syscall!(SENDTO, 43);
define_syscall!(RECVFROM, 44);
define_syscall!(SENDMSG, 45);
define_syscall!(RECVMSG, 46);
define_syscall!(SHUTDOWN, 47);
define_syscall!(BIND, 48);
define_syscall!(LISTEN, 49);
define_syscall!(GETSOCKNAME, 50);
define_syscall!(GETPEERNAME, 51);
define_syscall!(SOCKETPAIR, 52);
define_syscall!(SETSOCKOPT, 53);
define_syscall!(GETSOCKOPT, 54);
define_syscall!(CLONE, 55);
define_syscall!(FORK, 56);
define_syscall!(EXECVE, 57);
define_syscall!(EXIT, 58);
define_syscall!(WAIT4, 59);
define_syscall!(KILL, 60);
define_syscall!(UNAME, 61);
define_syscall!(SEMGET, 62);
define_syscall!(SEMOP, 63);
define_syscall!(SEMCTL, 64);
define_syscall!(SHMDT, 65);
define_syscall!(MSGGET, 66);
define_syscall!(MSGSND, 67);
define_syscall!(MSGRCV, 68);
define_syscall!(MSGCTL, 69);
define_syscall!(FCNTL, 70);
define_syscall!(FLOCK, 71);
define_syscall!(FSYNC, 72);
define_syscall!(FDATASYNC, 73);
define_syscall!(TRUNCATE, 74);
define_syscall!(FTRUNCATE, 75);
define_syscall!(GETDENTS, 76);
define_syscall!(GETCWD, 77);
define_syscall!(CHDIR, 78);
define_syscall!(FCHDIR, 79);
define_syscall!(RENAME, 80);
define_syscall!(MKDIR, 81);
define_syscall!(RMDIR, 82);
define_syscall!(CREAT, 83);
define_syscall!(LINK, 84);
define_syscall!(UNLINK, 85);
define_syscall!(SYMLINK, 86);
define_syscall!(READLINK, 87);
define_syscall!(CHMOD, 88);
define_syscall!(FCHMOD, 89);
define_syscall!(CHOWN, 90);
define_syscall!(FCHOWN, 91);
define_syscall!(LCHOWN, 92);
define_syscall!(UMASK, 93);
define_syscall!(GETTIMEOFDAY, 94);
define_syscall!(GETRLIMIT, 95);
define_syscall!(GETRUSAGE, 96);
define_syscall!(SYSINFO, 97);
define_syscall!(TIMES, 98);
define_syscall!(PTRACE, 99);
define_syscall!(GETUID, 100);
define_syscall!(SYSLOG, 101);
define_syscall!(GETGID, 102);
define_syscall!(SETUID, 103);
define_syscall!(SETGID, 104);
define_syscall!(GETEUID, 105);
define_syscall!(GETEGID, 106);
define_syscall!(SETPGID, 107);
define_syscall!(GETPPID, 108);
define_syscall!(GETPGRP, 109);
define_syscall!(SETSID, 110);
define_syscall!(SETREUID, 111);
define_syscall!(SETREGID, 112);
define_syscall!(GETGROUPS, 113);
define_syscall!(SETGROUPS, 114);
define_syscall!(SETRESUID, 115);
define_syscall!(GETRESUID, 116);
define_syscall!(SETRESGID, 117);
define_syscall!(GETRESGID, 118);
define_syscall!(GETPGID, 119);
define_syscall!(SETFSUID, 120);
define_syscall!(SETFSGID, 121);
define_syscall!(GETSID, 122);
define_syscall!(CAPGET, 123);
define_syscall!(CAPSET, 124);
define_syscall!(RT_SIGPENDING, 125);
define_syscall!(RT_SIGTIMEDWAIT, 126);
define_syscall!(RT_SIGQUEUEINFO, 127);
define_syscall!(RT_SIGSUSPEND, 128);
define_syscall!(SIGALTSTACK, 129);
define_syscall!(UTIME, 130);
define_syscall!(MKNOD, 131);
define_syscall!(PERSONALITY, 132);
define_syscall!(USTAT, 133);
define_syscall!(STATFS, 134);
define_syscall!(FSTATFS, 135);
define_syscall!(SYSFS, 136);
define_syscall!(GETPRIORITY, 137);
define_syscall!(SETPRIORITY, 138);
define_syscall!(SCHED_SETPARAM, 139);
define_syscall!(SCHED_GETPARAM, 140);
define_syscall!(SCHED_SETSCHEDULER, 141);
define_syscall!(SCHED_GETSCHEDULER, 142);
define_syscall!(SCHED_GET_PRIORITY_MAX, 143);
define_syscall!(SCHED_GET_PRIORITY_MIN, 144);
define_syscall!(SCHED_RR_GET_INTERVAL, 145);
define_syscall!(MLOCK, 146);
define_syscall!(MUNLOCK, 147);
define_syscall!(MLOCKALL, 148);
define_syscall!(MUNLOCKALL, 149);
define_syscall!(VHANGUP, 150);
define_syscall!(PIVOT_ROOT, 151);
define_syscall!(_SYSCTL, 152);
define_syscall!(PRCTL, 153);
define_syscall!(ADJTIMEX, 154);
define_syscall!(SETRLIMIT, 155);
define_syscall!(CHROOT, 156);
define_syscall!(SYNC, 157);
define_syscall!(ACCT, 158);
define_syscall!(SETTIMEOFDAY, 159);
define_syscall!(MOUNT, 160);
define_syscall!(UMOUNT2, 161);
define_syscall!(SWAPON, 162);
define_syscall!(SWAPOFF, 163);
define_syscall!(REBOOT, 164);
define_syscall!(SETHOSTNAME, 165);
define_syscall!(SETDOMAINNAME, 166);
define_syscall!(CREATE_MODULE, 167);
define_syscall!(INIT_MODULE, 168);
define_syscall!(DELETE_MODULE, 169);
define_syscall!(GET_KERNEL_SYMS, 170);
define_syscall!(QUERY_MODULE, 171);
define_syscall!(QUOTACTL, 172);
define_syscall!(NFSSERVCTL, 173);
define_syscall!(GETPMSG, 174);
define_syscall!(PUTPMSG, 175);
define_syscall!(AFS_SYSCALL, 176);
define_syscall!(RESERVED177, 177);
define_syscall!(GETTID, 178);
define_syscall!(READAHEAD, 179);
define_syscall!(SETXATTR, 180);
define_syscall!(LSETXATTR, 181);
define_syscall!(FSETXATTR, 182);
define_syscall!(GETXATTR, 183);
define_syscall!(LGETXATTR, 184);
define_syscall!(FGETXATTR, 185);
define_syscall!(LISTXATTR, 186);
define_syscall!(LLISTXATTR, 187);
define_syscall!(FLISTXATTR, 188);
define_syscall!(REMOVEXATTR, 189);
define_syscall!(LREMOVEXATTR, 190);
define_syscall!(FREMOVEXATTR, 191);
define_syscall!(TKILL, 192);
define_syscall!(RESERVED193, 193);
define_syscall!(FUTEX, 194);
define_syscall!(SCHED_SETAFFINITY, 195);
define_syscall!(SCHED_GETAFFINITY, 196);
define_syscall!(CACHEFLUSH, 197);
define_syscall!(CACHECTL, 198);
define_syscall!(SYSMIPS, 199);
define_syscall!(IO_SETUP, 200);
define_syscall!(IO_DESTROY, 201);
define_syscall!(IO_GETEVENTS, 202);
define_syscall!(IO_SUBMIT, 203);
define_syscall!(IO_CANCEL, 204);
define_syscall!(EXIT_GROUP, 205);
define_syscall!(LOOKUP_DCOOKIE, 206);
define_syscall!(EPOLL_CREATE, 207);
define_syscall!(EPOLL_CTL, 208);
define_syscall!(EPOLL_WAIT, 209);
define_syscall!(REMAP_FILE_PAGES, 210);
define_syscall!(RT_SIGRETURN, 211);
define_syscall!(FCNTL64, 212);
define_syscall!(SET_TID_ADDRESS, 213);
define_syscall!(RESTART_SYSCALL, 214);
define_syscall!(SEMTIMEDOP, 215);
define_syscall!(FADVISE64, 216);
define_syscall!(STATFS64, 217);
define_syscall!(FSTATFS64, 218);
define_syscall!(SENDFILE64, 219);
define_syscall!(TIMER_CREATE, 220);
define_syscall!(TIMER_SETTIME, 221);
define_syscall!(TIMER_GETTIME, 222);
define_syscall!(TIMER_GETOVERRUN, 223);
define_syscall!(TIMER_DELETE, 224);
define_syscall!(CLOCK_SETTIME, 225);
define_syscall!(CLOCK_GETTIME, 226);
define_syscall!(CLOCK_GETRES, 227);
define_syscall!(CLOCK_NANOSLEEP, 228);
define_syscall!(TGKILL, 229);
define_syscall!(UTIMES, 230);
define_syscall!(MBIND, 231);
define_syscall!(GET_MEMPOLICY, 232);
define_syscall!(SET_MEMPOLICY, 233);
define_syscall!(MQ_OPEN, 234);
define_syscall!(MQ_UNLINK, 235);
define_syscall!(MQ_TIMEDSEND, 236);
define_syscall!(MQ_TIMEDRECEIVE, 237);
define_syscall!(MQ_NOTIFY, 238);
define_syscall!(MQ_GETSETATTR, 239);
define_syscall!(VSERVER, 240);
define_syscall!(WAITID, 241);
define_syscall!(SYS_SETALTROOT, 242);
define_syscall!(ADD_KEY, 243);
define_syscall!(REQUEST_KEY, 244);
define_syscall!(KEYCTL, 245);
define_syscall!(SET_THREAD_AREA, 246);
define_syscall!(INOTIFY_INIT, 247);
define_syscall!(INOTIFY_ADD_WATCH, 248);
define_syscall!(INOTIFY_RM_WATCH, 249);
define_syscall!(MIGRATE_PAGES, 250);
define_syscall!(OPENAT, 251);
define_syscall!(MKDIRAT, 252);
define_syscall!(MKNODAT, 253);
define_syscall!(FCHOWNAT, 254);
define_syscall!(FUTIMESAT, 255);
define_syscall!(NEWFSTATAT, 256);
define_syscall!(UNLINKAT, 257);
define_syscall!(RENAMEAT, 258);
define_syscall!(LINKAT, 259);
define_syscall!(SYMLINKAT, 260);
define_syscall!(READLINKAT, 261);
define_syscall!(FCHMODAT, 262);
define_syscall!(FACCESSAT, 263);
define_syscall!(PSELECT6, 264);
define_syscall!(PPOLL, 265);
define_syscall!(UNSHARE, 266);
define_syscall!(SPLICE, 267);
define_syscall!(SYNC_FILE_RANGE, 268);
define_syscall!(TEE, 269);
define_syscall!(VMSPLICE, 270);
define_syscall!(MOVE_PAGES, 271);
define_syscall!(SET_ROBUST_LIST, 272);
define_syscall!(GET_ROBUST_LIST, 273);
define_syscall!(KEXEC_LOAD, 274);
define_syscall!(GETCPU, 275);
define_syscall!(EPOLL_PWAIT, 276);
define_syscall!(IOPRIO_SET, 277);
define_syscall!(IOPRIO_GET, 278);
define_syscall!(UTIMENSAT, 279);
define_syscall!(SIGNALFD, 280);
define_syscall!(TIMERFD, 281);
define_syscall!(EVENTFD, 282);
define_syscall!(FALLOCATE, 283);
define_syscall!(TIMERFD_CREATE, 284);
define_syscall!(TIMERFD_GETTIME, 285);
define_syscall!(TIMERFD_SETTIME, 286);
define_syscall!(SIGNALFD4, 287);
define_syscall!(EVENTFD2, 288);
define_syscall!(EPOLL_CREATE1, 289);
define_syscall!(DUP3, 290);
define_syscall!(PIPE2, 291);
define_syscall!(INOTIFY_INIT1, 292);
define_syscall!(PREADV, 293);
define_syscall!(PWRITEV, 294);
define_syscall!(RT_TGSIGQUEUEINFO, 295);
define_syscall!(PERF_EVENT_OPEN, 296);
define_syscall!(ACCEPT4, 297);
define_syscall!(RECVMMSG, 298);
define_syscall!(GETDENTS64, 299);
define_syscall!(FANOTIFY_INIT, 300);
define_syscall!(FANOTIFY_MARK, 301);
define_syscall!(PRLIMIT64, 302);
define_syscall!(NAME_TO_HANDLE_AT, 303);
define_syscall!(OPEN_BY_HANDLE_AT, 304);
define_syscall!(CLOCK_ADJTIME, 305);
define_syscall!(SYNCFS, 306);
define_syscall!(SENDMMSG, 307);
define_syscall!(SETNS, 308);
define_syscall!(PROCESS_VM_READV, 309);
define_syscall!(PROCESS_VM_WRITEV, 310);
define_syscall!(KCMP, 311);
define_syscall!(FINIT_MODULE, 312);
define_syscall!(SCHED_SETATTR, 313);
define_syscall!(SCHED_GETATTR, 314);
define_syscall!(RENAMEAT2, 315);
define_syscall!(SECCOMP, 316);
define_syscall!(GETRANDOM, 317);
define_syscall!(MEMFD_CREATE, 318);
define_syscall!(BPF, 319);
define_syscall!(EXECVEAT, 320);
define_syscall!(USERFAULTFD, 321);
define_syscall!(MEMBARRIER, 322);
define_syscall!(MLOCK2, 323);
define_syscall!(COPY_FILE_RANGE, 324);
define_syscall!(PREADV2, 325);
define_syscall!(PWRITEV2, 326);
define_syscall!(PKEY_MPROTECT, 327);
define_syscall!(PKEY_ALLOC, 328);
define_syscall!(PKEY_FREE, 329);
define_syscall!(STATX, 330);
define_syscall!(RSEQ, 331);
define_syscall!(IO_PGETEVENTS, 332);
// custom temporary syscall
pub const SYS_MAP_PCI_DEVICE: usize = 999;

View File

@ -44,7 +44,7 @@ pub fn syscall(id: usize, args: [usize; 6], tf: &mut TrapFrame) -> isize {
debug!("{}:{}:{} syscall id {} begin", cid, pid, tid, id);
}
// use syscall numbers in Linux x86_64
// use platform-specific syscal numbers
// See https://filippo.io/linux-syscall-table/
// And https://fedora.juszkiewicz.com.pl/syscalls.html.
let ret = match id {