43#include <sys/syscall.h>
58class LinuxLoader :
public Process::Loader
62 load(
const ProcessParams ¶ms, loader::ObjectFile *obj)
override
64 auto arch = obj->getArch();
65 auto opsys = obj->getOpSys();
73 warn(
"Unknown operating system; assuming Linux.");
78 fatal(
"gem5 does not support ARM OABI binaries. Please recompile "
79 "with an EABI compiler.");
86 return new ArmLinuxProcess64(params, obj, arch);
88 return new ArmLinuxProcess32(params, obj, arch);
92LinuxLoader linuxLoader;
105 strcpy(
name->sysname,
"Linux");
106 strcpy(
name->nodename,
"m5.eecs.umich.edu");
107 strcpy(
name->release, process->release.c_str());
108 strcpy(
name->version,
"#1 SMP Sat Dec 1 00:00:00 GMT 2012");
109 strcpy(
name->machine,
"armv7l");
120 strcpy(
name->sysname,
"Linux");
121 strcpy(
name->nodename,
"gem5");
122 strcpy(
name->release, process->release.c_str());
123 strcpy(
name->version,
"#1 SMP Sat Dec 1 00:00:00 GMT 2012");
124 strcpy(
name->machine,
"armv8l");
150 {
base + 0,
"syscall" },
152 {
base + 2,
"fork" },
153 {
base + 3,
"read", readFunc<ArmLinux32> },
154 {
base + 4,
"write", writeFunc<ArmLinux32> },
155 {
base + 5,
"open", openFunc<ArmLinux32> },
157 {
base + 8,
"creat" },
158 {
base + 9,
"link" },
160 {
base + 11,
"execve", execveFunc<ArmLinux32> },
162 {
base + 13,
"time", timeFunc<ArmLinux32> },
164 {
base + 15,
"chmod", chmodFunc<ArmLinux32> },
166 {
base + 19,
"lseek", lseekFunc<ArmLinux32> },
168 {
base + 21,
"mount" },
169 {
base + 22,
"umount" },
172 {
base + 25,
"stime" },
173 {
base + 26,
"ptrace" },
174 {
base + 27,
"alarm" },
175 {
base + 29,
"pause" },
176 {
base + 30,
"utime" },
178 {
base + 34,
"nice" },
179 {
base + 36,
"sync" },
183 {
base + 40,
"rmdir" },
186 {
base + 43,
"times", timesFunc<ArmLinux32> },
192 {
base + 51,
"acct" },
193 {
base + 52,
"umount2" },
194 {
base + 54,
"ioctl", ioctlFunc<ArmLinux32> },
196 {
base + 57,
"setpgid" },
198 {
base + 61,
"chroot" },
199 {
base + 62,
"ustat" },
200 {
base + 63,
"dup2" },
202 {
base + 65,
"getpgrp" },
203 {
base + 66,
"setsid" },
204 {
base + 67,
"sigaction" },
205 {
base + 70,
"setreuid" },
206 {
base + 71,
"setregid" },
207 {
base + 72,
"sigsuspend" },
208 {
base + 73,
"sigpending" },
211 {
base + 76,
"getrlimit", getrlimitFunc<ArmLinux32> },
212 {
base + 77,
"getrusage", getrusageFunc<ArmLinux32> },
213 {
base + 78,
"gettimeofday", gettimeofdayFunc<ArmLinux32> },
214 {
base + 79,
"settimeofday" },
215 {
base + 80,
"getgroups" },
216 {
base + 81,
"setgroups" },
217 {
base + 82,
"reserved#82" },
218 {
base + 83,
"symlink" },
219 {
base + 85,
"readlink", readlinkFunc<ArmLinux32> },
220 {
base + 86,
"uselib" },
221 {
base + 87,
"swapon" },
222 {
base + 88,
"reboot" },
223 {
base + 89,
"readdir" },
224 {
base + 90,
"mmap", mmapFunc<ArmLinux32> },
225 {
base + 91,
"munmap", munmapFunc<ArmLinux32> },
226 {
base + 92,
"truncate", truncateFunc<ArmLinux32> },
227 {
base + 93,
"ftruncate", ftruncateFunc<ArmLinux32> },
228 {
base + 94,
"fchmod" },
230 {
base + 96,
"getpriority" },
231 {
base + 97,
"setpriority" },
232 {
base + 99,
"statfs" },
233 {
base + 100,
"fstatfs" },
234 {
base + 102,
"socketcall" },
235 {
base + 103,
"syslog" },
236 {
base + 104,
"setitimer" },
237 {
base + 105,
"getitimer" },
238 {
base + 106,
"stat", statFunc<ArmLinux32> },
239 {
base + 107,
"lstat" },
240 {
base + 108,
"fstat", fstatFunc<ArmLinux32> },
241 {
base + 111,
"vhangup" },
242 {
base + 113,
"syscall" },
243 {
base + 114,
"wait4" },
244 {
base + 115,
"swapoff" },
245 {
base + 116,
"sysinfo", sysinfoFunc<ArmLinux32> },
246 {
base + 117,
"ipc" },
247 {
base + 118,
"fsync" },
248 {
base + 119,
"sigreturn" },
249 {
base + 120,
"clone", cloneBackwardsFunc<ArmLinux32> },
250 {
base + 121,
"setdomainname" },
252 {
base + 124,
"adjtimex" },
255 {
base + 128,
"init_module" },
256 {
base + 129,
"delete_module" },
257 {
base + 131,
"quotactl" },
258 {
base + 132,
"getpgid" },
259 {
base + 133,
"fchdir" },
260 {
base + 134,
"bdflush" },
261 {
base + 135,
"sysfs" },
262 {
base + 136,
"personality" },
263 {
base + 137,
"reserved#138" },
264 {
base + 138,
"setfsuid" },
265 {
base + 139,
"setfsgid" },
267#if defined(SYS_getdents)
268 {
base + 141,
"getdents", getdentsFunc },
270 {
base + 141,
"getdents" },
272 {
base + 142,
"newselect" },
273 {
base + 143,
"flock" },
274 {
base + 144,
"msync" },
275 {
base + 145,
"readv", readvFunc<ArmLinux32> },
276 {
base + 146,
"writev", writevFunc<ArmLinux32> },
277 {
base + 147,
"getsid" },
278 {
base + 148,
"fdatasync" },
279 {
base + 149,
"sysctl" },
280 {
base + 150,
"mlock" },
281 {
base + 151,
"munlock" },
282 {
base + 152,
"mlockall" },
283 {
base + 153,
"munlockall" },
293 {
base + 163,
"mremap", mremapFunc<ArmLinux32> },
294 {
base + 164,
"setresuid" },
295 {
base + 165,
"getresuid" },
296 {
base + 168,
"poll", pollFunc<ArmLinux32> },
297 {
base + 169,
"nfsservctl" },
298 {
base + 170,
"setresgid" },
299 {
base + 171,
"getresgid" },
300 {
base + 172,
"prctl" },
301 {
base + 173,
"rt_sigreturn" },
304 {
base + 176,
"rt_sigpending" },
305 {
base + 177,
"rt_sigtimedwait" },
307 {
base + 179,
"rt_sigsuspend" },
308 {
base + 180,
"pread64", pread64Func<ArmLinux32> },
309 {
base + 181,
"pwrite64", pwrite64Func<ArmLinux32> },
310 {
base + 182,
"chown" },
311 {
base + 183,
"getcwd", getcwdFunc<ArmLinux32> },
312 {
base + 184,
"capget" },
313 {
base + 185,
"capset" },
314 {
base + 186,
"sigaltstack" },
315 {
base + 187,
"sendfile" },
316 {
base + 190,
"vfork" },
317 {
base + 191,
"getrlimit", getrlimitFunc<ArmLinux32> },
318 {
base + 192,
"mmap2", mmapFunc<ArmLinux32> },
321 {
base + 195,
"stat64", stat64Func<ArmLinux32> },
322 {
base + 196,
"lstat64", lstat64Func<ArmLinux32> },
323 {
base + 197,
"fstat64", fstat64Func<ArmLinux32> },
324 {
base + 198,
"lchown" },
329 {
base + 203,
"setreuid" },
330 {
base + 204,
"setregid" },
331 {
base + 205,
"getgroups" },
332 {
base + 206,
"setgroups" },
334 {
base + 208,
"setresuid" },
335 {
base + 209,
"getresuid" },
336 {
base + 210,
"setresgid" },
337 {
base + 211,
"getresgid" },
338 {
base + 212,
"chown" },
341 {
base + 215,
"setfsuid" },
342 {
base + 216,
"setfsgid" },
343#if defined(SYS_getdents64)
344 {
base + 217,
"getdents64", getdents64Func },
346 {
base + 217,
"getdents64" },
348 {
base + 218,
"pivot_root" },
349 {
base + 219,
"mincore" },
353 {
base + 225,
"readahead" },
354 {
base + 226,
"setxattr" },
355 {
base + 227,
"lsetxattr" },
356 {
base + 228,
"fsetxattr" },
357 {
base + 229,
"getxattr" },
358 {
base + 230,
"lgetxattr" },
359 {
base + 231,
"fgetxattr" },
360 {
base + 232,
"listxattr" },
361 {
base + 233,
"llistxattr" },
362 {
base + 234,
"flistxattr" },
363 {
base + 235,
"removexattr" },
364 {
base + 236,
"lremovexattr" },
365 {
base + 237,
"fremovexattr" },
366 {
base + 238,
"tkill" },
367 {
base + 239,
"sendfile64" },
368 {
base + 240,
"futex", futexFunc<ArmLinux32> },
371 {
base + 243,
"io_setup" },
372 {
base + 244,
"io_destroy" },
373 {
base + 245,
"io_getevents" },
374 {
base + 246,
"io_submit" },
375 {
base + 247,
"io_cancel" },
377 {
base + 249,
"lookup_dcookie" },
378 {
base + 250,
"epoll_create" },
379 {
base + 251,
"epoll_ctl" },
380 {
base + 252,
"epoll_wait" },
381 {
base + 253,
"remap_file_pages" },
383 {
base + 257,
"timer_create" },
384 {
base + 258,
"timer_settime" },
385 {
base + 259,
"timer_gettime" },
386 {
base + 260,
"timer_getoverrun" },
387 {
base + 261,
"timer_delete" },
388 {
base + 262,
"clock_settime" },
389 {
base + 263,
"clock_gettime", clock_gettimeFunc<ArmLinux32> },
390 {
base + 264,
"clock_getres", clock_getresFunc<ArmLinux32> },
391 {
base + 265,
"clock_nanosleep" },
392 {
base + 266,
"statfs64" },
393 {
base + 267,
"fstatfs64" },
394 {
base + 268,
"tgkill", tgkillFunc<ArmLinux32> },
395 {
base + 269,
"utimes", utimesFunc<ArmLinux32> },
396 {
base + 270,
"arm_fadvise64_64" },
397 {
base + 271,
"pciconfig_iobase" },
398 {
base + 272,
"pciconfig_read" },
399 {
base + 273,
"pciconfig_write" },
400 {
base + 274,
"mq_open" },
401 {
base + 275,
"mq_unlink" },
402 {
base + 276,
"mq_timedsend" },
403 {
base + 277,
"mq_timedreceive" },
404 {
base + 278,
"mq_notify" },
405 {
base + 279,
"mq_getsetattr" },
406 {
base + 280,
"waitid" },
407 {
base + 281,
"socket" },
408 {
base + 282,
"bind" },
409 {
base + 283,
"connect" },
410 {
base + 284,
"listen" },
411 {
base + 285,
"accept" },
412 {
base + 286,
"getsockname" },
413 {
base + 287,
"getpeername" },
414 {
base + 288,
"socketpair" },
415 {
base + 289,
"send" },
416 {
base + 290,
"sendto", sendtoFunc<ArmLinux32> },
417 {
base + 291,
"recv" },
418 {
base + 292,
"recvfrom", recvfromFunc<ArmLinux32> },
419 {
base + 293,
"shutdown" },
420 {
base + 294,
"setsockopt" },
421 {
base + 295,
"getsockopt" },
422 {
base + 296,
"sendmsg" },
423 {
base + 297,
"rcvmsg" },
424 {
base + 298,
"semop" },
425 {
base + 299,
"semget" },
426 {
base + 300,
"semctl" },
427 {
base + 301,
"msgsend" },
428 {
base + 302,
"msgrcv" },
429 {
base + 303,
"msgget" },
430 {
base + 304,
"msgctl" },
431 {
base + 305,
"shmat" },
432 {
base + 306,
"shmdt" },
433 {
base + 307,
"shmget" },
434 {
base + 308,
"shmctl" },
435 {
base + 309,
"add_key" },
436 {
base + 310,
"request_key" },
437 {
base + 311,
"keyctl" },
438 {
base + 312,
"semtimedop" },
439 {
base + 314,
"ioprio_set" },
440 {
base + 315,
"ioprio_get" },
441 {
base + 316,
"inotify_init" },
442 {
base + 317,
"inotify_add_watch" },
443 {
base + 318,
"inotify_rm_watch" },
444 {
base + 319,
"mbind" },
445 {
base + 320,
"get_mempolicy" },
446 {
base + 321,
"set_mempolicy" },
447 {
base + 322,
"openat", openatFunc<ArmLinux32> },
448 {
base + 323,
"mkdirat", mkdiratFunc<ArmLinux32> },
449 {
base + 324,
"mknodat", mknodatFunc<ArmLinux32> },
450 {
base + 325,
"fchownat", fchownatFunc<ArmLinux32> },
451 {
base + 326,
"futimesat", futimesatFunc<ArmLinux32> },
452 {
base + 327,
"fstatat64" },
453 {
base + 328,
"unlinkat", unlinkatFunc<ArmLinux32> },
454 {
base + 329,
"renameat", renameatFunc<ArmLinux32> },
455 {
base + 330,
"linkat" },
456 {
base + 331,
"symlinkat" },
457 {
base + 332,
"readlinkat", readlinkatFunc<ArmLinux32> },
458 {
base + 333,
"fchmodat", fchmodatFunc<ArmLinux32> },
459 {
base + 334,
"faccessat", faccessatFunc<ArmLinux32> },
460 {
base + 335,
"pselect6" },
461 {
base + 336,
"ppoll" },
462 {
base + 337,
"unshare" },
464 {
base + 339,
"get_robust_list" },
465 {
base + 340,
"splice" },
466 {
base + 341,
"arm_sync_file_range" },
467 {
base + 342,
"tee" },
468 {
base + 343,
"vmsplice" },
469 {
base + 344,
"move_pages" },
471 {
base + 346,
"epoll_pwait" },
472 {
base + 347,
"sys_kexec_load" },
473 {
base + 348,
"sys_utimensat" },
474 {
base + 349,
"sys_signalfd" },
475 {
base + 350,
"sys_timerfd_create" },
476 {
base + 351,
"sys_eventfd" },
477 {
base + 352,
"sys_fallocate" },
478 {
base + 353,
"sys_timerfd_settime" },
479 {
base + 354,
"sys_timerfd_gettime" },
480 {
base + 355,
"sys_signalfd4" },
481 {
base + 356,
"sys_eventfd2" },
482 {
base + 357,
"sys_epoll_create1" },
483 {
base + 358,
"sys_dup3" },
484 {
base + 359,
"sys_pipe2" },
485 {
base + 360,
"sys_inotify_init1" },
486 {
base + 361,
"sys_preadv" },
487 {
base + 362,
"sys_pwritev" },
488 {
base + 363,
"sys_rt_tgsigqueueinfo" },
489 {
base + 364,
"sys_perf_event_open" },
490 {
base + 365,
"sys_recvmmsg" },
491 {
base + 384,
"getrandom", getrandomFunc<ArmLinux32> },
504 {
base + 0,
"io_setup" },
505 {
base + 1,
"io_destroy" },
506 {
base + 2,
"io_submit" },
507 {
base + 3,
"io_cancel" },
508 {
base + 4,
"io_getevents" },
509 {
base + 5,
"setxattr" },
510 {
base + 6,
"lsetxattr" },
511 {
base + 7,
"fsetxattr" },
512 {
base + 8,
"getxattr" },
513 {
base + 9,
"lgetxattr" },
514 {
base + 10,
"fgetxattr" },
515 {
base + 11,
"listxattr" },
516 {
base + 12,
"llistxattr" },
517 {
base + 13,
"flistxattr" },
518 {
base + 14,
"removexattr" },
519 {
base + 15,
"lremovexattr" },
520 {
base + 16,
"fremovexattr" },
521 {
base + 17,
"getcwd", getcwdFunc<ArmLinux64> },
522 {
base + 18,
"lookup_dcookie" },
523 {
base + 19,
"eventfd2" },
524 {
base + 20,
"epoll_create1" },
525 {
base + 21,
"epoll_ctl" },
526 {
base + 22,
"epoll_pwait" },
528 {
base + 24,
"dup3" },
530 {
base + 26,
"inotify_init1" },
531 {
base + 27,
"inotify_add_watch" },
532 {
base + 28,
"inotify_rm_watch" },
533 {
base + 29,
"ioctl", ioctlFunc<ArmLinux64> },
534 {
base + 30,
"ioprio_set" },
535 {
base + 31,
"ioprio_get" },
536 {
base + 32,
"flock" },
537 {
base + 33,
"mknodat", mknodatFunc<ArmLinux64> },
538 {
base + 34,
"mkdirat", mkdiratFunc<ArmLinux64> },
539 {
base + 35,
"unlinkat", unlinkatFunc<ArmLinux64> },
540 {
base + 36,
"symlinkat" },
541 {
base + 37,
"linkat" },
542 {
base + 38,
"renameat", renameatFunc<ArmLinux64> },
543 {
base + 39,
"umount2" },
544 {
base + 40,
"mount" },
545 {
base + 41,
"pivot_root" },
546 {
base + 42,
"nfsservctl" },
547 {
base + 43,
"statfs64" },
548 {
base + 44,
"fstatfs64" },
551 {
base + 47,
"fallocate", fallocateFunc<ArmLinux64> },
552 {
base + 48,
"faccessat", faccessatFunc<ArmLinux64> },
554 {
base + 50,
"fchdir" },
555 {
base + 51,
"chroot" },
556 {
base + 52,
"fchmod" },
557 {
base + 53,
"fchmodat", fchmodatFunc<ArmLinux64> },
558 {
base + 54,
"fchownat", fchownatFunc<ArmLinux64> },
560 {
base + 56,
"openat", openatFunc<ArmLinux64> },
562 {
base + 58,
"vhangup" },
563 {
base + 59,
"pipe2" },
564 {
base + 60,
"quotactl" },
565#if defined(SYS_getdents64)
566 {
base + 61,
"getdents64", getdents64Func },
568 {
base + 61,
"getdents64" },
570 {
base + 62,
"lseek", lseekFunc<ArmLinux64> },
571 {
base + 63,
"read", readFunc<ArmLinux64> },
572 {
base + 64,
"write", writeFunc<ArmLinux64> },
573 {
base + 65,
"readv", readvFunc<ArmLinux64> },
574 {
base + 66,
"writev", writevFunc<ArmLinux64> },
575 {
base + 67,
"pread64", pread64Func<ArmLinux64> },
576 {
base + 68,
"pwrite64", pwrite64Func<ArmLinux64> },
577 {
base + 69,
"preadv" },
578 {
base + 70,
"pwritev" },
579 {
base + 71,
"sendfile64" },
580 {
base + 72,
"pselect6" },
581 {
base + 73,
"ppoll" },
582 {
base + 74,
"signalfd4" },
583 {
base + 75,
"vmsplice" },
584 {
base + 76,
"splice" },
585 {
base + 77,
"tee" },
586 {
base + 78,
"readlinkat", readlinkatFunc<ArmLinux64> },
587 {
base + 79,
"fstatat64", fstatat64Func<ArmLinux64> },
588 {
base + 80,
"fstat64", fstat64Func<ArmLinux64> },
589 {
base + 81,
"sync" },
590 {
base + 82,
"fsync" },
591 {
base + 83,
"fdatasync" },
592 {
base + 84,
"sync_file_range" },
593 {
base + 85,
"timerfd_create" },
594 {
base + 86,
"timerfd_settime" },
595 {
base + 87,
"timerfd_gettime" },
596 {
base + 88,
"utimensat" },
597 {
base + 89,
"acct" },
598 {
base + 90,
"capget" },
599 {
base + 91,
"capset" },
600 {
base + 92,
"personality" },
603 {
base + 95,
"waitid" },
605 {
base + 97,
"unshare" },
606 {
base + 98,
"futex", futexFunc<ArmLinux64> },
608 {
base + 100,
"get_robust_list" },
610 {
base + 102,
"getitimer" },
611 {
base + 103,
"setitimer" },
612 {
base + 104,
"kexec_load" },
613 {
base + 105,
"init_module" },
614 {
base + 106,
"delete_module" },
615 {
base + 107,
"timer_create" },
616 {
base + 108,
"timer_gettime" },
617 {
base + 109,
"timer_getoverrun" },
618 {
base + 110,
"timer_settime" },
619 {
base + 111,
"timer_delete" },
620 {
base + 112,
"clock_settime" },
621 {
base + 113,
"clock_gettime", clock_gettimeFunc<ArmLinux64> },
622 {
base + 114,
"clock_getres" },
623 {
base + 115,
"clock_nanosleep" },
624 {
base + 116,
"syslog" },
625 {
base + 117,
"ptrace" },
636 {
base + 128,
"restart_syscall" },
638 {
base + 130,
"tkill" },
639 {
base + 131,
"tgkill", tgkillFunc<ArmLinux64> },
640 {
base + 132,
"sigaltstack" },
641 {
base + 133,
"rt_sigsuspend" },
644 {
base + 136,
"rt_sigpending" },
645 {
base + 137,
"rt_sigtimedwait" },
647 {
base + 139,
"rt_sigreturn" },
648 {
base + 140,
"setpriority" },
649 {
base + 141,
"getpriority" },
650 {
base + 142,
"reboot" },
651 {
base + 143,
"setregid" },
652 {
base + 144,
"setgid" },
653 {
base + 145,
"setreuid" },
654 {
base + 146,
"setuid" },
655 {
base + 147,
"setresuid" },
656 {
base + 148,
"getresuid" },
657 {
base + 149,
"setresgid" },
658 {
base + 150,
"getresgid" },
659 {
base + 151,
"setfsuid" },
660 {
base + 152,
"setfsgid" },
661 {
base + 153,
"times", timesFunc<ArmLinux64> },
662 {
base + 154,
"setpgid" },
663 {
base + 155,
"getpgid" },
664 {
base + 156,
"getsid" },
665 {
base + 157,
"setsid" },
666 {
base + 158,
"getgroups" },
667 {
base + 159,
"setgroups" },
670 {
base + 162,
"setdomainname" },
671 {
base + 163,
"getrlimit", getrlimitFunc<ArmLinux64> },
673 {
base + 165,
"getrusage", getrusageFunc<ArmLinux64> },
674 {
base + 166,
"umask" },
675 {
base + 167,
"prctl" },
677 {
base + 169,
"gettimeofday", gettimeofdayFunc<ArmLinux64> },
678 {
base + 170,
"settimeofday" },
679 {
base + 171,
"adjtimex" },
687 {
base + 179,
"sysinfo", sysinfoFunc<ArmLinux64> },
688 {
base + 180,
"mq_open" },
689 {
base + 181,
"mq_unlink" },
690 {
base + 182,
"mq_timedsend" },
691 {
base + 183,
"mq_timedreceive" },
692 {
base + 184,
"mq_notify" },
693 {
base + 185,
"mq_getsetattr" },
694 {
base + 186,
"msgget" },
695 {
base + 187,
"msgctl" },
696 {
base + 188,
"msgrcv" },
697 {
base + 189,
"msgsnd" },
698 {
base + 190,
"semget" },
699 {
base + 191,
"semctl" },
700 {
base + 192,
"semtimedop" },
701 {
base + 193,
"semop" },
702 {
base + 194,
"shmget" },
703 {
base + 195,
"shmctl" },
704 {
base + 196,
"shmat" },
705 {
base + 197,
"shmdt" },
706 {
base + 198,
"socket" },
707 {
base + 199,
"socketpair" },
708 {
base + 200,
"bind" },
709 {
base + 201,
"listen" },
710 {
base + 202,
"accept" },
711 {
base + 203,
"connect" },
712 {
base + 204,
"getsockname" },
713 {
base + 205,
"getpeername" },
714 {
base + 206,
"sendto", sendtoFunc<ArmLinux64> },
715 {
base + 207,
"recvfrom", recvfromFunc<ArmLinux64> },
716 {
base + 208,
"setsockopt" },
717 {
base + 209,
"getsockopt" },
718 {
base + 210,
"shutdown" },
719 {
base + 211,
"sendmsg" },
720 {
base + 212,
"recvmsg" },
721 {
base + 213,
"readahead" },
723 {
base + 215,
"munmap", munmapFunc<ArmLinux64> },
724 {
base + 216,
"mremap", mremapFunc<ArmLinux64> },
725 {
base + 217,
"add_key" },
726 {
base + 218,
"request_key" },
727 {
base + 219,
"keyctl" },
728 {
base + 220,
"clone", cloneBackwardsFunc<ArmLinux64> },
729 {
base + 221,
"execve", execveFunc<ArmLinux64> },
730 {
base + 222,
"mmap2", mmapFunc<ArmLinux64> },
731 {
base + 223,
"fadvise64_64" },
732 {
base + 224,
"swapon" },
733 {
base + 225,
"swapoff" },
735 {
base + 227,
"msync" },
736 {
base + 228,
"mlock" },
737 {
base + 229,
"munlock" },
738 {
base + 230,
"mlockall" },
739 {
base + 231,
"munlockall" },
740 {
base + 232,
"mincore" },
742 {
base + 234,
"remap_file_pages" },
743 {
base + 235,
"mbind" },
744 {
base + 236,
"get_mempolicy" },
745 {
base + 237,
"set_mempolicy" },
746 {
base + 238,
"migrate_pages" },
747 {
base + 239,
"move_pages" },
748 {
base + 240,
"rt_tgsigqueueinfo" },
749 {
base + 241,
"perf_event_open" },
750 {
base + 242,
"accept4" },
751 {
base + 243,
"recvmmsg" },
752 {
base + 260,
"wait4" },
753 {
base + 261,
"prlimit64", prlimitFunc<ArmLinux64> },
754 {
base + 262,
"fanotify_init" },
755 {
base + 263,
"fanotify_mark" },
756 {
base + 264,
"name_to_handle_at" },
757 {
base + 265,
"open_by_handle_at" },
758 {
base + 266,
"clock_adjtime" },
759 {
base + 267,
"syncfs" },
760 {
base + 268,
"setns" },
761 {
base + 269,
"sendmmsg" },
762 {
base + 270,
"process_vm_readv" },
763 {
base + 271,
"process_vm_writev" },
764 {
base + 272,
"kcmp" },
765 {
base + 273,
"finit_module" },
766 {
base + 274,
"sched_setattr"},
767 {
base + 275,
"sched_getattr"},
768 {
base + 276,
"renameat2"},
769 {
base + 277,
"seccomp"},
770 {
base + 278,
"getrandom", getrandomFunc<ArmLinux64> },
771 {
base + 279,
"memfd_create" },
772 {
base + 280,
"bpf" },
773 {
base + 281,
"execveat"},
774 {
base + 282,
"userfaultfd"},
775 {
base + 283,
"membarrier"},
776 {
base + 284,
"mlock2"},
777 {
base + 285,
"copy_file_range"},
778 {
base + 286,
"preadv2"},
779 {
base + 287,
"pwritev2"},
780 {
base + 288,
"pkey_mprotect"},
781 {
base + 289,
"pkey_alloc"},
782 {
base + 290,
"pkey_free"},
783 {
base + 291,
"statx"},
784 {
base + 292,
"io_pgetevents"},
786 {
base + 294,
"kexec_file_load"},
787 {
base + 1024,
"open", openFunc<ArmLinux64> },
788 {
base + 1025,
"link" },
791 {
base + 1028,
"chmod", chmodFunc<ArmLinux64> },
792 {
base + 1029,
"chown" },
794 {
base + 1031,
"rmdir" },
795 {
base + 1032,
"lchown" },
798 {
base + 1035,
"readlink", readlinkFunc<ArmLinux64> },
799 {
base + 1036,
"symlink" },
800 {
base + 1037,
"utimes", utimesFunc<ArmLinux64> },
801 {
base + 1038,
"stat64", stat64Func<ArmLinux64> },
802 {
base + 1039,
"lstat64", lstat64Func<ArmLinux64> },
804 {
base + 1041,
"dup2" },
805 {
base + 1042,
"epoll_create" },
806 {
base + 1043,
"inotify_init" },
807 {
base + 1044,
"eventfd" },
808 {
base + 1045,
"signalfd" },
809 {
base + 1046,
"sendfile" },
810 {
base + 1047,
"ftruncate", ftruncateFunc<ArmLinux64> },
811 {
base + 1048,
"truncate", truncateFunc<ArmLinux64> },
812 {
base + 1049,
"stat", statFunc<ArmLinux64> },
813 {
base + 1050,
"lstat" },
814 {
base + 1051,
"fstat", fstatFunc<ArmLinux64> },
816 {
base + 1053,
"fadvise64" },
817 {
base + 1054,
"newfstatat" },
818 {
base + 1055,
"fstatfs" },
819 {
base + 1056,
"statfs" },
820 {
base + 1057,
"lseek", lseekFunc<ArmLinux64> },
821 {
base + 1058,
"mmap", mmapFunc<ArmLinux64> },
822 {
base + 1059,
"alarm" },
823 {
base + 1060,
"getpgrp" },
824 {
base + 1061,
"pause" },
825 {
base + 1062,
"time", timeFunc<ArmLinux64> },
826 {
base + 1063,
"utime" },
827 {
base + 1064,
"creat" },
828#if defined(SYS_getdents)
829 {
base + 1065,
"getdents", getdentsFunc },
831 {
base + 1065,
"getdents" },
833 {
base + 1066,
"futimesat", futimesatFunc<ArmLinux64> },
834 {
base + 1067,
"select" },
835 {
base + 1068,
"poll", pollFunc<ArmLinux64> },
836 {
base + 1069,
"epoll_wait" },
837 {
base + 1070,
"ustat" },
838 {
base + 1071,
"vfork" },
839 {
base + 1072,
"oldwait4" },
840 {
base + 1073,
"recv" },
841 {
base + 1074,
"send" },
842 {
base + 1075,
"bdflush" },
843 {
base + 1076,
"umount" },
844 {
base + 1077,
"uselib" },
845 {
base + 1078,
"_sysctl" },
846 {
base + 1079,
"fork" }
854 { 0xf0001,
"breakpoint" },
855 { 0xf0002,
"cacheflush" },
856 { 0xf0003,
"usr26" },
857 { 0xf0004,
"usr32" },
863 { 0x1002,
"cacheflush" },
873 process->Process::syscall(tc);
void syscall(ThreadContext *tc) override
static const Addr commPage
A page to hold "kernel" provided functions. The name might be wrong.
A process with emulated Arm/Linux syscalls.
void writeBlob(Addr addr, const void *p, uint64_t size) const
Same as tryWriteBlob, but insists on success.
SyscallDesc * get(int num, bool fatal_if_missing=true)
This class provides the wrapper interface for the system call implementations which are defined in th...
void doSyscall(ThreadContext *tc)
Interface for invoking the system call funcion pointer.
This class represents the return value from an emulated system call, including any errno setting.
ThreadContext is the external interface to all thread state for anything outside of the CPU.
virtual void setMiscReg(RegIndex misc_reg, RegVal val)=0
virtual RegVal getReg(const RegId ®) const
virtual Process * getProcessPtr()=0
#define fatal(...)
This implements a cprintf based fatal() function.
static SyscallReturn unameFunc32(SyscallDesc *desc, ThreadContext *tc, VPtr< Linux::utsname > name)
Target uname() handler.
static SyscallReturn setTLSFunc64(SyscallDesc *desc, ThreadContext *tc, uint32_t tlsPtr)
static SyscallDescTable< EmuLinux::SyscallABI64 > privSyscallDescs64
static SyscallTable32 syscallDescs32High(0x900000)
static SyscallTable64 syscallDescs64Low(0)
static SyscallReturn setTLSFunc32(SyscallDesc *desc, ThreadContext *tc, uint32_t tlsPtr)
Target set_tls() handler.
static SyscallTable64 syscallDescs64High(0x900000)
static SyscallTable32 syscallDescs32Low(0)
static SyscallReturn unameFunc64(SyscallDesc *desc, ThreadContext *tc, VPtr< Linux::utsname > name)
Target uname() handler.
static SyscallDescTable< EmuLinux::SyscallABI32 > privSyscallDescs32
Copyright (c) 2024 Arm Limited All rights reserved.
SyscallReturn getppidFunc(SyscallDesc *desc, ThreadContext *tc)
Target getppid() handler.
SyscallReturn exitGroupFunc(SyscallDesc *desc, ThreadContext *tc, int status)
Target exit_group() handler: terminate simulation. (exit all threads)
SyscallReturn gettidFunc(SyscallDesc *desc, ThreadContext *tc)
Target gettid() handler.
SyscallReturn brkFunc(SyscallDesc *desc, ThreadContext *tc, VPtr<> new_brk)
Target brk() handler: set brk address.
SyscallReturn getpidFunc(SyscallDesc *desc, ThreadContext *tc)
Target getpid() handler.
SyscallReturn chdirFunc(SyscallDesc *desc, ThreadContext *tc, VPtr<> pathname)
Target chdir() handler.
SyscallReturn truncate64Func(SyscallDesc *desc, ThreadContext *tc, VPtr<> pathname, int64_t length)
Target truncate64() handler.
SyscallReturn getuidFunc(SyscallDesc *desc, ThreadContext *tc)
SyscallReturn pipePseudoFunc(SyscallDesc *desc, ThreadContext *tc)
Pseudo Funcs - These functions use a different return convension, returning a second value in a regis...
SyscallReturn chownFunc(SyscallDesc *desc, ThreadContext *tc, VPtr<> pathname, uint32_t owner, uint32_t group)
Target chown() handler.
SyscallReturn _llseekFunc(SyscallDesc *desc, ThreadContext *tc, int tgt_fd, uint32_t offset_high, uint32_t offset_low, VPtr<> result_ptr, int whence)
Target _llseek() handler.
SyscallReturn renameFunc(SyscallDesc *desc, ThreadContext *tc, VPtr<> oldpath, VPtr<> newpath)
Target rename() handler.
SyscallReturn mknodFunc(SyscallDesc *desc, ThreadContext *tc, VPtr<> pathname, mode_t mode, dev_t dev)
Target mknod() handler.
SyscallReturn geteuidFunc(SyscallDesc *desc, ThreadContext *tc)
Target geteuid() handler.
SyscallReturn unlinkFunc(SyscallDesc *desc, ThreadContext *tc, VPtr<> pathname)
Target unlink() handler.
SyscallReturn fcntl64Func(SyscallDesc *desc, ThreadContext *tc, int tgt_fd, int cmd)
Target fcntl64() handler.
SyscallReturn ignoreWarnOnceFunc(SyscallDesc *desc, ThreadContext *tc)
Like above, but only prints a warning once per syscall desc it's used with.
SyscallReturn mkdirFunc(SyscallDesc *desc, ThreadContext *tc, VPtr<> pathname, mode_t mode)
Target mkdir() handler.
SyscallReturn dupFunc(SyscallDesc *desc, ThreadContext *tc, int tgt_fd)
FIXME: The file description is not shared among file descriptors created with dup.
SyscallReturn ftruncate64Func(SyscallDesc *desc, ThreadContext *tc, int tgt_fd, int64_t length)
Target ftruncate64() handler.
SyscallReturn fchownFunc(SyscallDesc *desc, ThreadContext *tc, int tgt_fd, uint32_t owner, uint32_t group)
Target fchown() handler.
SyscallReturn setTidAddressFunc(SyscallDesc *desc, ThreadContext *tc, VPtr<> tidPtr)
Target set_tid_address() handler.
SyscallReturn fcntlFunc(SyscallDesc *desc, ThreadContext *tc, int tgt_fd, int cmd, guest_abi::VarArgs< int > varargs)
Target fcntl() handler.
SyscallReturn getegidFunc(SyscallDesc *desc, ThreadContext *tc)
Target getegid() handler.
SyscallReturn getcpuFunc(SyscallDesc *desc, ThreadContext *tc, VPtr< uint32_t > cpu, VPtr< uint32_t > node, VPtr< uint32_t > tcache)
SyscallReturn accessFunc(SyscallDesc *desc, ThreadContext *tc, VPtr<> pathname, mode_t mode)
Target access() handler.
SyscallReturn ignoreFunc(SyscallDesc *desc, ThreadContext *tc)
Handler for unimplemented syscalls that we never intend to implement (signal handling,...
SyscallReturn exitFunc(SyscallDesc *desc, ThreadContext *tc, int status)
Target exit() handler: terminate current context.
SyscallReturn getgidFunc(SyscallDesc *desc, ThreadContext *tc)
Target getgid() handler.
SyscallReturn closeFunc(SyscallDesc *desc, ThreadContext *tc, int tgt_fd)
Target close() handler.
SyscallReturn umaskFunc(SyscallDesc *desc, ThreadContext *tc)
Target umask() handler.
This file defines objects used to emulate syscalls from the target application on the host machine.
const std::string & name()