43#include <sys/syscall.h>
62 load(
const ProcessParams ¶ms, loader::ObjectFile *obj)
override
67 auto opsys = obj->getOpSys();
70 warn(
"Unknown operating system; assuming Linux.");
77 return new MipsProcess(params, obj);
81LinuxLoader linuxLoader;
94 process->Process::syscall(tc);
105 strcpy(
name->sysname,
"Linux");
106 strcpy(
name->nodename,
"sim.gem5.org");
107 strcpy(
name->release, process->release.c_str());
108 strcpy(
name->version,
"#1 Mon Aug 18 11:32:15 EDT 2003");
109 strcpy(
name->machine,
"mips");
119 unsigned bufPtr,
unsigned nbytes)
131 std::cerr <<
"sys_getsysinfo: unknown op " <<
op << std::endl;
142 VPtr<> bufPtr,
unsigned nbytes)
151 DPRINTFR(SyscallVerbose,
"sys_setsysinfo(SSI_IEEE_FP_CONTROL): "
152 " setting FPCR to 0x%x\n",
letoh(*fpcr));
156 std::cerr <<
"sys_setsysinfo: unknown op " <<
op << std::endl;
190 { 4018,
"unused#18" },
200 { 4028,
"unused#28" },
231 { 4059,
"unused#59" },
239 { 4067,
"sigaction" },
240 { 4068,
"sgetmask" },
241 { 4069,
"ssetmask" },
242 { 4070,
"setreuid" },
243 { 4071,
"setregid" },
244 { 4072,
"sigsuspend" },
245 { 4073,
"sigpending" },
247 { 4075,
"setrlimit" },
248 { 4076,
"getrlimit" },
250 { 4078,
"gettimeofday" },
251 { 4079,
"settimeofday" },
252 { 4080,
"getgroups" },
253 { 4081,
"setgroups" },
254 { 4082,
"reserved#82" },
256 { 4084,
"unused#84" },
268 { 4096,
"getpriority" },
269 { 4097,
"setpriority" },
274 { 4102,
"socketcall" },
276 { 4104,
"setitimer" },
277 { 4105,
"getitimer" },
281 { 4109,
"unused#109" },
291 { 4119,
"sigreturn" },
293 { 4121,
"setdomainname" },
295 { 4123,
"modify_ldt" },
296 { 4124,
"adjtimex" },
298 { 4126,
"sigprocmask" },
299 { 4127,
"create_module" },
300 { 4128,
"init_module" },
301 { 4129,
"delete_module" },
302 { 4130,
"get_kernel_syms" },
303 { 4131,
"quotactl" },
308 { 4136,
"personality" },
309 { 4137,
"afs_syscall" },
310 { 4138,
"setfsuid" },
311 { 4139,
"setfsgid" },
313 { 4141,
"getdents" },
314 { 4142,
"newselect" },
319 { 4147,
"cacheflush" },
320 { 4148,
"cachectl" },
322 { 4150,
"unused#150" },
324 { 4152,
"fdatasync" },
328 { 4156,
"mlockall" },
329 { 4157,
"munlockall" },
330 { 4158,
"sched_setparam" },
332 { 4160,
"sched_setscheduler" },
333 { 4161,
"sched_getscheduler" },
334 { 4162,
"sched_yield" },
335 { 4163,
"sched_get_prioritymax" },
336 { 4164,
"sched_get_priority_min" },
337 { 4165,
"sched_rr_get_interval" },
338 { 4166,
"nanosleep" },
343 { 4171,
"getpeername" },
344 { 4172,
"getsockname" },
345 { 4173,
"getsockopt" },
352 { 4180,
"setsockopt" },
353 { 4181,
"shutdown" },
354 { 4182,
"unknown #182" },
356 { 4184,
"socketpair" },
357 { 4185,
"setresuid" },
358 { 4186,
"getresuid" },
359 { 4187,
"query_module" },
361 { 4189,
"nfsservctl" },
362 { 4190,
"setresgid" },
363 { 4191,
"getresgid" },
365 { 4193,
"rt_sigreturn" },
366 { 4194,
"rt_sigaction" },
367 { 4195,
"rt_sigprocmask" },
368 { 4196,
"rt_sigpending" },
369 { 4197,
"rt_sigtimedwait" },
371 { 4199,
"rt_sigsuspend" },
373 { 4201,
"pwrite64" },
378 { 4206,
"sigalstack" },
379 { 4207,
"sendfile" },
383 { 4211,
"truncate64" },
384 { 4212,
"ftruncate64" },
388 { 4216,
"pivot_root" },
391 { 4219,
"getdents64" },
393 { 4221,
"reserved#221" },
395 { 4223,
"readahead" },
396 { 4224,
"setxattr" },
397 { 4225,
"lsetxattr" },
398 { 4226,
"fsetxattr" },
399 { 4227,
"getxattr" },
400 { 4228,
"lgetxattr" },
401 { 4229,
"fgetxattr" },
402 { 4230,
"listxattr" },
403 { 4231,
"llistxattr" },
404 { 4232,
"flistxattr" },
405 { 4233,
"removexattr" },
406 { 4234,
"lremovexattr" },
409 { 4237,
"sendfile64" },
411 { 4239,
"sched_setaffinity" },
412 { 4240,
"sched_getaffinity" },
413 { 4241,
"io_setup" },
414 { 4242,
"io_destroy" },
415 { 4243,
"io_getevents" },
416 { 4244,
"io_submit" },
417 { 4245,
"io_cancel" },
419 { 4247,
"lookup_dcookie" },
420 { 4248,
"epoll_create" },
421 { 4249,
"epoll_ctl" },
422 { 4250,
"epoll_wait" },
423 { 4251,
"remap_file_pages" },
424 { 4252,
"set_tid_address" },
425 { 4253,
"restart_syscall" },
426 { 4254,
"fadvise64" },
427 { 4255,
"statfs64" },
428 { 4256,
"fstafs64" },
431 { 4259,
"timer_gettime" },
432 { 4260,
"timer_getoverrun" },
433 { 4261,
"timer_delete" },
434 { 4262,
"clock_settime" },
435 { 4263,
"clock_gettime" },
436 { 4264,
"clock_getres" },
437 { 4265,
"clock_nanosleep" },
441 { 4269,
"get_mempolicy" },
442 { 4270,
"set_mempolicy" },
444 { 4272,
"mq_unlink" },
445 { 4273,
"mq_timedsend" },
446 { 4274,
"mq_timedreceive" },
447 { 4275,
"mq_notify" },
448 { 4276,
"mq_getsetattr" },
451 { 4279,
"unknown #279" },
453 { 4281,
"request_key" },
456 { 4284,
"inotify_init" },
457 { 4285,
"inotify_add_watch" },
458 { 4286,
"inotify_rm_watch" },
459 { 4287,
"migrate_pages" },
463 { 4291,
"fchownat" },
464 { 4292,
"futimesat" },
465 { 4293,
"fstatat64" },
466 { 4294,
"unlinkat" },
467 { 4295,
"renameat" },
469 { 4297,
"symlinkat" },
470 { 4298,
"readlinkat" },
471 { 4299,
"fchmodat" },
472 { 4300,
"faccessat" },
473 { 4301,
"pselect6" },
477 { 4305,
"sync_file_range" },
479 { 4307,
"vmsplice" },
480 { 4308,
"move_pages" },
481 { 4309,
"set_robust_list" },
482 { 4310,
"get_robust_list" },
483 { 4311,
"kexec_load" },
485 { 4313,
"epoll_pwait" },
486 { 4314,
"ioprio_set" },
487 { 4315,
"ioprio_get" },
488 { 4316,
"utimensat" },
489 { 4317,
"signalfd" },
void syscall(ThreadContext *tc) override
static SyscallDescTable< SyscallABI > syscallDescs
Syscall descriptors, indexed by call number.
Each instance of a Loader subclass will have a chance to try to load an object file when tryLoaders i...
This class provides the wrapper interface for the system call implementations which are defined in th...
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 RegVal getReg(const RegId ®) const
virtual void setMiscRegNoEffect(RegIndex misc_reg, RegVal val)=0
virtual Process * getProcessPtr()=0
static SyscallReturn sys_getsysinfoFunc(SyscallDesc *desc, ThreadContext *tc, unsigned op, unsigned bufPtr, unsigned nbytes)
Target sys_getsysyinfo() handler.
static SyscallReturn unameFunc(SyscallDesc *desc, ThreadContext *tc, VPtr< Linux::utsname > name)
Target uname() handler.
static SyscallReturn setThreadAreaFunc(SyscallDesc *desc, ThreadContext *tc, VPtr<> addr)
static SyscallReturn sys_setsysinfoFunc(SyscallDesc *desc, ThreadContext *tc, unsigned op, VPtr<> bufPtr, unsigned nbytes)
Target sys_setsysinfo() handler.
Copyright (c) 2024 Arm Limited All rights reserved.
SyscallReturn fstat64Func(SyscallDesc *desc, ThreadContext *tc, int tgt_fd, VPtr< typename OS::tgt_stat64 > tgt_stat)
Target fstat64() handler.
SyscallReturn brkFunc(SyscallDesc *desc, ThreadContext *tc, VPtr<> new_brk)
Target brk() handler: set brk address.
SyscallReturn mmapFunc(SyscallDesc *desc, ThreadContext *tc, VPtr<> start, typename OS::size_t length, int prot, int tgt_flags, int tgt_fd, typename OS::off_t offset)
Target mmap() handler.
SyscallReturn getpidFunc(SyscallDesc *desc, ThreadContext *tc)
Target getpid() handler.
SyscallReturn fstatFunc(SyscallDesc *desc, ThreadContext *tc, int tgt_fd, VPtr< typename OS::tgt_stat > tgt_stat)
Target fstat() handler.
SyscallReturn getuidFunc(SyscallDesc *desc, ThreadContext *tc)
SyscallReturn getrusageFunc(SyscallDesc *desc, ThreadContext *tc, int who, VPtr< typename OS::rusage > rup)
Target getrusage() function.
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 statFunc(SyscallDesc *desc, ThreadContext *tc, VPtr<> pathname, VPtr< typename OS::tgt_stat > tgt_stat)
Target stat() handler.
SyscallReturn writeFunc(SyscallDesc *desc, ThreadContext *tc, int tgt_fd, VPtr<> buf_ptr, typename OS::size_t nbytes)
SyscallReturn writevFunc(SyscallDesc *desc, ThreadContext *tc, int tgt_fd, VPtr<> tiov_base, typename OS::size_t count)
Target writev() handler.
SyscallReturn chmodFunc(SyscallDesc *desc, ThreadContext *tc, VPtr<> pathname, mode_t mode)
Target chmod() handler.
SyscallReturn truncateFunc(SyscallDesc *desc, ThreadContext *tc, VPtr<> pathname, typename OS::off_t length)
Target truncate() handler.
SyscallReturn geteuidFunc(SyscallDesc *desc, ThreadContext *tc)
Target geteuid() handler.
ProxyPtr< T, SETranslatingPortProxy > VPtr
SyscallReturn unlinkFunc(SyscallDesc *desc, ThreadContext *tc, VPtr<> pathname)
Target unlink() handler.
SyscallReturn lseekFunc(SyscallDesc *desc, ThreadContext *tc, int tgt_fd, typename OS::off_t offs, int whence)
Target lseek() handler.
SyscallReturn sysinfoFunc(SyscallDesc *desc, ThreadContext *tc, VPtr< typename OS::tgt_sysinfo > sysinfo)
Target sysinfo() handler.
SyscallReturn fcntl64Func(SyscallDesc *desc, ThreadContext *tc, int tgt_fd, int cmd)
Target fcntl64() handler.
SyscallReturn ftruncateFunc(SyscallDesc *desc, ThreadContext *tc, int tgt_fd, typename OS::off_t length)
Target ftruncate() handler.
SyscallReturn getpagesizeFunc(SyscallDesc *desc, ThreadContext *tc)
Target getpagesize() handler.
SyscallReturn mkdirFunc(SyscallDesc *desc, ThreadContext *tc, VPtr<> pathname, mode_t mode)
Target mkdir() handler.
SyscallReturn getcwdFunc(SyscallDesc *desc, ThreadContext *tc, VPtr<> buf_ptr, typename OS::size_t size)
Target getcwd() handler.
SyscallReturn fchownFunc(SyscallDesc *desc, ThreadContext *tc, int tgt_fd, uint32_t owner, uint32_t group)
Target fchown() handler.
SyscallReturn munmapFunc(SyscallDesc *desc, ThreadContext *tc, VPtr<> start, typename OS::size_t length)
Target munmap() handler.
SyscallReturn readlinkFunc(SyscallDesc *desc, ThreadContext *tc, VPtr<> pathname, VPtr<> buf_ptr, typename OS::size_t bufsiz)
Target readlink() handler.
SyscallReturn fcntlFunc(SyscallDesc *desc, ThreadContext *tc, int tgt_fd, int cmd, guest_abi::VarArgs< int > varargs)
Target fcntl() handler.
SyscallReturn openFunc(SyscallDesc *desc, ThreadContext *tc, VPtr<> pathname, int tgt_flags, int mode)
Target open() handler.
SyscallReturn getegidFunc(SyscallDesc *desc, ThreadContext *tc)
Target getegid() handler.
SyscallReturn fchmodFunc(SyscallDesc *desc, ThreadContext *tc, int tgt_fd, uint32_t mode)
Target fchmod() handler.
SyscallReturn ioctlFunc(SyscallDesc *desc, ThreadContext *tc, int tgt_fd, unsigned req, VPtr<> addr)
Target ioctl() handler.
SyscallReturn gethostnameFunc(SyscallDesc *desc, ThreadContext *tc, VPtr<> buf_ptr, int name_len)
Target gethostname() handler.
SyscallReturn lstat64Func(SyscallDesc *desc, ThreadContext *tc, VPtr<> pathname, VPtr< typename OS::tgt_stat64 > tgt_stat)
Target lstat64() handler.
SyscallReturn ignoreFunc(SyscallDesc *desc, ThreadContext *tc)
Handler for unimplemented syscalls that we never intend to implement (signal handling,...
ConstProxyPtr< T, SETranslatingPortProxy > ConstVPtr
SyscallReturn mremapFunc(SyscallDesc *desc, ThreadContext *tc, VPtr<> start, typename OS::size_t old_length, typename OS::size_t new_length, int flags, guest_abi::VarArgs< uint64_t > varargs)
Target mremap() handler.
SyscallReturn sched_getparamFunc(SyscallDesc *desc, ThreadContext *tc, int pid, VPtr< int > paramPtr)
SyscallReturn exitFunc(SyscallDesc *desc, ThreadContext *tc, int status)
Target exit() handler: terminate current context.
SyscallReturn getgidFunc(SyscallDesc *desc, ThreadContext *tc)
Target getgid() handler.
SyscallReturn readFunc(SyscallDesc *desc, ThreadContext *tc, int tgt_fd, VPtr<> buf_ptr, typename OS::size_t nbytes)
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()