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

Generated on Wed Sep 30 2020 14:01:59 for gem5 by doxygen 1.8.17