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

Generated on Tue Jun 22 2021 15:28:20 for gem5 by doxygen 1.8.17