33 #include <sys/syscall.h>
47 class LinuxLoader :
public Process::Loader
51 load(
const ProcessParams ¶ms, loader::ObjectFile *obj)
override
53 auto arch = obj->getArch();
54 auto opsys = obj->getOpSys();
60 warn(
"Unknown operating system; assuming Linux.");
68 return new RiscvProcess64(params, obj);
70 return new RiscvProcess32(params, obj);
74 LinuxLoader linuxLoader;
87 process->Process::syscall(tc);
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");
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");
131 { 4,
"io_getevents" },
139 { 12,
"llistxattr" },
140 { 13,
"flistxattr" },
141 { 14,
"removexattr" },
142 { 15,
"lremovexattr" },
143 { 16,
"fremovexattr" },
145 { 18,
"lookup_dcookie" },
147 { 20,
"epoll_create1" },
149 { 22,
"epoll_pwait" },
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" },
162 { 35,
"unlinkat", unlinkatFunc<RiscvLinux64> },
165 { 38,
"renameat", renameatFunc<RiscvLinux64> },
168 { 41,
"pivot_root" },
169 { 42,
"nfsservctl" },
170 { 43,
"statfs", statfsFunc<RiscvLinux64> },
171 { 44,
"fstatfs", fstatfsFunc<RiscvLinux64> },
172 { 45,
"truncate", truncateFunc<RiscvLinux64> },
174 { 47,
"fallocate", fallocateFunc<RiscvLinux64> },
175 { 48,
"faccessat", faccessatFunc<RiscvLinux64> },
179 { 52,
"fchmod", fchmodFunc<RiscvLinux64> },
183 { 56,
"openat", openatFunc<RiscvLinux64> },
188 { 61,
"getdents64" },
190 { 63,
"read", readFunc<RiscvLinux64> },
191 { 64,
"write", writeFunc<RiscvLinux64> },
192 { 66,
"writev", writevFunc<RiscvLinux64> },
194 { 68,
"pwrite64", pwrite64Func<RiscvLinux64> },
200 { 74,
"signalfd64" },
204 { 78,
"readlinkat", readlinkatFunc<RiscvLinux64> },
205 { 79,
"fstatat", fstatat64Func<RiscvLinux64> },
206 { 80,
"fstat", fstat64Func<RiscvLinux64> },
210 { 84,
"sync_file_range2" },
211 { 85,
"timerfd_create" },
212 { 86,
"timerfd_settime" },
213 { 87,
"timerfd_gettime" },
218 { 92,
"personality" },
224 { 98,
"futex", futexFunc<RiscvLinux64> },
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" },
244 { 118,
"sched_setparam" },
245 { 119,
"sched_setscheduler" },
246 { 120,
"sched_getscheduler" },
247 { 121,
"sched_getparam" },
248 { 122,
"sched_setaffinity" },
249 { 123,
"sched_getaffinity" },
251 { 125,
"sched_get_priority_max" },
252 { 126,
"sched_get_priority_min" },
253 { 127,
"scheD_rr_get_interval" },
254 { 128,
"restart_syscall" },
257 { 131,
"tgkill", tgkillFunc<RiscvLinux64> },
258 { 132,
"sigaltstack" },
266 { 140,
"setpriority" },
267 { 141,
"getpriority" },
273 { 147,
"setresuid" },
274 { 148,
"getresuid" },
275 { 149,
"getresgid" },
276 { 150,
"getresgid" },
279 { 153,
"times", timesFunc<RiscvLinux64> },
284 { 158,
"getgroups" },
285 { 159,
"setgroups" },
287 { 161,
"sethostname" },
288 { 162,
"setdomainname" },
289 { 163,
"getrlimit", getrlimitFunc<RiscvLinux64> },
291 { 165,
"getrusage", getrusageFunc<RiscvLinux64> },
295 { 169,
"gettimeofday", gettimeofdayFunc<RiscvLinux64> },
296 { 170,
"settimeofday" },
305 { 179,
"sysinfo", sysinfoFunc<RiscvLinux64> },
307 { 181,
"mq_unlink" },
308 { 182,
"mq_timedsend" },
309 { 183,
"mq_timedrecieve" },
310 { 184,
"mq_notify" },
311 { 185,
"mq_getsetattr" },
318 { 192,
"semtimedop" },
325 { 199,
"socketpair" },
330 { 204,
"getsockname" },
331 { 205,
"getpeername" },
334 { 208,
"setsockopt" },
335 { 209,
"getsockopt" },
339 { 213,
"readahead" },
341 { 215,
"munmap", munmapFunc<RiscvLinux64> },
342 { 216,
"mremap", mremapFunc<RiscvLinux64> },
344 { 218,
"request_key" },
346 { 220,
"clone", cloneBackwardsFunc<RiscvLinux64> },
347 { 221,
"execve", execveFunc<RiscvLinux64> },
348 { 222,
"mmap", mmapFunc<RiscvLinux64> },
349 { 223,
"fadvise64" },
360 { 234,
"remap_file_pages" },
362 { 236,
"get_mempolicy" },
363 { 237,
"set_mempolicy" },
364 { 238,
"migrate_pages" },
365 { 239,
"move_pages" },
366 { 240,
"tgsigqueueinfo" },
367 { 241,
"perf_event_open" },
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" },
380 { 270,
"process_vm_ready" },
381 { 271,
"process_vm_writev" },
383 { 273,
"finit_module" },
384 { 274,
"sched_setattr" },
385 { 275,
"sched_getattr" },
386 { 276,
"renameat2" },
388 { 278,
"getrandom" },
389 { 279,
"memfd_create" },
392 { 282,
"userfaultid" },
393 { 283,
"membarrier" },
395 { 285,
"copy_file_range" },
398 { 1024,
"open", openFunc<RiscvLinux64> },
402 { 1028,
"chmod", chmodFunc<RiscvLinux64> },
409 { 1035,
"readlink", readlinkFunc<RiscvLinux64> },
411 { 1037,
"utimes", utimesFunc<RiscvLinux64> },
412 { 1038,
"stat", stat64Func<RiscvLinux64> },
413 { 1039,
"lstat", lstat64Func<RiscvLinux64> },
416 { 1042,
"epoll_create" },
417 { 1043,
"inotifiy_init" },
419 { 1045,
"signalfd" },
420 { 1046,
"sendfile" },
423 { 1049,
"stat", stat64Func<RiscvLinux64> },
424 { 1050,
"lstat", lstat64Func<RiscvLinux64> },
425 { 1051,
"fstat", fstat64Func<RiscvLinux64> },
427 { 1053,
"fadvise64" },
428 { 1054,
"newfstatat" },
429 { 1055,
"fstatfs", fstatfsFunc<RiscvLinux64> },
430 { 1056,
"statfs", statfsFunc<RiscvLinux64> },
432 { 1058,
"mmap", mmapFunc<RiscvLinux64> },
436 { 1062,
"time", timeFunc<RiscvLinux64> },
439 { 1065,
"getdents" },
440 { 1066,
"futimesat" },
443 { 1069,
"epoll_wait" },
446 { 1072,
"oldwait4" },
454 { 2011,
"getmainvars" }
462 { 4,
"io_getevents" },
470 { 12,
"llistxattr" },
471 { 13,
"flistxattr" },
472 { 14,
"removexattr" },
473 { 15,
"lremovexattr" },
474 { 16,
"fremovexattr" },
476 { 18,
"lookup_dcookie" },
478 { 20,
"epoll_create1" },
480 { 22,
"epoll_pwait" },
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" },
493 { 35,
"unlinkat", unlinkatFunc<RiscvLinux32> },
496 { 38,
"renameat", renameatFunc<RiscvLinux32> },
499 { 41,
"pivot_root" },
500 { 42,
"nfsservctl" },
501 { 43,
"statfs", statfsFunc<RiscvLinux32> },
502 { 44,
"fstatfs", fstatfsFunc<RiscvLinux32> },
503 { 45,
"truncate", truncateFunc<RiscvLinux32> },
504 { 46,
"ftruncate", ftruncateFunc<RiscvLinux32> },
505 { 47,
"fallocate", fallocateFunc<RiscvLinux32> },
506 { 48,
"faccessat", faccessatFunc<RiscvLinux32> },
510 { 52,
"fchmod", fchmodFunc<RiscvLinux32> },
514 { 56,
"openat", openatFunc<RiscvLinux32> },
519 { 61,
"getdents64" },
521 { 63,
"read", readFunc<RiscvLinux32> },
522 { 64,
"write", writeFunc<RiscvLinux32> },
523 { 66,
"writev", writevFunc<RiscvLinux32> },
525 { 68,
"pwrite64", pwrite64Func<RiscvLinux32> },
531 { 74,
"signalfd64" },
535 { 78,
"readlinkat", readlinkatFunc<RiscvLinux32> },
537 { 80,
"fstat", fstatFunc<RiscvLinux32> },
541 { 84,
"sync_file_range2" },
542 { 85,
"timerfd_create" },
543 { 86,
"timerfd_settime" },
544 { 87,
"timerfd_gettime" },
549 { 92,
"personality" },
555 { 98,
"futex", futexFunc<RiscvLinux32> },
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" },
575 { 118,
"sched_setparam" },
576 { 119,
"sched_setscheduler" },
577 { 120,
"sched_getscheduler" },
578 { 121,
"sched_getparam" },
579 { 122,
"sched_setaffinity" },
580 { 123,
"sched_getaffinity" },
582 { 125,
"sched_get_priority_max" },
583 { 126,
"sched_get_priority_min" },
584 { 127,
"scheD_rr_get_interval" },
585 { 128,
"restart_syscall" },
588 { 131,
"tgkill", tgkillFunc<RiscvLinux32> },
589 { 132,
"sigaltstack" },
597 { 140,
"setpriority" },
598 { 141,
"getpriority" },
604 { 147,
"setresuid" },
605 { 148,
"getresuid" },
606 { 149,
"getresgid" },
607 { 150,
"getresgid" },
610 { 153,
"times", timesFunc<RiscvLinux32> },
615 { 158,
"getgroups" },
616 { 159,
"setgroups" },
618 { 161,
"sethostname" },
619 { 162,
"setdomainname" },
620 { 163,
"getrlimit", getrlimitFunc<RiscvLinux32> },
622 { 165,
"getrusage", getrusageFunc<RiscvLinux32> },
626 { 169,
"gettimeofday", gettimeofdayFunc<RiscvLinux32> },
627 { 170,
"settimeofday" },
636 { 179,
"sysinfo", sysinfoFunc<RiscvLinux32> },
638 { 181,
"mq_unlink" },
639 { 182,
"mq_timedsend" },
640 { 183,
"mq_timedrecieve" },
641 { 184,
"mq_notify" },
642 { 185,
"mq_getsetattr" },
649 { 192,
"semtimedop" },
656 { 199,
"socketpair" },
661 { 204,
"getsockname" },
662 { 205,
"getpeername" },
665 { 208,
"setsockopt" },
666 { 209,
"getsockopt" },
670 { 213,
"readahead" },
672 { 215,
"munmap", munmapFunc<RiscvLinux32> },
673 { 216,
"mremap", mremapFunc<RiscvLinux32> },
675 { 218,
"request_key" },
677 { 220,
"clone", cloneBackwardsFunc<RiscvLinux32> },
678 { 221,
"execve", execveFunc<RiscvLinux32> },
679 { 222,
"mmap", mmapFunc<RiscvLinux32> },
680 { 223,
"fadvise64" },
691 { 234,
"remap_file_pages" },
693 { 236,
"get_mempolicy" },
694 { 237,
"set_mempolicy" },
695 { 238,
"migrate_pages" },
696 { 239,
"move_pages" },
697 { 240,
"tgsigqueueinfo" },
698 { 241,
"perf_event_open" },
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" },
711 { 270,
"process_vm_ready" },
712 { 271,
"process_vm_writev" },
714 { 273,
"finit_module" },
715 { 274,
"sched_setattr" },
716 { 275,
"sched_getattr" },
717 { 276,
"renameat2" },
719 { 278,
"getrandom" },
720 { 279,
"memfd_create" },
723 { 282,
"userfaultid" },
724 { 283,
"membarrier" },
726 { 285,
"copy_file_range" },
729 { 1024,
"open", openFunc<RiscvLinux32> },
733 { 1028,
"chmod", chmodFunc<RiscvLinux32> },
740 { 1035,
"readlink", readlinkFunc<RiscvLinux32> },
742 { 1037,
"utimes", utimesFunc<RiscvLinux32> },
743 { 1038,
"stat", statFunc<RiscvLinux32> },
744 { 1039,
"lstat", lstatFunc<RiscvLinux32> },
747 { 1042,
"epoll_create" },
748 { 1043,
"inotifiy_init" },
750 { 1045,
"signalfd" },
751 { 1046,
"sendfile" },
752 { 1047,
"ftruncate", ftruncateFunc<RiscvLinux32> },
753 { 1048,
"truncate", truncateFunc<RiscvLinux32> },
754 { 1049,
"stat", statFunc<RiscvLinux32> },
755 { 1050,
"lstat", lstatFunc<RiscvLinux32> },
756 { 1051,
"fstat", fstatFunc<RiscvLinux32> },
758 { 1053,
"fadvise64" },
759 { 1054,
"newfstatat" },
760 { 1055,
"fstatfs", fstatfsFunc<RiscvLinux32> },
761 { 1056,
"statfs", statfsFunc<RiscvLinux32> },
763 { 1058,
"mmap", mmapFunc<RiscvLinux32> },
767 { 1062,
"time", timeFunc<RiscvLinux32> },
770 { 1065,
"getdents" },
771 { 1066,
"futimesat" },
774 { 1069,
"epoll_wait" },
777 { 1072,
"oldwait4" },
785 { 2011,
"getmainvars" }