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

Generated on Tue Sep 21 2021 12:24:34 for gem5 by doxygen 1.8.17