gem5  [DEVELOP-FOR-23.0]
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
se_workload.cc
Go to the documentation of this file.
1 /*
2  * Copyright 2005 The Regents of The University of Michigan
3  * Copyright 2007 MIPS Technologies, Inc.
4  * Copyright 2016 The University of Virginia
5  * Copyright 2020 Google Inc.
6  *
7  * Redistribution and use in source and binary forms, with or without
8  * modification, are permitted provided that the following conditions are
9  * met: redistributions of source code must retain the above copyright
10  * notice, this list of conditions and the following disclaimer;
11  * redistributions in binary form must reproduce the above copyright
12  * notice, this list of conditions and the following disclaimer in the
13  * documentation and/or other materials provided with the distribution;
14  * neither the name of the copyright holders nor the names of its
15  * contributors may be used to endorse or promote products derived from
16  * this software without specific prior written permission.
17  *
18  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
19  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
20  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
21  * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
22  * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
23  * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
24  * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
25  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
26  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
27  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
28  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29  */
30 
32 
33 #include <sys/syscall.h>
34 
35 #include "arch/riscv/process.hh"
37 #include "base/trace.hh"
38 #include "cpu/thread_context.hh"
39 #include "sim/syscall_emul.hh"
40 
41 namespace gem5
42 {
43 
44 namespace
45 {
46 
47 class LinuxLoader : public Process::Loader
48 {
49  public:
50  Process *
51  load(const ProcessParams &params, loader::ObjectFile *obj) override
52  {
53  auto arch = obj->getArch();
54  auto opsys = obj->getOpSys();
55 
56  if (arch != loader::Riscv64 && arch != loader::Riscv32)
57  return nullptr;
58 
59  if (opsys == loader::UnknownOpSys) {
60  warn("Unknown operating system; assuming Linux.");
61  opsys = loader::Linux;
62  }
63 
64  if (opsys != loader::Linux)
65  return nullptr;
66 
67  if (arch == loader::Riscv64)
68  return new RiscvProcess64(params, obj);
69  else
70  return new RiscvProcess32(params, obj);
71  }
72 };
73 
74 LinuxLoader linuxLoader;
75 
76 } // anonymous namespace
77 
78 namespace RiscvISA
79 {
80 
81 void
83 {
84  Process *process = tc->getProcessPtr();
85  // Call the syscall function in the base Process class to update stats.
86  // This will move into the base SEWorkload function at some point.
87  process->Process::syscall(tc);
88 
90  if (dynamic_cast<RiscvProcess64 *>(process))
91  syscallDescs64.get(num)->doSyscall(tc);
92  else
93  syscallDescs32.get(num)->doSyscall(tc);
94 }
95 
97 static SyscallReturn
99 {
100  auto process = tc->getProcessPtr();
101 
102  strcpy(name->sysname, "Linux");
103  strcpy(name->nodename,"sim.gem5.org");
104  strcpy(name->release, process->release.c_str());
105  strcpy(name->version, "#1 Mon Aug 18 11:32:15 EDT 2003");
106  strcpy(name->machine, "riscv64");
107 
108  return 0;
109 }
110 
112 static SyscallReturn
114 {
115  auto process = tc->getProcessPtr();
116 
117  strcpy(name->sysname, "Linux");
118  strcpy(name->nodename,"sim.gem5.org");
119  strcpy(name->release, process->release.c_str());
120  strcpy(name->version, "#1 Mon Aug 18 11:32:15 EDT 2003");
121  strcpy(name->machine, "riscv32");
122 
123  return 0;
124 }
125 
127  { 0, "io_setup" },
128  { 1, "io_destroy" },
129  { 2, "io_submit" },
130  { 3, "io_cancel" },
131  { 4, "io_getevents" },
132  { 5, "setxattr" },
133  { 6, "lsetxattr" },
134  { 7, "fsetxattr" },
135  { 8, "getxattr" },
136  { 9, "lgetxattr" },
137  { 10, "fgetxattr" },
138  { 11, "listxattr" },
139  { 12, "llistxattr" },
140  { 13, "flistxattr" },
141  { 14, "removexattr" },
142  { 15, "lremovexattr" },
143  { 16, "fremovexattr" },
144  { 17, "getcwd", getcwdFunc },
145  { 18, "lookup_dcookie" },
146  { 19, "eventfd2" },
147  { 20, "epoll_create1" },
148  { 21, "epoll_ctl" },
149  { 22, "epoll_pwait" },
150  { 23, "dup", dupFunc },
151  { 24, "dup3" },
152  { 25, "fcntl", fcntl64Func },
153  { 26, "inotify_init1" },
154  { 27, "inotify_add_watch" },
155  { 28, "inotify_rm_watch" },
156  { 29, "ioctl", ioctlFunc<RiscvLinux64> },
157  { 30, "ioprio_get" },
158  { 31, "ioprio_set" },
159  { 32, "flock" },
160  { 33, "mknodat", mknodatFunc<RiscvLinux64> },
161  { 34, "mkdirat", mkdiratFunc<RiscvLinux64> },
162  { 35, "unlinkat", unlinkatFunc<RiscvLinux64> },
163  { 36, "symlinkat" },
164  { 37, "linkat" },
165  { 38, "renameat", renameatFunc<RiscvLinux64> },
166  { 39, "umount2" },
167  { 40, "mount" },
168  { 41, "pivot_root" },
169  { 42, "nfsservctl" },
170  { 43, "statfs", statfsFunc<RiscvLinux64> },
171  { 44, "fstatfs", fstatfsFunc<RiscvLinux64> },
172  { 45, "truncate", truncateFunc<RiscvLinux64> },
173  { 46, "ftruncate", ftruncate64Func },
174  { 47, "fallocate", fallocateFunc<RiscvLinux64> },
175  { 48, "faccessat", faccessatFunc<RiscvLinux64> },
176  { 49, "chdir", chdirFunc },
177  { 50, "fchdir" },
178  { 51, "chroot" },
179  { 52, "fchmod", fchmodFunc<RiscvLinux64> },
180  { 53, "fchmodat" },
181  { 54, "fchownat" },
182  { 55, "fchown", fchownFunc },
183  { 56, "openat", openatFunc<RiscvLinux64> },
184  { 57, "close", closeFunc },
185  { 58, "vhangup" },
186  { 59, "pipe2", pipe2Func },
187  { 60, "quotactl" },
188 #if defined(SYS_getdents64)
189  { 61, "getdents64", getdents64Func },
190 #else
191  { 61, "getdents64" },
192 #endif
193  { 62, "lseek", lseekFunc },
194  { 63, "read", readFunc<RiscvLinux64> },
195  { 64, "write", writeFunc<RiscvLinux64> },
196  { 66, "writev", writevFunc<RiscvLinux64> },
197  { 67, "pread64", pread64Func<RiscvLinux64> },
198  { 68, "pwrite64", pwrite64Func<RiscvLinux64> },
199  { 69, "preadv" },
200  { 70, "pwritev" },
201  { 71, "sendfile" },
202  { 72, "pselect6" },
203  { 73, "ppoll" },
204  { 74, "signalfd64" },
205  { 75, "vmsplice" },
206  { 76, "splice" },
207  { 77, "tee" },
208  { 78, "readlinkat", readlinkatFunc<RiscvLinux64> },
209  { 79, "fstatat", fstatat64Func<RiscvLinux64> },
210  { 80, "fstat", fstat64Func<RiscvLinux64> },
211  { 81, "sync" },
212  { 82, "fsync" },
213  { 83, "fdatasync" },
214  { 84, "sync_file_range2" },
215  { 85, "timerfd_create" },
216  { 86, "timerfd_settime" },
217  { 87, "timerfd_gettime" },
218  { 88, "utimensat" },
219  { 89, "acct" },
220  { 90, "capget" },
221  { 91, "capset" },
222  { 92, "personality" },
223  { 93, "exit", exitFunc },
224  { 94, "exit_group", exitGroupFunc },
225  { 95, "waitid" },
226  { 96, "set_tid_address", setTidAddressFunc },
227  { 97, "unshare" },
228  { 98, "futex", futexFunc<RiscvLinux64> },
229  { 99, "set_robust_list", ignoreWarnOnceFunc },
230  { 100, "get_robust_list", ignoreWarnOnceFunc },
231  { 101, "nanosleep", ignoreWarnOnceFunc },
232  { 102, "getitimer" },
233  { 103, "setitimer" },
234  { 104, "kexec_load" },
235  { 105, "init_module" },
236  { 106, "delete_module" },
237  { 107, "timer_create" },
238  { 108, "timer_gettime" },
239  { 109, "timer_getoverrun" },
240  { 110, "timer_settime" },
241  { 111, "timer_delete" },
242  { 112, "clock_settime" },
243  { 113, "clock_gettime", clock_gettimeFunc<RiscvLinux64> },
244  { 114, "clock_getres", clock_getresFunc<RiscvLinux64> },
245  { 115, "clock_nanosleep" },
246  { 116, "syslog" },
247  { 117, "ptrace" },
248  { 118, "sched_setparam" },
249  { 119, "sched_setscheduler" },
250  { 120, "sched_getscheduler" },
251  { 121, "sched_getparam" },
252  { 122, "sched_setaffinity" },
253  { 123, "sched_getaffinity", schedGetaffinityFunc<RiscvLinux64> },
254  { 124, "sched_yield", ignoreWarnOnceFunc },
255  { 125, "sched_get_priority_max" },
256  { 126, "sched_get_priority_min" },
257  { 127, "scheD_rr_get_interval" },
258  { 128, "restart_syscall" },
259  { 129, "kill" },
260  { 130, "tkill" },
261  { 131, "tgkill", tgkillFunc<RiscvLinux64> },
262  { 132, "sigaltstack" },
263  { 133, "rt_sigsuspend", ignoreWarnOnceFunc },
264  { 134, "rt_sigaction", ignoreWarnOnceFunc },
265  { 135, "rt_sigprocmask", ignoreWarnOnceFunc },
266  { 136, "rt_sigpending", ignoreWarnOnceFunc },
267  { 137, "rt_sigtimedwait", ignoreWarnOnceFunc },
268  { 138, "rt_sigqueueinfo", ignoreWarnOnceFunc },
269  { 139, "rt_sigreturn", ignoreWarnOnceFunc },
270  { 140, "setpriority" },
271  { 141, "getpriority" },
272  { 142, "reboot" },
273  { 143, "setregid" },
274  { 144, "setgid" },
275  { 145, "setreuid" },
276  { 146, "setuid", ignoreFunc },
277  { 147, "setresuid" },
278  { 148, "getresuid" },
279  { 149, "getresgid" },
280  { 150, "getresgid" },
281  { 151, "setfsuid" },
282  { 152, "setfsgid" },
283  { 153, "times", timesFunc<RiscvLinux64> },
284  { 154, "setpgid", setpgidFunc },
285  { 155, "getpgid" },
286  { 156, "getsid" },
287  { 157, "setsid" },
288  { 158, "getgroups" },
289  { 159, "setgroups" },
290  { 160, "uname", unameFunc64 },
291  { 161, "sethostname" },
292  { 162, "setdomainname" },
293  { 163, "getrlimit", getrlimitFunc<RiscvLinux64> },
294  { 164, "setrlimit", ignoreFunc },
295  { 165, "getrusage", getrusageFunc<RiscvLinux64> },
296  { 166, "umask", umaskFunc },
297  { 167, "prctl" },
298  { 168, "getcpu", getcpuFunc },
299  { 169, "gettimeofday", gettimeofdayFunc<RiscvLinux64> },
300  { 170, "settimeofday" },
301  { 171, "adjtimex" },
302  { 172, "getpid", getpidFunc },
303  { 173, "getppid", getppidFunc },
304  { 174, "getuid", getuidFunc },
305  { 175, "geteuid", geteuidFunc },
306  { 176, "getgid", getgidFunc },
307  { 177, "getegid", getegidFunc },
308  { 178, "gettid", gettidFunc },
309  { 179, "sysinfo", sysinfoFunc<RiscvLinux64> },
310  { 180, "mq_open" },
311  { 181, "mq_unlink" },
312  { 182, "mq_timedsend" },
313  { 183, "mq_timedrecieve" },
314  { 184, "mq_notify" },
315  { 185, "mq_getsetattr" },
316  { 186, "msgget" },
317  { 187, "msgctl" },
318  { 188, "msgrcv" },
319  { 189, "msgsnd" },
320  { 190, "semget" },
321  { 191, "semctl" },
322  { 192, "semtimedop" },
323  { 193, "semop" },
324  { 194, "shmget" },
325  { 195, "shmctl" },
326  { 196, "shmat" },
327  { 197, "shmdt" },
328  { 198, "socket", socketFunc<RiscvLinux64> },
329  { 199, "socketpair", socketpairFunc<RiscvLinux64> },
330  { 200, "bind", bindFunc },
331  { 201, "listen", listenFunc },
332  { 202, "accept", acceptFunc<RiscvLinux64> },
333  { 203, "connect", connectFunc },
334  { 204, "getsockname", getsocknameFunc },
335  { 205, "getpeername", getpeernameFunc },
336  { 206, "sendto", sendtoFunc<RiscvLinux64> },
337  { 207, "recvfrom", recvfromFunc<RiscvLinux64> },
338  { 208, "setsockopt", setsockoptFunc },
339  { 209, "getsockopt", getsockoptFunc },
340  { 210, "shutdown", shutdownFunc },
341  { 211, "sendmsg", sendmsgFunc },
342  { 212, "recvmsg", recvmsgFunc },
343  { 213, "readahead" },
344  { 214, "brk", brkFunc },
345  { 215, "munmap", munmapFunc<RiscvLinux64> },
346  { 216, "mremap", mremapFunc<RiscvLinux64> },
347  { 217, "add_key" },
348  { 218, "request_key" },
349  { 219, "keyctl" },
350  { 220, "clone", cloneBackwardsFunc<RiscvLinux64> },
351  { 221, "execve", execveFunc<RiscvLinux64> },
352  { 222, "mmap", mmapFunc<RiscvLinux64> },
353  { 223, "fadvise64" },
354  { 224, "swapon" },
355  { 225, "swapoff" },
356  { 226, "mprotect", ignoreFunc },
357  { 227, "msync", ignoreFunc },
358  { 228, "mlock", ignoreFunc },
359  { 229, "munlock", ignoreFunc },
360  { 230, "mlockall", ignoreFunc },
361  { 231, "munlockall", ignoreFunc },
362  { 232, "mincore", ignoreFunc },
363  { 233, "madvise", ignoreFunc },
364  { 234, "remap_file_pages" },
365  { 235, "mbind", ignoreFunc },
366  { 236, "get_mempolicy" },
367  { 237, "set_mempolicy" },
368  { 238, "migrate_pages" },
369  { 239, "move_pages" },
370  { 240, "tgsigqueueinfo" },
371  { 241, "perf_event_open" },
372  { 242, "accept4" },
373  { 243, "recvmmsg" },
374  { 260, "wait4", wait4Func<RiscvLinux64> },
375  { 261, "prlimit64", prlimitFunc<RiscvLinux64> },
376  { 262, "fanotify_init" },
377  { 263, "fanotify_mark" },
378  { 264, "name_to_handle_at" },
379  { 265, "open_by_handle_at" },
380  { 266, "clock_adjtime" },
381  { 267, "syncfs" },
382  { 268, "setns" },
383  { 269, "sendmmsg" },
384  { 270, "process_vm_ready" },
385  { 271, "process_vm_writev" },
386  { 272, "kcmp" },
387  { 273, "finit_module" },
388  { 274, "sched_setattr" },
389  { 275, "sched_getattr" },
390  { 276, "renameat2" },
391  { 277, "seccomp" },
392  { 278, "getrandom", getrandomFunc<RiscvLinux64> },
393  { 279, "memfd_create" },
394  { 280, "bpf" },
395  { 281, "execveat" },
396  { 282, "userfaultid" },
397  { 283, "membarrier" },
398  { 284, "mlock2" },
399  { 285, "copy_file_range" },
400  { 286, "preadv2" },
401  { 287, "pwritev2" },
402  { 1024, "open", openFunc<RiscvLinux64> },
403  { 1025, "link", linkFunc },
404  { 1026, "unlink", unlinkFunc },
405  { 1027, "mknod", mknodFunc },
406  { 1028, "chmod", chmodFunc<RiscvLinux64> },
407  { 1029, "chown", chownFunc },
408  { 1030, "mkdir", mkdirFunc },
409  { 1031, "rmdir", rmdirFunc },
410  { 1032, "lchown" },
411  { 1033, "access", accessFunc },
412  { 1034, "rename", renameFunc },
413  { 1035, "readlink", readlinkFunc<RiscvLinux64> },
414  { 1036, "symlink", symlinkFunc },
415  { 1037, "utimes", utimesFunc<RiscvLinux64> },
416  { 1038, "stat", stat64Func<RiscvLinux64> },
417  { 1039, "lstat", lstat64Func<RiscvLinux64> },
418  { 1040, "pipe", pipeFunc },
419  { 1041, "dup2", dup2Func },
420  { 1042, "epoll_create" },
421  { 1043, "inotifiy_init" },
422  { 1044, "eventfd", eventfdFunc<RiscvLinux64> },
423  { 1045, "signalfd" },
424  { 1046, "sendfile" },
425  { 1047, "ftruncate", ftruncate64Func },
426  { 1048, "truncate", truncate64Func },
427  { 1049, "stat", stat64Func<RiscvLinux64> },
428  { 1050, "lstat", lstat64Func<RiscvLinux64> },
429  { 1051, "fstat", fstat64Func<RiscvLinux64> },
430  { 1052, "fcntl", fcntl64Func },
431  { 1053, "fadvise64" },
432  { 1054, "newfstatat", newfstatatFunc<RiscvLinux64> },
433  { 1055, "fstatfs", fstatfsFunc<RiscvLinux64> },
434  { 1056, "statfs", statfsFunc<RiscvLinux64> },
435  { 1057, "lseek", lseekFunc },
436  { 1058, "mmap", mmapFunc<RiscvLinux64> },
437  { 1059, "alarm" },
438  { 1060, "getpgrp", getpgrpFunc },
439  { 1061, "pause" },
440  { 1062, "time", timeFunc<RiscvLinux64> },
441  { 1063, "utime" },
442  { 1064, "creat" },
443 #if defined(SYS_getdents)
444  { 1065, "getdents", getdentsFunc },
445 #else
446  { 1065, "getdents" },
447 #endif
448  { 1066, "futimesat" },
449  { 1067, "select", selectFunc<RiscvLinux64> },
450  { 1068, "poll", pollFunc<RiscvLinux64> },
451  { 1069, "epoll_wait" },
452  { 1070, "ustat" },
453  { 1071, "vfork" },
454  { 1072, "oldwait4" },
455  { 1073, "recv" },
456  { 1074, "send" },
457  { 1075, "bdflush" },
458  { 1076, "umount" },
459  { 1077, "uselib" },
460  { 1078, "sysctl" },
461  { 1079, "fork" },
462  { 2011, "getmainvars" }
463 };
464 
465 SyscallDescTable<SEWorkload::SyscallABI32> EmuLinux::syscallDescs32 = {
466  { 0, "io_setup" },
467  { 1, "io_destroy" },
468  { 2, "io_submit" },
469  { 3, "io_cancel" },
470  { 4, "io_getevents" },
471  { 5, "setxattr" },
472  { 6, "lsetxattr" },
473  { 7, "fsetxattr" },
474  { 8, "getxattr" },
475  { 9, "lgetxattr" },
476  { 10, "fgetxattr" },
477  { 11, "listxattr" },
478  { 12, "llistxattr" },
479  { 13, "flistxattr" },
480  { 14, "removexattr" },
481  { 15, "lremovexattr" },
482  { 16, "fremovexattr" },
483  { 17, "getcwd", getcwdFunc },
484  { 18, "lookup_dcookie" },
485  { 19, "eventfd2" },
486  { 20, "epoll_create1" },
487  { 21, "epoll_ctl" },
488  { 22, "epoll_pwait" },
489  { 23, "dup", dupFunc },
490  { 24, "dup3" },
491  { 25, "fcntl", fcntlFunc },
492  { 26, "inotify_init1" },
493  { 27, "inotify_add_watch" },
494  { 28, "inotify_rm_watch" },
495  { 29, "ioctl", ioctlFunc<RiscvLinux32> },
496  { 30, "ioprio_get" },
497  { 31, "ioprio_set" },
498  { 32, "flock" },
499  { 33, "mknodat", mknodatFunc<RiscvLinux32> },
500  { 34, "mkdirat", mkdiratFunc<RiscvLinux32> },
501  { 35, "unlinkat", unlinkatFunc<RiscvLinux32> },
502  { 36, "symlinkat" },
503  { 37, "linkat" },
504  { 38, "renameat", renameatFunc<RiscvLinux32> },
505  { 39, "umount2" },
506  { 40, "mount" },
507  { 41, "pivot_root" },
508  { 42, "nfsservctl" },
509  { 43, "statfs", statfsFunc<RiscvLinux32> },
510  { 44, "fstatfs", fstatfsFunc<RiscvLinux32> },
511  { 45, "truncate", truncateFunc<RiscvLinux32> },
512  { 46, "ftruncate", ftruncateFunc<RiscvLinux32> },
513  { 47, "fallocate", fallocateFunc<RiscvLinux32> },
514  { 48, "faccessat", faccessatFunc<RiscvLinux32> },
515  { 49, "chdir", chdirFunc },
516  { 50, "fchdir" },
517  { 51, "chroot" },
518  { 52, "fchmod", fchmodFunc<RiscvLinux32> },
519  { 53, "fchmodat" },
520  { 54, "fchownat" },
521  { 55, "fchown", fchownFunc },
522  { 56, "openat", openatFunc<RiscvLinux32> },
523  { 57, "close", closeFunc },
524  { 58, "vhangup" },
525  { 59, "pipe2", pipe2Func },
526  { 60, "quotactl" },
527 #if defined(SYS_getdents64)
528  { 61, "getdents64", getdents64Func },
529 #else
530  { 61, "getdents64" },
531 #endif
532  { 62, "lseek", lseekFunc },
533  { 63, "read", readFunc<RiscvLinux32> },
534  { 64, "write", writeFunc<RiscvLinux32> },
535  { 66, "writev", writevFunc<RiscvLinux32> },
536  { 67, "pread64", pread64Func<RiscvLinux32> },
537  { 68, "pwrite64", pwrite64Func<RiscvLinux32> },
538  { 69, "preadv" },
539  { 70, "pwritev" },
540  { 71, "sendfile" },
541  { 72, "pselect6" },
542  { 73, "ppoll" },
543  { 74, "signalfd64" },
544  { 75, "vmsplice" },
545  { 76, "splice" },
546  { 77, "tee" },
547  { 78, "readlinkat", readlinkatFunc<RiscvLinux32> },
548  { 79, "fstatat" },
549  { 80, "fstat", fstatFunc<RiscvLinux32> },
550  { 81, "sync" },
551  { 82, "fsync" },
552  { 83, "fdatasync" },
553  { 84, "sync_file_range2" },
554  { 85, "timerfd_create" },
555  { 86, "timerfd_settime" },
556  { 87, "timerfd_gettime" },
557  { 88, "utimensat" },
558  { 89, "acct" },
559  { 90, "capget" },
560  { 91, "capset" },
561  { 92, "personality" },
562  { 93, "exit", exitFunc },
563  { 94, "exit_group", exitGroupFunc },
564  { 95, "waitid" },
565  { 96, "set_tid_address", setTidAddressFunc },
566  { 97, "unshare" },
567  { 98, "futex", futexFunc<RiscvLinux32> },
568  { 99, "set_robust_list", ignoreWarnOnceFunc },
569  { 100, "get_robust_list", ignoreWarnOnceFunc },
570  { 101, "nanosleep" },
571  { 102, "getitimer" },
572  { 103, "setitimer" },
573  { 104, "kexec_load" },
574  { 105, "init_module" },
575  { 106, "delete_module" },
576  { 107, "timer_create" },
577  { 108, "timer_gettime" },
578  { 109, "timer_getoverrun" },
579  { 110, "timer_settime" },
580  { 111, "timer_delete" },
581  { 112, "clock_settime" },
582  { 113, "clock_gettime", clock_gettimeFunc<RiscvLinux32> },
583  { 114, "clock_getres", clock_getresFunc<RiscvLinux32> },
584  { 115, "clock_nanosleep" },
585  { 116, "syslog" },
586  { 117, "ptrace" },
587  { 118, "sched_setparam" },
588  { 119, "sched_setscheduler" },
589  { 120, "sched_getscheduler" },
590  { 121, "sched_getparam" },
591  { 122, "sched_setaffinity" },
592  { 123, "sched_getaffinity", schedGetaffinityFunc<RiscvLinux32> },
593  { 124, "sched_yield", ignoreWarnOnceFunc },
594  { 125, "sched_get_priority_max" },
595  { 126, "sched_get_priority_min" },
596  { 127, "scheD_rr_get_interval" },
597  { 128, "restart_syscall" },
598  { 129, "kill" },
599  { 130, "tkill" },
600  { 131, "tgkill", tgkillFunc<RiscvLinux32> },
601  { 132, "sigaltstack" },
602  { 133, "rt_sigsuspend", ignoreWarnOnceFunc },
603  { 134, "rt_sigaction", ignoreWarnOnceFunc },
604  { 135, "rt_sigprocmask", ignoreWarnOnceFunc },
605  { 136, "rt_sigpending", ignoreWarnOnceFunc },
606  { 137, "rt_sigtimedwait", ignoreWarnOnceFunc },
607  { 138, "rt_sigqueueinfo", ignoreWarnOnceFunc },
608  { 139, "rt_sigreturn", ignoreWarnOnceFunc },
609  { 140, "setpriority" },
610  { 141, "getpriority" },
611  { 142, "reboot" },
612  { 143, "setregid" },
613  { 144, "setgid" },
614  { 145, "setreuid" },
615  { 146, "setuid", ignoreFunc },
616  { 147, "setresuid" },
617  { 148, "getresuid" },
618  { 149, "getresgid" },
619  { 150, "getresgid" },
620  { 151, "setfsuid" },
621  { 152, "setfsgid" },
622  { 153, "times", timesFunc<RiscvLinux32> },
623  { 154, "setpgid", setpgidFunc },
624  { 155, "getpgid" },
625  { 156, "getsid" },
626  { 157, "setsid" },
627  { 158, "getgroups" },
628  { 159, "setgroups" },
629  { 160, "uname", unameFunc32 },
630  { 161, "sethostname" },
631  { 162, "setdomainname" },
632  { 163, "getrlimit", getrlimitFunc<RiscvLinux32> },
633  { 164, "setrlimit", ignoreFunc },
634  { 165, "getrusage", getrusageFunc<RiscvLinux32> },
635  { 166, "umask", umaskFunc },
636  { 167, "prctl" },
637  { 168, "getcpu", getcpuFunc },
638  { 169, "gettimeofday", gettimeofdayFunc<RiscvLinux32> },
639  { 170, "settimeofday" },
640  { 171, "adjtimex" },
641  { 172, "getpid", getpidFunc },
642  { 173, "getppid", getppidFunc },
643  { 174, "getuid", getuidFunc },
644  { 175, "geteuid", geteuidFunc },
645  { 176, "getgid", getgidFunc },
646  { 177, "getegid", getegidFunc },
647  { 178, "gettid", gettidFunc },
648  { 179, "sysinfo", sysinfoFunc<RiscvLinux32> },
649  { 180, "mq_open" },
650  { 181, "mq_unlink" },
651  { 182, "mq_timedsend" },
652  { 183, "mq_timedrecieve" },
653  { 184, "mq_notify" },
654  { 185, "mq_getsetattr" },
655  { 186, "msgget" },
656  { 187, "msgctl" },
657  { 188, "msgrcv" },
658  { 189, "msgsnd" },
659  { 190, "semget" },
660  { 191, "semctl" },
661  { 192, "semtimedop" },
662  { 193, "semop" },
663  { 194, "shmget" },
664  { 195, "shmctl" },
665  { 196, "shmat" },
666  { 197, "shmdt" },
667  { 198, "socket", socketFunc<RiscvLinux32> },
668  { 199, "socketpair", socketpairFunc<RiscvLinux32> },
669  { 200, "bind", bindFunc },
670  { 201, "listen", listenFunc },
671  { 202, "accept", acceptFunc<RiscvLinux32> },
672  { 203, "connect", connectFunc },
673  { 204, "getsockname", getsocknameFunc },
674  { 205, "getpeername", getpeernameFunc },
675  { 206, "sendto", sendtoFunc<RiscvLinux32> },
676  { 207, "recvfrom", recvfromFunc<RiscvLinux32> },
677  { 208, "setsockopt", setsockoptFunc },
678  { 209, "getsockopt", getsockoptFunc },
679  { 210, "shutdown", shutdownFunc },
680  { 211, "sendmsg", sendmsgFunc },
681  { 212, "recvmsg", recvmsgFunc },
682  { 213, "readahead" },
683  { 214, "brk", brkFunc },
684  { 215, "munmap", munmapFunc<RiscvLinux32> },
685  { 216, "mremap", mremapFunc<RiscvLinux32> },
686  { 217, "add_key" },
687  { 218, "request_key" },
688  { 219, "keyctl" },
689  { 220, "clone", cloneBackwardsFunc<RiscvLinux32> },
690  { 221, "execve", execveFunc<RiscvLinux32> },
691  { 222, "mmap", mmapFunc<RiscvLinux32> },
692  { 223, "fadvise64" },
693  { 224, "swapon" },
694  { 225, "swapoff" },
695  { 226, "mprotect", ignoreFunc },
696  { 227, "msync", ignoreFunc },
697  { 228, "mlock", ignoreFunc },
698  { 229, "munlock", ignoreFunc },
699  { 230, "mlockall", ignoreFunc },
700  { 231, "munlockall", ignoreFunc },
701  { 232, "mincore", ignoreFunc },
702  { 233, "madvise", ignoreFunc },
703  { 234, "remap_file_pages" },
704  { 235, "mbind", ignoreFunc },
705  { 236, "get_mempolicy" },
706  { 237, "set_mempolicy" },
707  { 238, "migrate_pages" },
708  { 239, "move_pages" },
709  { 240, "tgsigqueueinfo" },
710  { 241, "perf_event_open" },
711  { 242, "accept4" },
712  { 243, "recvmmsg" },
713  { 260, "wait4", wait4Func<RiscvLinux32> },
714  { 261, "prlimit64", prlimitFunc<RiscvLinux32> },
715  { 262, "fanotify_init" },
716  { 263, "fanotify_mark" },
717  { 264, "name_to_handle_at" },
718  { 265, "open_by_handle_at" },
719  { 266, "clock_adjtime" },
720  { 267, "syncfs" },
721  { 268, "setns" },
722  { 269, "sendmmsg" },
723  { 270, "process_vm_ready" },
724  { 271, "process_vm_writev" },
725  { 272, "kcmp" },
726  { 273, "finit_module" },
727  { 274, "sched_setattr" },
728  { 275, "sched_getattr" },
729  { 276, "renameat2" },
730  { 277, "seccomp" },
731  { 278, "getrandom", getrandomFunc<RiscvLinux32> },
732  { 279, "memfd_create" },
733  { 280, "bpf" },
734  { 281, "execveat" },
735  { 282, "userfaultid" },
736  { 283, "membarrier" },
737  { 284, "mlock2" },
738  { 285, "copy_file_range" },
739  { 286, "preadv2" },
740  { 287, "pwritev2" },
741  { 1024, "open", openFunc<RiscvLinux32> },
742  { 1025, "link", linkFunc },
743  { 1026, "unlink", unlinkFunc },
744  { 1027, "mknod", mknodFunc },
745  { 1028, "chmod", chmodFunc<RiscvLinux32> },
746  { 1029, "chown", chownFunc },
747  { 1030, "mkdir", mkdirFunc },
748  { 1031, "rmdir", rmdirFunc },
749  { 1032, "lchown" },
750  { 1033, "access", accessFunc },
751  { 1034, "rename", renameFunc },
752  { 1035, "readlink", readlinkFunc<RiscvLinux32> },
753  { 1036, "symlink", symlinkFunc },
754  { 1037, "utimes", utimesFunc<RiscvLinux32> },
755  { 1038, "stat", statFunc<RiscvLinux32> },
756  { 1039, "lstat", lstatFunc<RiscvLinux32> },
757  { 1040, "pipe", pipeFunc },
758  { 1041, "dup2", dup2Func },
759  { 1042, "epoll_create" },
760  { 1043, "inotifiy_init" },
761  { 1044, "eventfd", eventfdFunc<RiscvLinux32> },
762  { 1045, "signalfd" },
763  { 1046, "sendfile" },
764  { 1047, "ftruncate", ftruncateFunc<RiscvLinux32> },
765  { 1048, "truncate", truncateFunc<RiscvLinux32> },
766  { 1049, "stat", statFunc<RiscvLinux32> },
767  { 1050, "lstat", lstatFunc<RiscvLinux32> },
768  { 1051, "fstat", fstatFunc<RiscvLinux32> },
769  { 1052, "fcntl", fcntlFunc },
770  { 1053, "fadvise64" },
771  { 1054, "newfstatat", newfstatatFunc<RiscvLinux32> },
772  { 1055, "fstatfs", fstatfsFunc<RiscvLinux32> },
773  { 1056, "statfs", statfsFunc<RiscvLinux32> },
774  { 1057, "lseek", lseekFunc },
775  { 1058, "mmap", mmapFunc<RiscvLinux32> },
776  { 1059, "alarm" },
777  { 1060, "getpgrp", getpgrpFunc },
778  { 1061, "pause" },
779  { 1062, "time", timeFunc<RiscvLinux32> },
780  { 1063, "utime" },
781  { 1064, "creat" },
782 #if defined(SYS_getdents)
783  { 1065, "getdents", getdentsFunc },
784 #else
785  { 1065, "getdents" },
786 #endif
787  { 1066, "futimesat" },
788  { 1067, "select", selectFunc<RiscvLinux32> },
789  { 1068, "poll", pollFunc<RiscvLinux32> },
790  { 1069, "epoll_wait" },
791  { 1070, "ustat" },
792  { 1071, "vfork" },
793  { 1072, "oldwait4" },
794  { 1073, "recv" },
795  { 1074, "send" },
796  { 1075, "bdflush" },
797  { 1076, "umount" },
798  { 1077, "uselib" },
799  { 1078, "sysctl" },
800  { 1079, "fork" },
801  { 2011, "getmainvars" }
802 };
803 
804 } // namespace RiscvISA
805 } // namespace gem5
gem5::dupFunc
SyscallReturn dupFunc(SyscallDesc *desc, ThreadContext *tc, int tgt_fd)
FIXME: The file description is not shared among file descriptors created with dup.
Definition: syscall_emul.cc:599
gem5::chdirFunc
SyscallReturn chdirFunc(SyscallDesc *desc, ThreadContext *tc, VPtr<> pathname)
Target chdir() handler.
Definition: syscall_emul.cc:950
gem5::RiscvISA::EmuLinux::syscall
void syscall(ThreadContext *tc) override
Definition: se_workload.cc:82
warn
#define warn(...)
Definition: logging.hh:256
gem5::RiscvISA::unameFunc32
static SyscallReturn unameFunc32(SyscallDesc *desc, ThreadContext *tc, VPtr< Linux::utsname > name)
Target uname() handler.
Definition: se_workload.cc:113
gem5::listenFunc
SyscallReturn listenFunc(SyscallDesc *desc, ThreadContext *tc, int tgt_fd, int backlog)
Definition: syscall_emul.cc:1112
gem5::RegVal
uint64_t RegVal
Definition: types.hh:173
gem5::getuidFunc
SyscallReturn getuidFunc(SyscallDesc *desc, ThreadContext *tc)
Definition: syscall_emul.cc:877
gem5::getsockoptFunc
SyscallReturn getsockoptFunc(SyscallDesc *desc, ThreadContext *tc, int tgt_fd, int level, int optname, VPtr<> valPtr, VPtr<> lenPtr)
Definition: syscall_emul.cc:1358
gem5::SyscallReturn
This class represents the return value from an emulated system call, including any errno setting.
Definition: syscall_return.hh:55
gem5::getpgrpFunc
SyscallReturn getpgrpFunc(SyscallDesc *desc, ThreadContext *tc)
Target getpgrpFunc() handler.
Definition: syscall_emul.cc:815
gem5::ThreadContext::getReg
virtual RegVal getReg(const RegId &reg) const
Definition: thread_context.cc:180
gem5::bindFunc
SyscallReturn bindFunc(SyscallDesc *desc, ThreadContext *tc, int tgt_fd, VPtr<> buf_ptr, int addrlen)
Definition: syscall_emul.cc:1091
gem5::RiscvProcess64
Definition: process.hh:61
gem5::RiscvISA::unameFunc64
static SyscallReturn unameFunc64(SyscallDesc *desc, ThreadContext *tc, VPtr< Linux::utsname > name)
Target uname() handler.
Definition: se_workload.cc:98
se_workload.hh
gem5::mkdirFunc
SyscallReturn mkdirFunc(SyscallDesc *desc, ThreadContext *tc, VPtr<> pathname, mode_t mode)
Target mkdir() handler.
Definition: syscall_emul.cc:444
gem5::getcwdFunc
SyscallReturn getcwdFunc(SyscallDesc *desc, ThreadContext *tc, VPtr<> buf_ptr, unsigned long size)
Target getcwd() handler.
Definition: syscall_emul.cc:352
gem5::RiscvISA::SyscallNumReg
constexpr auto & SyscallNumReg
Definition: int.hh:145
gem5::brkFunc
SyscallReturn brkFunc(SyscallDesc *desc, ThreadContext *tc, VPtr<> new_brk)
Target brk() handler: set brk address.
Definition: syscall_emul.cc:258
gem5::ignoreWarnOnceFunc
SyscallReturn ignoreWarnOnceFunc(SyscallDesc *desc, ThreadContext *tc)
Like above, but only prints a warning once per syscall desc it's used with.
Definition: syscall_emul.cc:79
gem5::RiscvISA::EmuLinux::syscallDescs32
static SyscallDescTable< SEWorkload::SyscallABI32 > syscallDescs32
32 bit syscall descriptors, indexed by call number.
Definition: se_workload.hh:53
gem5::closeFunc
SyscallReturn closeFunc(SyscallDesc *desc, ThreadContext *tc, int tgt_fd)
Target close() handler.
Definition: syscall_emul.cc:289
gem5::getcpuFunc
SyscallReturn getcpuFunc(SyscallDesc *desc, ThreadContext *tc, VPtr< uint32_t > cpu, VPtr< uint32_t > node, VPtr< uint32_t > tcache)
Definition: syscall_emul.cc:1489
gem5::umaskFunc
SyscallReturn umaskFunc(SyscallDesc *desc, ThreadContext *tc)
Target umask() handler.
Definition: syscall_emul.cc:535
gem5::loader::UnknownOpSys
@ UnknownOpSys
Definition: object_file.hh:82
gem5::setpgidFunc
SyscallReturn setpgidFunc(SyscallDesc *desc, ThreadContext *tc, int pid, int pgid)
Target setpgid() handler.
Definition: syscall_emul.cc:822
gem5::exitGroupFunc
SyscallReturn exitGroupFunc(SyscallDesc *desc, ThreadContext *tc, int status)
Target exit_group() handler: terminate simulation. (exit all threads)
Definition: syscall_emul.cc:245
gem5::getsocknameFunc
SyscallReturn getsocknameFunc(SyscallDesc *desc, ThreadContext *tc, int tgt_fd, VPtr<> addrPtr, VPtr<> lenPtr)
Definition: syscall_emul.cc:1400
gem5::symlinkFunc
SyscallReturn symlinkFunc(SyscallDesc *desc, ThreadContext *tc, VPtr<> pathname, VPtr<> new_pathname)
Target symlink() handler.
Definition: syscall_emul.cc:423
gem5::ThreadContext
ThreadContext is the external interface to all thread state for anything outside of the CPU.
Definition: thread_context.hh:88
gem5::unlinkFunc
SyscallReturn unlinkFunc(SyscallDesc *desc, ThreadContext *tc, VPtr<> pathname)
Target unlink() handler.
Definition: syscall_emul.cc:382
gem5::getgidFunc
SyscallReturn getgidFunc(SyscallDesc *desc, ThreadContext *tc)
Target getgid() handler.
Definition: syscall_emul.cc:891
gem5::getegidFunc
SyscallReturn getegidFunc(SyscallDesc *desc, ThreadContext *tc)
Target getegid() handler.
Definition: syscall_emul.cc:898
gem5::pipeFunc
SyscallReturn pipeFunc(SyscallDesc *desc, ThreadContext *tc, VPtr<> tgt_addr)
Target pipe() handler.
Definition: syscall_emul.cc:724
gem5::ProxyPtr
Definition: proxy_ptr.hh:238
gem5::truncate64Func
SyscallReturn truncate64Func(SyscallDesc *desc, ThreadContext *tc, VPtr<> pathname, int64_t length)
Target truncate64() handler.
Definition: syscall_emul.cc:495
gem5::gettidFunc
SyscallReturn gettidFunc(SyscallDesc *desc, ThreadContext *tc)
Target gettid() handler.
Definition: syscall_emul.cc:863
gem5::loader::Riscv32
@ Riscv32
Definition: object_file.hh:75
gem5::SyscallDescTable
Definition: syscall_desc.hh:189
gem5::setTidAddressFunc
SyscallReturn setTidAddressFunc(SyscallDesc *desc, ThreadContext *tc, uint64_t tidPtr)
Target set_tid_address() handler.
Definition: syscall_emul.cc:280
gem5::fcntlFunc
SyscallReturn fcntlFunc(SyscallDesc *desc, ThreadContext *tc, int tgt_fd, int cmd, guest_abi::VarArgs< int > varargs)
Target fcntl() handler.
Definition: syscall_emul.cc:647
process.hh
gem5::connectFunc
SyscallReturn connectFunc(SyscallDesc *desc, ThreadContext *tc, int tgt_fd, VPtr<> buf_ptr, int addrlen)
Definition: syscall_emul.cc:1127
gem5::linkFunc
SyscallReturn linkFunc(SyscallDesc *desc, ThreadContext *tc, VPtr<> pathname, VPtr<> new_pathname)
Target link() handler.
Definition: syscall_emul.cc:402
gem5::pipe2Func
SyscallReturn pipe2Func(SyscallDesc *desc, ThreadContext *tc, VPtr<> tgt_addr, int flags)
Target pipe() handler.
Definition: syscall_emul.cc:730
name
const std::string & name()
Definition: trace.cc:48
gem5::accessFunc
SyscallReturn accessFunc(SyscallDesc *desc, ThreadContext *tc, VPtr<> pathname, mode_t mode)
Target access() handler.
Definition: syscall_emul.cc:905
gem5::sendmsgFunc
SyscallReturn sendmsgFunc(SyscallDesc *desc, ThreadContext *tc, int tgt_fd, VPtr<> msgPtr, int flags)
Definition: syscall_emul.cc:1289
gem5::fcntl64Func
SyscallReturn fcntl64Func(SyscallDesc *desc, ThreadContext *tc, int tgt_fd, int cmd)
Target fcntl64() handler.
Definition: syscall_emul.cc:689
gem5::recvmsgFunc
SyscallReturn recvmsgFunc(SyscallDesc *desc, ThreadContext *tc, int tgt_fd, VPtr<> msgPtr, int flags)
Definition: syscall_emul.cc:1149
gem5::Process
Definition: process.hh:67
gem5::ThreadContext::getProcessPtr
virtual Process * getProcessPtr()=0
gem5::exitFunc
SyscallReturn exitFunc(SyscallDesc *desc, ThreadContext *tc, int status)
Target exit() handler: terminate current context.
Definition: syscall_emul.cc:239
syscall_emul.hh
gem5::shutdownFunc
SyscallReturn shutdownFunc(SyscallDesc *desc, ThreadContext *tc, int tgt_fd, int how)
Target shutdown() handler.
Definition: syscall_emul.cc:1076
gem5::rmdirFunc
SyscallReturn rmdirFunc(SyscallDesc *desc, ThreadContext *tc, VPtr<> pathname)
Definition: syscall_emul.cc:977
gem5::getppidFunc
SyscallReturn getppidFunc(SyscallDesc *desc, ThreadContext *tc)
Target getppid() handler.
Definition: syscall_emul.cc:870
gem5::RiscvISA::EmuLinux::syscallDescs64
static SyscallDescTable< SEWorkload::SyscallABI64 > syscallDescs64
64 bit syscall descriptors, indexed by call number.
Definition: se_workload.hh:50
gem5::renameFunc
SyscallReturn renameFunc(SyscallDesc *desc, ThreadContext *tc, VPtr<> oldpath, VPtr<> newpath)
Target rename() handler.
Definition: syscall_emul.cc:464
gem5::setsockoptFunc
SyscallReturn setsockoptFunc(SyscallDesc *desc, ThreadContext *tc, int tgt_fd, int level, int optname, VPtr<> valPtr, socklen_t len)
Definition: syscall_emul.cc:1468
trace.hh
gem5::SyscallDesc
This class provides the wrapper interface for the system call implementations which are defined in th...
Definition: syscall_desc.hh:69
gem5::fchownFunc
SyscallReturn fchownFunc(SyscallDesc *desc, ThreadContext *tc, int tgt_fd, uint32_t owner, uint32_t group)
Target fchown() handler.
Definition: syscall_emul.cc:574
gem5::ignoreFunc
SyscallReturn ignoreFunc(SyscallDesc *desc, ThreadContext *tc)
Handler for unimplemented syscalls that we never intend to implement (signal handling,...
Definition: syscall_emul.cc:72
gem5::getpidFunc
SyscallReturn getpidFunc(SyscallDesc *desc, ThreadContext *tc)
Target getpid() handler.
Definition: syscall_emul.cc:856
gem5
Reference material can be found at the JEDEC website: UFS standard http://www.jedec....
Definition: gpu_translation_state.hh:37
gem5::dup2Func
SyscallReturn dup2Func(SyscallDesc *desc, ThreadContext *tc, int old_tgt_fd, int new_tgt_fd)
Target dup2() handler.
Definition: syscall_emul.cc:619
gem5::mknodFunc
SyscallReturn mknodFunc(SyscallDesc *desc, ThreadContext *tc, VPtr<> pathname, mode_t mode, dev_t dev)
Target mknod() handler.
Definition: syscall_emul.cc:928
object_file.hh
thread_context.hh
gem5::loader::Riscv64
@ Riscv64
Definition: object_file.hh:74
gem5::loader::Linux
@ Linux
Definition: object_file.hh:84
gem5::geteuidFunc
SyscallReturn geteuidFunc(SyscallDesc *desc, ThreadContext *tc)
Target geteuid() handler.
Definition: syscall_emul.cc:884
gem5::chownFunc
SyscallReturn chownFunc(SyscallDesc *desc, ThreadContext *tc, VPtr<> pathname, uint32_t owner, uint32_t group)
Target chown() handler.
Definition: syscall_emul.cc:546
gem5::ftruncate64Func
SyscallReturn ftruncate64Func(SyscallDesc *desc, ThreadContext *tc, int tgt_fd, int64_t length)
Target ftruncate64() handler.
Definition: syscall_emul.cc:516
gem5::lseekFunc
SyscallReturn lseekFunc(SyscallDesc *desc, ThreadContext *tc, int tgt_fd, uint64_t offs, int whence)
Target lseek() handler.
Definition: syscall_emul.cc:296
gem5::getpeernameFunc
SyscallReturn getpeernameFunc(SyscallDesc *desc, ThreadContext *tc, int tgt_fd, VPtr<> sockAddrPtr, VPtr<> addrlenPtr)
Definition: syscall_emul.cc:1439

Generated on Sun Jul 30 2023 01:56:48 for gem5 by doxygen 1.8.17