34#include <sys/syscall.h>
48class LinuxLoader :
public Process::Loader
52 load(
const ProcessParams ¶ms, loader::ObjectFile *obj)
override
54 auto arch = obj->getArch();
59 auto opsys = obj->getOpSys();
62 warn(
"Unknown operating system; assuming Linux.");
72 return new PowerProcess(params, obj);
76LinuxLoader linuxLoader;
89 process->Process::syscall(tc);
100 strcpy(
name->sysname,
"Linux");
101 strcpy(
name->nodename,
"sim.gem5.org");
102 strcpy(
name->release, process->release.c_str());
103 strcpy(
name->version,
"#1 Mon Aug 18 11:32:15 EDT 2003");
104 strcpy(
name->machine,
"power");
182 { 72,
"sigsuspend" },
183 { 73,
"sigpending" },
188 { 78,
"gettimeofday" },
189 { 79,
"settimeofday" },
192 { 82,
"reserved#82" },
206 { 96,
"getpriority" },
207 { 97,
"setpriority" },
212 { 102,
"socketcall" },
214 { 104,
"setitimer" },
215 { 105,
"getitimer" },
219 { 109,
"unused#109" },
229 { 119,
"sigreturn" },
231 { 121,
"setdomainname" },
233 { 123,
"modify_ldt" },
236 { 126,
"sigprocmask" },
237 { 127,
"create_module" },
238 { 128,
"init_module" },
239 { 129,
"delete_module" },
240 { 130,
"get_kernel_syms" },
246 { 136,
"personality" },
247 { 137,
"afs_syscall" },
252 { 142,
"newselect" },
258 { 148,
"fdatasync" },
263 { 153,
"munlockall" },
264 { 154,
"sched_setparam" },
265 { 155,
"sched_getparam" },
266 { 156,
"sched_setscheduler" },
267 { 157,
"sched_getscheduler" },
268 { 158,
"sched_yield" },
269 { 159,
"sched_get_priority_max" },
270 { 160,
"sched_get_priority_min" },
271 { 161,
"sched_rr_get_interval" },
272 { 162,
"nanosleep" },
274 { 164,
"setresuid" },
275 { 165,
"getresuid" },
277 { 167,
"query_module" },
279 { 169,
"nfsservctl" },
280 { 170,
"setresgid" },
281 { 171,
"getresgid" },
284 { 174,
"rt_sigprocmask" },
285 { 175,
"unknown#175" },
286 { 176,
"rt_sigpending" },
287 { 177,
"rt_sigtimedwait" },
289 { 179,
"rt_sigsuspend" },
296 { 186,
"sigaltstack" },
301 { 191,
"getrlimit" },
303 { 193,
"truncate64" },
315 { 205,
"getgroups" },
316 { 206,
"setgroups" },
318 { 208,
"setresuid" },
319 { 209,
"getresuid" },
320 { 210,
"setresgid" },
321 { 211,
"getresgid" },
327 { 217,
"getdents64" },
328 { 218,
"pivot_root" },
331 { 221,
"unknown#221" },
333 { 223,
"unknown#223" },
335 { 225,
"readahead" },
337 { 227,
"lsetxattr" },
338 { 228,
"fsetxattr" },
340 { 230,
"lgetxattr" },
341 { 231,
"fgetxattr" },
342 { 232,
"listxattr" },
343 { 233,
"llistxattr" },
345 { 235,
"removexattr" },
346 { 236,
"lremovexattr" },
347 { 237,
"fremovexattr" },
349 { 239,
"sendfile64" },
351 { 241,
"sched_setaffinity" },
352 { 242,
"sched_getaffinity" },
354 { 244,
"io_destory" },
355 { 245,
"io_getevents" },
356 { 246,
"io_submit" },
357 { 247,
"io_cancel" },
358 { 248,
"unknown#248" },
359 { 249,
"lookup_dcookie" },
360 { 250,
"epoll_create" },
361 { 251,
"epoll_ctl" },
362 { 252,
"epoll_wait" },
363 { 253,
"remap_file_pages" },
364 { 254,
"set_thread_area" },
365 { 255,
"get_thread_area" },
366 { 256,
"set_tid_address" },
367 { 257,
"timer_create" },
368 { 258,
"timer_settime" },
369 { 259,
"timer_gettime" },
370 { 260,
"timer_getoverrun" },
371 { 261,
"timer_delete" },
372 { 262,
"clock_settime" },
373 { 263,
"clock_gettime" },
374 { 264,
"clock_getres" },
375 { 265,
"clock_nanosleep" },
377 { 267,
"fstatfs64" },
380 { 270,
"arm_fadvise64_64" },
381 { 271,
"pciconfig_iobase" },
382 { 272,
"pciconfig_read" },
383 { 273,
"pciconfig_write" },
385 { 275,
"mq_unlink" },
386 { 276,
"mq_timedsend" },
387 { 277,
"mq_timedreceive" },
388 { 278,
"mq_notify" },
389 { 279,
"mq_getsetattr" },
396 { 286,
"getsockname" },
397 { 287,
"getpeername" },
398 { 288,
"socketpair" },
404 { 294,
"setsockopt" },
405 { 295,
"getsockopt" },
420 { 310,
"request_key" },
422 { 312,
"semtimedop" },
424 { 314,
"ioprio_set" },
425 { 315,
"ioprio_get" },
426 { 316,
"inotify_init" },
427 { 317,
"inotify_add_watch" },
428 { 318,
"inotify_rm_watch" },
430 { 320,
"get_mempolicy" },
431 { 321,
"set_mempolicy" },
436 { 326,
"futimesat" },
437 { 327,
"fstatat64" },
441 { 331,
"symlinkat" },
442 { 332,
"readlinkat" },
444 { 334,
"faccessat" },
448 { 338,
"set_robust_list" },
449 { 339,
"get_robust_list" },
451 { 341,
"arm_sync_file_range" },
454 { 344,
"move_pages" },
456 { 346,
"epoll_pwait" },
static SyscallDescTable< SEWorkload::SyscallABI > syscallDescs
Syscall descriptors, indexed by call number.
void syscall(ThreadContext *tc) override
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 Process * getProcessPtr()=0
static SyscallReturn unameFunc(SyscallDesc *desc, ThreadContext *tc, VPtr< Linux::utsname > name)
Target uname() handler.
Copyright (c) 2024 - Pranith Kumar Copyright (c) 2020 Inria All rights reserved.
SyscallReturn exitGroupFunc(SyscallDesc *desc, ThreadContext *tc, int status)
Target exit_group() handler: terminate simulation. (exit all threads)
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 readFunc(SyscallDesc *desc, ThreadContext *tc, int tgt_fd, VPtr<> buf_ptr, int nbytes)
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 chmodFunc(SyscallDesc *desc, ThreadContext *tc, VPtr<> pathname, mode_t mode)
Target chmod() handler.
SyscallReturn renameFunc(SyscallDesc *desc, ThreadContext *tc, VPtr<> oldpath, VPtr<> newpath)
Target rename() handler.
SyscallReturn _llseekFunc(SyscallDesc *desc, ThreadContext *tc, int tgt_fd, uint64_t offset_high, uint32_t offset_low, VPtr<> result_ptr, int whence)
Target _llseek() 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.
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 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 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 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 timesFunc(SyscallDesc *desc, ThreadContext *tc, VPtr< typename OS::tms > bufp)
Target times() function.
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 timeFunc(SyscallDesc *desc, ThreadContext *tc, VPtr<> taddr)
Target time() function.
SyscallReturn ioctlFunc(SyscallDesc *desc, ThreadContext *tc, int tgt_fd, unsigned req, VPtr<> addr)
Target ioctl() handler.
SyscallReturn writevFunc(SyscallDesc *desc, ThreadContext *tc, int tgt_fd, uint64_t tiov_base, typename OS::size_t count)
Target writev() 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 cloneBackwardsFunc(SyscallDesc *desc, ThreadContext *tc, RegVal flags, RegVal newStack, VPtr<> ptidPtr, VPtr<> tlsPtr, VPtr<> ctidPtr)
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,...
SyscallReturn stat64Func(SyscallDesc *desc, ThreadContext *tc, VPtr<> pathname, VPtr< typename OS::tgt_stat64 > tgt_stat)
Target stat64() handler.
SyscallReturn exitFunc(SyscallDesc *desc, ThreadContext *tc, int status)
Target exit() handler: terminate current context.
SyscallReturn getgidFunc(SyscallDesc *desc, ThreadContext *tc)
Target getgid() handler.
SyscallReturn writeFunc(SyscallDesc *desc, ThreadContext *tc, int tgt_fd, VPtr<> buf_ptr, int 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()