Luming Wang has submitted this change. ( https://gem5-review.googlesource.com/c/public/gem5/+/54803 )

Change subject: arch-riscv,sim-se: Complements the system calls on RISC-V
......................................................................

arch-riscv,sim-se: Complements the system calls on RISC-V

There are many SE mode system calls that are implemented
in src/sim/syscall_emul.cc or src/sim/syscall_emul.hh.
And they work well under X86 and ARM platforms. However,
they are not supported in se_workload.cc under the RISC-V
platform. This patch adds support for all the system calls
already implemented in syscall_emul.hh/cc to the RISC-V
platform (in arch/riscv/linux/se_workload.cc).

Change-Id: Ia47c3c113767b50412b1c8ade3c1047c894376cf
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/54803
Reviewed-by: Jason Lowe-Power <[email protected]>
Maintainer: Jason Lowe-Power <[email protected]>
Tested-by: kokoro <[email protected]>
Reviewed-by: Bobby Bruce <[email protected]>
---
M src/arch/riscv/linux/se_workload.cc
1 file changed, 88 insertions(+), 66 deletions(-)

Approvals:
Jason Lowe-Power: Looks good to me, but someone else must approve; Looks good to me, approved
  Bobby Bruce: Looks good to me, approved
  kokoro: Regressions pass




diff --git a/src/arch/riscv/linux/se_workload.cc b/src/arch/riscv/linux/se_workload.cc
index 2e2a7d2..815b63b 100644
--- a/src/arch/riscv/linux/se_workload.cc
+++ b/src/arch/riscv/linux/se_workload.cc
@@ -157,8 +157,8 @@
     { 30,   "ioprio_get" },
     { 31,   "ioprio_set" },
     { 32,   "flock" },
-    { 33,   "mknodat" },
-    { 34,   "mkdirat" },
+    { 33,   "mknodat", mknodatFunc<RiscvLinux64> },
+    { 34,   "mkdirat", mkdiratFunc<RiscvLinux64> },
     { 35,   "unlinkat", unlinkatFunc<RiscvLinux64> },
     { 36,   "symlinkat" },
     { 37,   "linkat" },
@@ -173,7 +173,7 @@
     { 46,   "ftruncate", ftruncate64Func },
     { 47,   "fallocate", fallocateFunc<RiscvLinux64> },
     { 48,   "faccessat", faccessatFunc<RiscvLinux64> },
-    { 49,   "chdir" },
+    { 49,   "chdir", chdirFunc },
     { 50,   "fchdir" },
     { 51,   "chroot" },
     { 52,   "fchmod", fchmodFunc<RiscvLinux64> },
@@ -183,14 +183,14 @@
     { 56,   "openat", openatFunc<RiscvLinux64> },
     { 57,   "close", closeFunc },
     { 58,   "vhangup" },
-    { 59,   "pipe2" },
+    { 59,   "pipe2", pipe2Func },
     { 60,   "quotactl" },
-    { 61,   "getdents64" },
+    { 61,   "getdents64", getdents64Func },
     { 62,   "lseek", lseekFunc },
     { 63,   "read", readFunc<RiscvLinux64> },
     { 64,   "write", writeFunc<RiscvLinux64> },
     { 66,   "writev", writevFunc<RiscvLinux64> },
-    { 67,   "pread64" },
+    { 67,   "pread64", pread64Func<RiscvLinux64> },
     { 68,   "pwrite64", pwrite64Func<RiscvLinux64> },
     { 69,   "preadv" },
     { 70,   "pwritev" },
@@ -246,7 +246,7 @@
     { 120,  "sched_getscheduler" },
     { 121,  "sched_getparam" },
     { 122,  "sched_setaffinity" },
-    { 123,  "sched_getaffinity" },
+    { 123,  "sched_getaffinity", schedGetaffinityFunc<RiscvLinux64> },
     { 124,  "sched_yield", ignoreWarnOnceFunc },
     { 125,  "sched_get_priority_max" },
     { 126,  "sched_get_priority_min" },
@@ -291,7 +291,7 @@
     { 165,  "getrusage", getrusageFunc<RiscvLinux64> },
     { 166,  "umask", umaskFunc },
     { 167,  "prctl" },
-    { 168,  "getcpu" },
+    { 168,  "getcpu", getcpuFunc },
     { 169,  "gettimeofday", gettimeofdayFunc<RiscvLinux64> },
     { 170,  "settimeofday" },
     { 171,  "adjtimex" },
@@ -321,21 +321,21 @@
     { 195,  "shmctl" },
     { 196,  "shmat" },
     { 197,  "shmdt" },
-    { 198,  "socket" },
-    { 199,  "socketpair" },
-    { 200,  "bind" },
-    { 201,  "listen" },
-    { 202,  "accept" },
-    { 203,  "connect" },
-    { 204,  "getsockname" },
-    { 205,  "getpeername" },
+    { 198,  "socket", socketFunc<RiscvLinux64> },
+    { 199,  "socketpair", socketpairFunc<RiscvLinux64> },
+    { 200,  "bind", bindFunc },
+    { 201,  "listen", listenFunc },
+    { 202,  "accept", acceptFunc<RiscvLinux64> },
+    { 203,  "connect", connectFunc },
+    { 204,  "getsockname", getsocknameFunc },
+    { 205,  "getpeername", getpeernameFunc },
     { 206,  "sendo" },
-    { 207,  "recvfrom" },
-    { 208,  "setsockopt" },
-    { 209,  "getsockopt" },
-    { 210,  "shutdown" },
-    { 211,  "sendmsg" },
-    { 212,  "recvmsg" },
+    { 207,  "recvfrom", recvfromFunc<RiscvLinux64> },
+    { 208,  "setsockopt", setsockoptFunc },
+    { 209,  "getsockopt", getsockoptFunc },
+    { 210,  "shutdown", shutdownFunc },
+    { 211,  "sendmsg", sendmsgFunc },
+    { 212,  "recvmsg", recvmsgFunc },
     { 213,  "readahead" },
     { 214,  "brk", brkFunc },
     { 215,  "munmap", munmapFunc<RiscvLinux64> },
@@ -367,7 +367,7 @@
     { 241,  "perf_event_open" },
     { 242,  "accept4" },
     { 243,  "recvmmsg" },
-    { 260,  "wait4" },
+    { 260,  "wait4", wait4Func<RiscvLinux64> },
     { 261,  "prlimit64", prlimitFunc<RiscvLinux64> },
     { 262,  "fanotify_init" },
     { 263,  "fanotify_mark" },
@@ -396,18 +396,18 @@
     { 286,  "preadv2" },
     { 287,  "pwritev2" },
     { 1024, "open", openFunc<RiscvLinux64> },
-    { 1025, "link" },
+    { 1025, "link", linkFunc },
     { 1026, "unlink", unlinkFunc },
-    { 1027, "mknod" },
+    { 1027, "mknod", mknodFunc },
     { 1028, "chmod", chmodFunc<RiscvLinux64> },
     { 1029, "chown", chownFunc },
     { 1030, "mkdir", mkdirFunc },
-    { 1031, "rmdir" },
+    { 1031, "rmdir", rmdirFunc },
     { 1032, "lchown" },
     { 1033, "access", accessFunc },
     { 1034, "rename", renameFunc },
     { 1035, "readlink", readlinkFunc<RiscvLinux64> },
-    { 1036, "symlink" },
+    { 1036, "symlink", symlinkFunc },
     { 1037, "utimes", utimesFunc<RiscvLinux64> },
     { 1038, "stat", stat64Func<RiscvLinux64> },
     { 1039, "lstat", lstat64Func<RiscvLinux64> },
@@ -415,7 +415,7 @@
     { 1041, "dup2", dup2Func },
     { 1042, "epoll_create" },
     { 1043, "inotifiy_init" },
-    { 1044, "eventfd" },
+    { 1044, "eventfd", eventfdFunc<RiscvLinux64> },
     { 1045, "signalfd" },
     { 1046, "sendfile" },
     { 1047, "ftruncate", ftruncate64Func },
@@ -425,21 +425,21 @@
     { 1051, "fstat", fstat64Func<RiscvLinux64> },
     { 1052, "fcntl", fcntl64Func },
     { 1053, "fadvise64" },
-    { 1054, "newfstatat" },
+    { 1054, "newfstatat", newfstatatFunc<RiscvLinux64> },
     { 1055, "fstatfs", fstatfsFunc<RiscvLinux64> },
     { 1056, "statfs", statfsFunc<RiscvLinux64> },
     { 1057, "lseek", lseekFunc },
     { 1058, "mmap", mmapFunc<RiscvLinux64> },
     { 1059, "alarm" },
-    { 1060, "getpgrp" },
+    { 1060, "getpgrp", getpgrpFunc },
     { 1061, "pause" },
     { 1062, "time", timeFunc<RiscvLinux64> },
     { 1063, "utime" },
     { 1064, "creat" },
-    { 1065, "getdents" },
+    { 1065, "getdents", getdentsFunc },
     { 1066, "futimesat" },
-    { 1067, "select" },
-    { 1068, "poll" },
+    { 1067, "select", selectFunc<RiscvLinux64> },
+    { 1068, "poll", pollFunc<RiscvLinux64> },
     { 1069, "epoll_wait" },
     { 1070, "ustat" },
     { 1071, "vfork" },
@@ -488,8 +488,8 @@
     { 30,   "ioprio_get" },
     { 31,   "ioprio_set" },
     { 32,   "flock" },
-    { 33,   "mknodat" },
-    { 34,   "mkdirat" },
+    { 33,   "mknodat", mknodatFunc<RiscvLinux32> },
+    { 34,   "mkdirat", mkdiratFunc<RiscvLinux32> },
     { 35,   "unlinkat", unlinkatFunc<RiscvLinux32> },
     { 36,   "symlinkat" },
     { 37,   "linkat" },
@@ -504,7 +504,7 @@
     { 46,   "ftruncate", ftruncateFunc<RiscvLinux32> },
     { 47,   "fallocate", fallocateFunc<RiscvLinux32> },
     { 48,   "faccessat", faccessatFunc<RiscvLinux32> },
-    { 49,   "chdir" },
+    { 49,   "chdir", chdirFunc },
     { 50,   "fchdir" },
     { 51,   "chroot" },
     { 52,   "fchmod", fchmodFunc<RiscvLinux32> },
@@ -514,14 +514,14 @@
     { 56,   "openat", openatFunc<RiscvLinux32> },
     { 57,   "close", closeFunc },
     { 58,   "vhangup" },
-    { 59,   "pipe2" },
+    { 59,   "pipe2", pipe2Func },
     { 60,   "quotactl" },
-    { 61,   "getdents64" },
+    { 61,   "getdents64", getdents64Func },
     { 62,   "lseek", lseekFunc },
     { 63,   "read", readFunc<RiscvLinux32> },
     { 64,   "write", writeFunc<RiscvLinux32> },
     { 66,   "writev", writevFunc<RiscvLinux32> },
-    { 67,   "pread64" },
+    { 67,   "pread64", pread64Func<RiscvLinux32> },
     { 68,   "pwrite64", pwrite64Func<RiscvLinux32> },
     { 69,   "preadv" },
     { 70,   "pwritev" },
@@ -577,7 +577,7 @@
     { 120,  "sched_getscheduler" },
     { 121,  "sched_getparam" },
     { 122,  "sched_setaffinity" },
-    { 123,  "sched_getaffinity" },
+    { 123,  "sched_getaffinity", schedGetaffinityFunc<RiscvLinux32> },
     { 124,  "sched_yield", ignoreWarnOnceFunc },
     { 125,  "sched_get_priority_max" },
     { 126,  "sched_get_priority_min" },
@@ -622,7 +622,7 @@
     { 165,  "getrusage", getrusageFunc<RiscvLinux32> },
     { 166,  "umask", umaskFunc },
     { 167,  "prctl" },
-    { 168,  "getcpu" },
+    { 168,  "getcpu", getcpuFunc },
     { 169,  "gettimeofday", gettimeofdayFunc<RiscvLinux32> },
     { 170,  "settimeofday" },
     { 171,  "adjtimex" },
@@ -652,21 +652,21 @@
     { 195,  "shmctl" },
     { 196,  "shmat" },
     { 197,  "shmdt" },
-    { 198,  "socket" },
-    { 199,  "socketpair" },
-    { 200,  "bind" },
-    { 201,  "listen" },
-    { 202,  "accept" },
-    { 203,  "connect" },
-    { 204,  "getsockname" },
-    { 205,  "getpeername" },
+    { 198,  "socket", socketFunc<RiscvLinux32> },
+    { 199,  "socketpair", socketpairFunc<RiscvLinux32> },
+    { 200,  "bind", bindFunc },
+    { 201,  "listen", listenFunc },
+    { 202,  "accept", acceptFunc<RiscvLinux32> },
+    { 203,  "connect", connectFunc },
+    { 204,  "getsockname", getsocknameFunc },
+    { 205,  "getpeername", getpeernameFunc },
     { 206,  "sendo" },
-    { 207,  "recvfrom" },
-    { 208,  "setsockopt" },
-    { 209,  "getsockopt" },
-    { 210,  "shutdown" },
-    { 211,  "sendmsg" },
-    { 212,  "recvmsg" },
+    { 207,  "recvfrom", recvfromFunc<RiscvLinux32> },
+    { 208,  "setsockopt", setsockoptFunc },
+    { 209,  "getsockopt", getsockoptFunc },
+    { 210,  "shutdown", shutdownFunc },
+    { 211,  "sendmsg", sendmsgFunc },
+    { 212,  "recvmsg", recvmsgFunc },
     { 213,  "readahead" },
     { 214,  "brk", brkFunc },
     { 215,  "munmap", munmapFunc<RiscvLinux32> },
@@ -698,7 +698,7 @@
     { 241,  "perf_event_open" },
     { 242,  "accept4" },
     { 243,  "recvmmsg" },
-    { 260,  "wait4" },
+    { 260,  "wait4", wait4Func<RiscvLinux32> },
     { 261,  "prlimit64", prlimitFunc<RiscvLinux32> },
     { 262,  "fanotify_init" },
     { 263,  "fanotify_mark" },
@@ -727,18 +727,18 @@
     { 286,  "preadv2" },
     { 287,  "pwritev2" },
     { 1024, "open", openFunc<RiscvLinux32> },
-    { 1025, "link" },
+    { 1025, "link", linkFunc },
     { 1026, "unlink", unlinkFunc },
-    { 1027, "mknod" },
+    { 1027, "mknod", mknodFunc },
     { 1028, "chmod", chmodFunc<RiscvLinux32> },
     { 1029, "chown", chownFunc },
     { 1030, "mkdir", mkdirFunc },
-    { 1031, "rmdir" },
+    { 1031, "rmdir", rmdirFunc },
     { 1032, "lchown" },
     { 1033, "access", accessFunc },
     { 1034, "rename", renameFunc },
     { 1035, "readlink", readlinkFunc<RiscvLinux32> },
-    { 1036, "symlink" },
+    { 1036, "symlink", symlinkFunc },
     { 1037, "utimes", utimesFunc<RiscvLinux32> },
     { 1038, "stat", statFunc<RiscvLinux32> },
     { 1039, "lstat", lstatFunc<RiscvLinux32> },
@@ -746,7 +746,7 @@
     { 1041, "dup2", dup2Func },
     { 1042, "epoll_create" },
     { 1043, "inotifiy_init" },
-    { 1044, "eventfd" },
+    { 1044, "eventfd", eventfdFunc<RiscvLinux32> },
     { 1045, "signalfd" },
     { 1046, "sendfile" },
     { 1047, "ftruncate", ftruncateFunc<RiscvLinux32> },
@@ -756,21 +756,21 @@
     { 1051, "fstat", fstatFunc<RiscvLinux32> },
     { 1052, "fcntl", fcntlFunc },
     { 1053, "fadvise64" },
-    { 1054, "newfstatat" },
+    { 1054, "newfstatat", newfstatatFunc<RiscvLinux32> },
     { 1055, "fstatfs", fstatfsFunc<RiscvLinux32> },
     { 1056, "statfs", statfsFunc<RiscvLinux32> },
     { 1057, "lseek", lseekFunc },
     { 1058, "mmap", mmapFunc<RiscvLinux32> },
     { 1059, "alarm" },
-    { 1060, "getpgrp" },
+    { 1060, "getpgrp", getpgrpFunc },
     { 1061, "pause" },
     { 1062, "time", timeFunc<RiscvLinux32> },
     { 1063, "utime" },
     { 1064, "creat" },
-    { 1065, "getdents" },
+    { 1065, "getdents", getdentsFunc },
     { 1066, "futimesat" },
-    { 1067, "select" },
-    { 1068, "poll" },
+    { 1067, "select", selectFunc<RiscvLinux32> },
+    { 1068, "poll", pollFunc<RiscvLinux32> },
     { 1069, "epoll_wait" },
     { 1070, "ustat" },
     { 1071, "vfork" },

--
To view, visit https://gem5-review.googlesource.com/c/public/gem5/+/54803
To unsubscribe, or for help writing mail filters, visit https://gem5-review.googlesource.com/settings

Gerrit-Project: public/gem5
Gerrit-Branch: develop
Gerrit-Change-Id: Ia47c3c113767b50412b1c8ade3c1047c894376cf
Gerrit-Change-Number: 54803
Gerrit-PatchSet: 4
Gerrit-Owner: Luming Wang <[email protected]>
Gerrit-Reviewer: Bobby Bruce <[email protected]>
Gerrit-Reviewer: Gabe Black <[email protected]>
Gerrit-Reviewer: Jason Lowe-Power <[email protected]>
Gerrit-Reviewer: Luming Wang <[email protected]>
Gerrit-Reviewer: kokoro <[email protected]>
Gerrit-MessageType: merged
_______________________________________________
gem5-dev mailing list -- [email protected]
To unsubscribe send an email to [email protected]
%(web_page_url)slistinfo%(cgiext)s/%(_internal_name)s

Reply via email to