32 #include <sys/syscall.h>
47 class LinuxLoader :
public Process::Loader
51 load(
const ProcessParams ¶ms, loader::ObjectFile *obj)
override
56 auto opsys = obj->getOpSys();
59 warn(
"Unknown operating system; assuming Linux.");
66 return new MipsProcess(params, obj);
70 LinuxLoader linuxLoader;
83 process->Process::syscall(tc);
94 strcpy(
name->sysname,
"Linux");
95 strcpy(
name->nodename,
"sim.gem5.org");
96 strcpy(
name->release, process->release.c_str());
97 strcpy(
name->version,
"#1 Mon Aug 18 11:32:15 EDT 2003");
98 strcpy(
name->machine,
"mips");
108 unsigned bufPtr,
unsigned nbytes)
120 std::cerr <<
"sys_getsysinfo: unknown op " <<
op << std::endl;
131 VPtr<> bufPtr,
unsigned nbytes)
140 DPRINTFR(SyscallVerbose,
"sys_setsysinfo(SSI_IEEE_FP_CONTROL): "
141 " setting FPCR to 0x%x\n",
letoh(*fpcr));
145 std::cerr <<
"sys_setsysinfo: unknown op " <<
op << std::endl;
164 { 4003,
"read", readFunc<MipsLinux> },
165 { 4004,
"write", writeFunc<MipsLinux> },
166 { 4005,
"open", openFunc<MipsLinux> },
176 { 4015,
"chmod", chmodFunc<MipsLinux> },
179 { 4018,
"unused#18" },
189 { 4028,
"unused#28" },
215 { 4054,
"ioctl", ioctlFunc<MipsLinux> },
220 { 4059,
"unused#59" },
228 { 4067,
"sigaction" },
229 { 4068,
"sgetmask" },
230 { 4069,
"ssetmask" },
231 { 4070,
"setreuid" },
232 { 4071,
"setregid" },
233 { 4072,
"sigsuspend" },
234 { 4073,
"sigpending" },
236 { 4075,
"setrlimit" },
237 { 4076,
"getrlimit" },
238 { 4077,
"getrusage", getrusageFunc<MipsLinux> },
239 { 4078,
"gettimeofday" },
240 { 4079,
"settimeofday" },
241 { 4080,
"getgroups" },
242 { 4081,
"setgroups" },
243 { 4082,
"reserved#82" },
245 { 4084,
"unused#84" },
246 { 4085,
"readlink", readlinkFunc<MipsLinux> },
251 { 4090,
"mmap", mmapFunc<MipsLinux> },
252 { 4091,
"munmap",munmapFunc<MipsLinux> },
253 { 4092,
"truncate", truncateFunc<MipsLinux> },
254 { 4093,
"ftruncate", ftruncateFunc<MipsLinux> },
255 { 4094,
"fchmod", fchmodFunc<MipsLinux> },
257 { 4096,
"getpriority" },
258 { 4097,
"setpriority" },
263 { 4102,
"socketcall" },
265 { 4104,
"setitimer" },
266 { 4105,
"getitimer" },
267 { 4106,
"stat", statFunc<MipsLinux> },
269 { 4108,
"fstat", fstatFunc<MipsLinux> },
270 { 4109,
"unused#109" },
277 { 4116,
"sysinfo", sysinfoFunc<MipsLinux> },
280 { 4119,
"sigreturn" },
282 { 4121,
"setdomainname" },
284 { 4123,
"modify_ldt" },
285 { 4124,
"adjtimex" },
287 { 4126,
"sigprocmask" },
288 { 4127,
"create_module" },
289 { 4128,
"init_module" },
290 { 4129,
"delete_module" },
291 { 4130,
"get_kernel_syms" },
292 { 4131,
"quotactl" },
297 { 4136,
"personality" },
298 { 4137,
"afs_syscall" },
299 { 4138,
"setfsuid" },
300 { 4139,
"setfsgid" },
302 { 4141,
"getdents" },
303 { 4142,
"newselect" },
307 { 4146,
"writev", writevFunc<MipsLinux> },
308 { 4147,
"cacheflush" },
309 { 4148,
"cachectl" },
311 { 4150,
"unused#150" },
313 { 4152,
"fdatasync" },
317 { 4156,
"mlockall" },
318 { 4157,
"munlockall" },
319 { 4158,
"sched_setparam" },
320 { 4159,
"sched_getparam" },
321 { 4160,
"sched_setscheduler" },
322 { 4161,
"sched_getscheduler" },
323 { 4162,
"sched_yield" },
324 { 4163,
"sched_get_prioritymax" },
325 { 4164,
"sched_get_priority_min" },
326 { 4165,
"sched_rr_get_interval" },
327 { 4166,
"nanosleep" },
328 { 4167,
"mremap", mremapFunc<MipsLinux> },
332 { 4171,
"getpeername" },
333 { 4172,
"getsockname" },
334 { 4173,
"getsockopt" },
341 { 4180,
"setsockopt" },
342 { 4181,
"shutdown" },
343 { 4182,
"unknown #182" },
345 { 4184,
"socketpair" },
346 { 4185,
"setresuid" },
347 { 4186,
"getresuid" },
348 { 4187,
"query_module" },
350 { 4189,
"nfsservctl" },
351 { 4190,
"setresgid" },
352 { 4191,
"getresgid" },
354 { 4193,
"rt_sigreturn" },
355 { 4194,
"rt_sigaction" },
356 { 4195,
"rt_sigprocmask" },
357 { 4196,
"rt_sigpending" },
358 { 4197,
"rt_sigtimedwait" },
360 { 4199,
"rt_sigsuspend" },
362 { 4201,
"pwrite64" },
367 { 4206,
"sigalstack" },
368 { 4207,
"sendfile" },
372 { 4211,
"truncate64" },
373 { 4212,
"ftruncate64" },
375 { 4214,
"lstat64", lstat64Func<MipsLinux> },
376 { 4215,
"fstat64", fstat64Func<MipsLinux> },
377 { 4216,
"pivot_root" },
380 { 4219,
"getdents64" },
382 { 4221,
"reserved#221" },
384 { 4223,
"readahead" },
385 { 4224,
"setxattr" },
386 { 4225,
"lsetxattr" },
387 { 4226,
"fsetxattr" },
388 { 4227,
"getxattr" },
389 { 4228,
"lgetxattr" },
390 { 4229,
"fgetxattr" },
391 { 4230,
"listxattr" },
392 { 4231,
"llistxattr" },
393 { 4232,
"flistxattr" },
394 { 4233,
"removexattr" },
395 { 4234,
"lremovexattr" },
398 { 4237,
"sendfile64" },
400 { 4239,
"sched_setaffinity" },
401 { 4240,
"sched_getaffinity" },
402 { 4241,
"io_setup" },
403 { 4242,
"io_destroy" },
404 { 4243,
"io_getevents" },
405 { 4244,
"io_submit" },
406 { 4245,
"io_cancel" },
408 { 4247,
"lookup_dcookie" },
409 { 4248,
"epoll_create" },
410 { 4249,
"epoll_ctl" },
411 { 4250,
"epoll_wait" },
412 { 4251,
"remap_file_pages" },
413 { 4252,
"set_tid_address" },
414 { 4253,
"restart_syscall" },
415 { 4254,
"fadvise64" },
416 { 4255,
"statfs64" },
417 { 4256,
"fstafs64" },
420 { 4259,
"timer_gettime" },
421 { 4260,
"timer_getoverrun" },
422 { 4261,
"timer_delete" },
423 { 4262,
"clock_settime" },
424 { 4263,
"clock_gettime" },
425 { 4264,
"clock_getres" },
426 { 4265,
"clock_nanosleep" },
430 { 4269,
"get_mempolicy" },
431 { 4270,
"set_mempolicy" },
433 { 4272,
"mq_unlink" },
434 { 4273,
"mq_timedsend" },
435 { 4274,
"mq_timedreceive" },
436 { 4275,
"mq_notify" },
437 { 4276,
"mq_getsetattr" },
440 { 4279,
"unknown #279" },
442 { 4281,
"request_key" },
445 { 4284,
"inotify_init" },
446 { 4285,
"inotify_add_watch" },
447 { 4286,
"inotify_rm_watch" },
448 { 4287,
"migrate_pages" },
452 { 4291,
"fchownat" },
453 { 4292,
"futimesat" },
454 { 4293,
"fstatat64" },
455 { 4294,
"unlinkat" },
456 { 4295,
"renameat" },
458 { 4297,
"symlinkat" },
459 { 4298,
"readlinkat" },
460 { 4299,
"fchmodat" },
461 { 4300,
"faccessat" },
462 { 4301,
"pselect6" },
466 { 4305,
"sync_file_range" },
468 { 4307,
"vmsplice" },
469 { 4308,
"move_pages" },
470 { 4309,
"set_robust_list" },
471 { 4310,
"get_robust_list" },
472 { 4311,
"kexec_load" },
474 { 4313,
"epoll_pwait" },
475 { 4314,
"ioprio_set" },
476 { 4315,
"ioprio_get" },
477 { 4316,
"utimensat" },
478 { 4317,
"signalfd" },
void syscall(ThreadContext *tc) override
static SyscallDescTable< SyscallABI > syscallDescs
Syscall descriptors, indexed by call number.
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 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.
Reference material can be found at the JEDEC website: UFS standard http://www.jedec....
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 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 geteuidFunc(SyscallDesc *desc, ThreadContext *tc)
Target geteuid() handler.
SyscallReturn getcwdFunc(SyscallDesc *desc, ThreadContext *tc, VPtr<> buf_ptr, unsigned long size)
Target getcwd() 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 getpagesizeFunc(SyscallDesc *desc, ThreadContext *tc)
Target getpagesize() handler.
SyscallReturn mkdirFunc(SyscallDesc *desc, ThreadContext *tc, VPtr<> pathname, mode_t mode)
Target mkdir() handler.
SyscallReturn fchownFunc(SyscallDesc *desc, ThreadContext *tc, int tgt_fd, uint32_t owner, uint32_t group)
Target fchown() 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 lseekFunc(SyscallDesc *desc, ThreadContext *tc, int tgt_fd, uint64_t offs, int whence)
Target lseek() handler.
SyscallReturn gethostnameFunc(SyscallDesc *desc, ThreadContext *tc, VPtr<> buf_ptr, int name_len)
Target gethostname() 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()