34 #include <sys/syscall.h>
48 class 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);
76 LinuxLoader 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");
113 { 3,
"read", readFunc<PowerLinux> },
114 { 4,
"write", writeFunc<PowerLinux> },
115 { 5,
"open", openFunc<PowerLinux> },
123 { 13,
"time", timeFunc<PowerLinux> },
125 { 15,
"chmod", chmodFunc<PowerLinux> },
153 { 43,
"times", timesFunc<PowerLinux> },
164 { 54,
"ioctl", ioctlFunc<PowerLinux> },
182 { 72,
"sigsuspend" },
183 { 73,
"sigpending" },
188 { 78,
"gettimeofday" },
189 { 79,
"settimeofday" },
192 { 82,
"reserved#82" },
195 { 85,
"readlink", readlinkFunc<PowerLinux> },
200 { 90,
"mmap", mmapFunc<PowerLinux> },
201 { 91,
"munmap",munmapFunc<PowerLinux> },
202 { 92,
"truncate", truncateFunc<PowerLinux> },
203 { 93,
"ftruncate", ftruncateFunc<PowerLinux> },
206 { 96,
"getpriority" },
207 { 97,
"setpriority" },
212 { 102,
"socketcall" },
214 { 104,
"setitimer" },
215 { 105,
"getitimer" },
216 { 106,
"stat", statFunc<PowerLinux> },
218 { 108,
"fstat", fstatFunc<PowerLinux> },
219 { 109,
"unused#109" },
229 { 119,
"sigreturn" },
230 { 120,
"clone", cloneBackwardsFunc<PowerLinux> },
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" },
256 { 146,
"writev", writevFunc<PowerLinux> },
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" },
302 { 192,
"mmap2", mmapFunc<PowerLinux> },
303 { 193,
"truncate64" },
305 { 195,
"stat64", stat64Func<PowerLinux> },
306 { 196,
"lstat64", lstat64Func<PowerLinux> },
307 { 197,
"fstat64", fstat64Func<PowerLinux> },
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.
Reference material can be found at the JEDEC website: UFS standard http://www.jedec....
SyscallReturn exitGroupFunc(SyscallDesc *desc, ThreadContext *tc, int status)
Target exit_group() handler: terminate simulation. (exit all threads)
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 chownFunc(SyscallDesc *desc, ThreadContext *tc, VPtr<> pathname, uint32_t owner, uint32_t group)
Target chown() 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 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 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 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()