49 strcpy(
name->sysname,
"Linux");
50 strcpy(
name->nodename,
"sim.gem5.org");
51 strcpy(
name->release, process->release.c_str());
52 strcpy(
name->version,
"#1 Mon Aug 18 11:32:15 EDT 2003");
53 strcpy(
name->machine,
"sparc");
64 const uint64_t
id =
htobe(100);
68 BufferArg ruidBuff(ruid,
sizeof(uint64_t));
69 memcpy(ruidBuff.
bufferPtr(), &
id,
sizeof(uint64_t));
74 BufferArg euidBuff(euid,
sizeof(uint64_t));
75 memcpy(euidBuff.
bufferPtr(), &
id,
sizeof(uint64_t));
80 BufferArg suidBuff(suid,
sizeof(uint64_t));
81 memcpy(suidBuff.
bufferPtr(), &
id,
sizeof(uint64_t));
88 { 0,
"restart_syscall" },
116 { 28,
"sigaltstack" },
140 { 52,
"memory_ordering" },
152 { 64,
"getpagesize" },
160 { 72,
"setreuid32" },
165 { 77,
"truncate64" },
170 { 82,
"setgroups32" },
172 { 84,
"ftruncate64" },
176 { 88,
"sethostname" },
179 { 91,
"setfsuid32" },
182 { 94,
"setfsgid32" },
184 { 96,
"setpriority" },
188 { 100,
"getpriority" },
189 { 101,
"rt_sigreturn" },
192 { 104,
"rt_sigpending" },
193 { 105,
"rt_sigtimedwait" },
194 { 106,
"rt_sigqueueinfo" },
195 { 107,
"rt_sigsuspend" },
196 { 108,
"setresuid32" },
199 { 111,
"getresgid32" },
200 { 112,
"setregid32" },
203 { 115,
"getgroups32" },
205 { 117,
"getrusage" },
206 { 118,
"getsockopt" },
210 { 122,
"settimeofday" },
218 { 130,
"ftruncate" },
223 { 135,
"socketpair" },
228 { 140,
"sendfile64" },
229 { 141,
"getpeername" },
232 { 144,
"getrlimit" },
233 { 145,
"setrlimit" },
234 { 146,
"pivot_root" },
236 { 148,
"pciconfig_read" },
237 { 149,
"pciconfig_write" },
238 { 150,
"getsockname" },
239 { 151,
"inotify_init" },
240 { 152,
"inotify_add_watch" },
242 { 154,
"getdents64" },
244 { 156,
"inotify_rm_watch" },
248 { 160,
"sched_setaffinity" },
249 { 161,
"sched_getaffinity" },
250 { 162,
"getdomainname" },
251 { 163,
"setdomainname" },
252 { 164,
"ni_syscall" },
254 { 166,
"set_tid_address" },
258 { 170,
"lsetxattr" },
259 { 171,
"fsetxattr" },
261 { 173,
"lgetxattr" },
265 { 177,
"fgetxattr" },
266 { 178,
"listxattr" },
267 { 179,
"llistxattr" },
268 { 180,
"flistxattr" },
269 { 181,
"removexattr" },
270 { 182,
"lremovexattr" },
271 { 183,
"sigpending" },
272 { 184,
"query_module" },
274 { 186,
"fremovexattr" },
278 { 190,
"init_module" },
279 { 191,
"personality" },
280 { 192,
"remap_file_pages" },
281 { 193,
"epoll_create" },
282 { 194,
"epoll_ctl" },
283 { 195,
"epoll_wait" },
284 { 196,
"ioprio_set" },
286 { 198,
"sigaction" },
289 { 201,
"sigsuspend" },
293 { 205,
"readahead" },
294 { 206,
"socketcall" },
296 { 208,
"lookup_dcookie" },
297 { 209,
"fadvise64" },
298 { 210,
"fadvise64_64" },
304 { 216,
"sigreturn" },
306 { 218,
"ioprio_get" },
308 { 220,
"sigprocmask" },
309 { 221,
"create_module" },
310 { 222,
"delete_module" },
311 { 223,
"get_kernel_syms" },
315 { 227,
"afs_syscall" },
318 { 230,
"_newselect" },
323 { 235,
"fstatfs64" },
328 { 240,
"munlockall" },
329 { 241,
"sched_setparam" },
330 { 242,
"sched_getparam" },
331 { 243,
"sched_setscheduler" },
332 { 244,
"sched_getscheduler" },
333 { 245,
"sched_yield" },
334 { 246,
"sched_get_priority_max" },
335 { 247,
"sched_get_priority_min" },
336 { 248,
"sched_rr_get_interval" },
337 { 249,
"nanosleep" },
341 { 253,
"fdatasync" },
342 { 254,
"nfsservctl" },
344 { 256,
"clock_settime" },
345 { 257,
"clock_gettime" },
346 { 258,
"clock_getres" },
347 { 259,
"clock_nanosleep" },
348 { 260,
"sched_getaffinity" },
349 { 261,
"sched_setaffinity" },
350 { 262,
"timer_settime" },
351 { 263,
"timer_gettime" },
352 { 264,
"timer_getoverrun" },
353 { 265,
"timer_delete" },
354 { 266,
"timer_create" },
357 { 269,
"io_destroy" },
358 { 270,
"io_submit" },
359 { 271,
"io_cancel" },
360 { 272,
"io_getevents" },
362 { 274,
"mq_unlink" },
363 { 275,
"mq_timedsend" },
364 { 276,
"mq_timedreceive" },
365 { 277,
"mq_notify" },
366 { 278,
"mq_getsetattr" },
368 { 280,
"sys_setaltroot" },
370 { 282,
"request_key" },
376 { 288,
"futimesat" },
377 { 289,
"fstatat64" },
381 { 293,
"symlinkat" },
382 { 294,
"readlinkat" },
384 { 296,
"faccessat" },
391 { 0,
"restart_syscall" },
419 { 28,
"sigaltstack" },
443 { 52,
"memory_ordering" },
455 { 64,
"getpagesize" },
463 { 72,
"setreuid32" },
468 { 77,
"truncate64" },
473 { 82,
"setgroups32" },
475 { 84,
"ftruncate64" },
479 { 88,
"sethostname" },
482 { 91,
"setfsuid32" },
485 { 94,
"setfsgid32" },
487 { 96,
"setpriority" },
491 { 100,
"getpriority" },
492 { 101,
"rt_sigreturn" },
495 { 104,
"rt_sigpending" },
496 { 105,
"rt_sigtimedwait" },
497 { 106,
"rt_sigqueueinfo" },
498 { 107,
"rt_sigsuspend" },
499 { 108,
"setresuid" },
502 { 111,
"getresgid" },
503 { 112,
"setregid32" },
506 { 115,
"getgroups32" },
508 { 117,
"getrusage" },
509 { 118,
"getsockopt" },
513 { 122,
"settimeofday" },
521 { 130,
"ftruncate" },
526 { 135,
"socketpair" },
531 { 140,
"sendfile64" },
532 { 141,
"getpeername" },
535 { 144,
"getrlimit" },
536 { 145,
"setrlimit" },
537 { 146,
"pivot_root" },
539 { 148,
"pciconfig_read" },
540 { 149,
"pciconfig_write" },
541 { 150,
"getsockname" },
542 { 151,
"inotify_init" },
543 { 152,
"inotify_add_watch" },
545 { 154,
"getdents64" },
547 { 156,
"inotify_rm_watch" },
551 { 160,
"sched_set_affinity" },
552 { 161,
"sched_get_affinity" },
553 { 162,
"getdomainname" },
554 { 163,
"setdomainname" },
555 { 164,
"utrap_install" },
557 { 166,
"set_tid_address" },
561 { 170,
"lsetxattr" },
562 { 171,
"fsetxattr" },
564 { 173,
"lgetxattr" },
568 { 177,
"fgetxattr" },
569 { 178,
"listxattr" },
570 { 179,
"llistxattr" },
571 { 180,
"flistxattr" },
572 { 181,
"removexattr" },
573 { 182,
"lremovexattr" },
574 { 183,
"sigpending" },
575 { 184,
"query_module" },
577 { 186,
"fremovexattr" },
581 { 190,
"init_module" },
582 { 191,
"personality" },
583 { 192,
"remap_file_pages" },
584 { 193,
"epoll_create" },
585 { 194,
"epoll_ctl" },
586 { 195,
"epoll_wait" },
587 { 196,
"ioprio_set" },
592 { 201,
"sigsuspend" },
596 { 205,
"readahead" },
597 { 206,
"socketcall" },
599 { 208,
"lookup_dcookie" },
600 { 209,
"fadvise64" },
601 { 210,
"fadvise64_64" },
607 { 216,
"sigreturn" },
609 { 218,
"ioprio_get" },
611 { 220,
"sigprocmask" },
612 { 221,
"create_module" },
613 { 222,
"delete_module" },
614 { 223,
"get_kernel_syms" },
618 { 227,
"afs_syscall" },
621 { 230,
"_newselect" },
626 { 235,
"fstatfs64" },
631 { 240,
"munlockall" },
632 { 241,
"sched_setparam" },
633 { 242,
"sched_getparam" },
634 { 243,
"sched_setscheduler" },
635 { 244,
"sched_getscheduler" },
636 { 245,
"sched_yield" },
637 { 246,
"sched_get_priority_max" },
638 { 247,
"sched_get_priority_min" },
639 { 248,
"sched_rr_get_interval" },
640 { 249,
"nanosleep" },
644 { 253,
"fdatasync" },
645 { 254,
"nfsservctl" },
647 { 256,
"clock_settime" },
648 { 257,
"clock_gettime" },
649 { 258,
"clock_getres" },
650 { 259,
"clock_nanosleep" },
651 { 260,
"sched_getaffinity" },
652 { 261,
"sched_setaffinity" },
653 { 262,
"timer_settime" },
654 { 263,
"timer_gettime" },
655 { 264,
"timer_getoverrun" },
656 { 265,
"timer_delete" },
657 { 266,
"timer_create" },
660 { 269,
"io_destroy" },
661 { 270,
"io_submit" },
662 { 271,
"io_cancel" },
663 { 272,
"io_getevents" },
665 { 274,
"mq_unlink" },
666 { 275,
"mq_timedsend" },
667 { 276,
"mq_timedreceive" },
668 { 277,
"mq_notify" },
669 { 278,
"mq_getsetattr" },
671 { 280,
"sys_setaltroot" },
673 { 282,
"request_key" },
bool copyOut(const PortProxy &memproxy)
copy data out of simulator space (write to target memory)
BufferArg represents an untyped buffer in target user space that is passed by reference to an (emulat...
void * bufferPtr()
Return a pointer to the internal simulator-space buffer.
static SyscallDescTable< SEWorkload::SyscallABI64 > syscallDescs
64 bit syscall descriptors, indexed by call number.
static SyscallDescTable< SEWorkload::SyscallABI32 > syscall32Descs
32 bit compatibility syscall descriptors, indexed by call number.
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 Process * getProcessPtr()=0
static SyscallReturn getresuidFunc(SyscallDesc *desc, ThreadContext *tc, VPtr<> ruid, VPtr<> euid, VPtr<> suid)
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 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 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 cloneFunc(SyscallDesc *desc, ThreadContext *tc, RegVal flags, RegVal newStack, VPtr<> ptidPtr, VPtr<> ctidPtr, VPtr<> tlsPtr)
SyscallReturn readFunc(SyscallDesc *desc, ThreadContext *tc, int tgt_fd, VPtr<> buf_ptr, int nbytes)
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 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 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 sysinfoFunc(SyscallDesc *desc, ThreadContext *tc, VPtr< typename OS::tgt_sysinfo > sysinfo)
Target sysinfo() handler.
SyscallReturn gettimeofdayFunc(SyscallDesc *desc, ThreadContext *tc, VPtr< typename OS::timeval > tp, VPtr<> tz_ptr)
Target gettimeofday() handler.
SyscallReturn mkdirFunc(SyscallDesc *desc, ThreadContext *tc, VPtr<> pathname, mode_t mode)
Target mkdir() 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 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 lseekFunc(SyscallDesc *desc, ThreadContext *tc, int tgt_fd, uint64_t offs, int whence)
Target lseek() handler.
SyscallReturn mremapFunc(SyscallDesc *desc, ThreadContext *tc, VPtr<> start, uint64_t old_length, uint64_t new_length, uint64_t flags, guest_abi::VarArgs< uint64_t > varargs)
Target mremap() 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 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.
This file defines objects used to emulate syscalls from the target application on the host machine.
const std::string & name()