44#include <sys/syscall.h>
64 load(
const ProcessParams ¶ms, loader::ObjectFile *obj)
override
66 auto arch = obj->getArch();
67 auto opsys = obj->getOpSys();
73 warn(
"Unknown operating system; assuming Linux.");
81 return new RiscvProcess64(params, obj);
83 return new RiscvProcess32(params, obj);
87LinuxLoader linuxLoader;
100 process->Process::syscall(tc);
115 strcpy(
name->sysname,
"Linux");
116 strcpy(
name->nodename,
"sim.gem5.org");
117 strcpy(
name->release, process->release.c_str());
118 strcpy(
name->version,
"#1 Mon Aug 18 11:32:15 EDT 2003");
119 strcpy(
name->machine,
"riscv64");
130 strcpy(
name->sysname,
"Linux");
131 strcpy(
name->nodename,
"sim.gem5.org");
132 strcpy(
name->release, process->release.c_str());
133 strcpy(
name->version,
"#1 Mon Aug 18 11:32:15 EDT 2003");
134 strcpy(
name->machine,
"riscv32");
142 assert(cpu < dstp->size * 8);
143 auto &
bits = dstp->
bits[cpu /
sizeof(uint64_t)];
150 assert(cpu < dstp->size * 8);
151 auto &
bits = dstp->
bits[cpu /
sizeof(uint64_t)];
158 assert(cpu < cpumask->size * 8);
159 return bits(cpumask->
bits[cpu /
sizeof(uint64_t)], cpu %
sizeof(uint64_t)) != 0;
168 for (
size_t i = 0;
i < dstp->
size /
sizeof(dstp->
bits[0]);
i++) {
176 for (
size_t i = 0;
i < dstp->
size /
sizeof(dstp->
bits[0]);
i++) {
177 if (dstp->
bits[
i] != 0) {
203 size_t size = (tc->
getSystemPtr()->threads.size() +
sizeof(cpumask->
bits[0]) - 1) /
204 sizeof(cpumask->
bits[0]) *
sizeof(cpumask->
bits[0]);
206 if (cpumask !=
nullptr) {
207 cpumask->
size = size;
217 free(cpu_online_mask);
243 if (pair->
key != other_pair->
key) {
258 if (cpu_online_mask !=
nullptr) {
261 CPU_SET(
i, (cpu_set_t *)&cpu_online_mask->
bits);
271 return cpu_online_mask;
291 RiscvLinux::key_base_behavior_t *base_behavior =
292 (RiscvLinux::key_base_behavior_t *)&pair->
value;
293 if (misa.rvi && misa.rvm && misa.rva) {
294 base_behavior->ima = 1;
301 RiscvLinux::key_ima_ext_0_t *
ext = (RiscvLinux::key_ima_ext_0_t *)&pair->
value;
302 if (misa.rvf && misa.rvd)
ext->FD = 1;
303 if (misa.rvc)
ext->C = 1;
304 if (misa.rvv)
ext->V = 1;
333 pair->
value = RiscvLinux::Slow;
357 typename OS::size_t cpusetsize,
VPtr<> cpus_user,
unsigned int flags)
365 if (cpu_online_mask ==
nullptr) {
370 if (cpus ==
nullptr) {
375 if (cpusetsize > cpu_online_mask->
size) {
376 cpusetsize = cpu_online_mask->
size;
387 if (cpusetsize == 0 && !cpus_user) {
389 cpusetsize = cpu_online_mask->
size;
391 BufferArg cpus_user_buf(cpus_user, cpusetsize);
394 cpu_online_mask->
size = cpusetsize;
395 cpus->
size = cpusetsize;
413 for (
size_t i = 0;
i < pair_count;
i++, pair++) {
429 typename OS::size_t cpusetsize,
VPtr<> cpus_user,
unsigned int flags)
435 if (cpusetsize == 0 || !cpus_user) {
440 if (cpu_online_mask ==
nullptr) {
445 if (cpus ==
nullptr) {
451 if (one_cpu ==
nullptr) {
457 if (cpusetsize > cpu_online_mask->
size) {
458 cpusetsize = cpu_online_mask->
size;
462 BufferArg cpus_user_buf(cpus_user, cpusetsize);
468 cpusetsize = cpu_online_mask->
size;
477 for (
size_t i = 0;
i < pair_count;
i++, pair++) {
480 memset(cpus_user_buf.
bufferPtr(), 0, cpusetsize);
487 for (
int cpu = 0; cpu < cpusetsize * 8; cpu++) {
517 typename OS::size_t pair_count,
typename OS::size_t cpusetsize,
518 VPtr<> cpus_user,
unsigned int flags)
534 { 4,
"io_getevents" },
542 { 12,
"llistxattr" },
543 { 13,
"flistxattr" },
544 { 14,
"removexattr" },
545 { 15,
"lremovexattr" },
546 { 16,
"fremovexattr" },
548 { 18,
"lookup_dcookie" },
550 { 20,
"epoll_create1" },
552 { 22,
"epoll_pwait" },
556 { 26,
"inotify_init1" },
557 { 27,
"inotify_add_watch" },
558 { 28,
"inotify_rm_watch" },
560 { 30,
"ioprio_get" },
561 { 31,
"ioprio_set" },
571 { 41,
"pivot_root" },
572 { 42,
"nfsservctl" },
591#if defined(SYS_getdents64)
592 { 61,
"getdents64", getdents64Func },
594 { 61,
"getdents64" },
607 { 74,
"signalfd64" },
617 { 84,
"sync_file_range2" },
618 { 85,
"timerfd_create" },
619 { 86,
"timerfd_settime" },
620 { 87,
"timerfd_gettime" },
625 { 92,
"personality" },
635 { 102,
"getitimer" },
636 { 103,
"setitimer" },
637 { 104,
"kexec_load" },
638 { 105,
"init_module" },
639 { 106,
"delete_module" },
640 { 107,
"timer_create" },
641 { 108,
"timer_gettime" },
642 { 109,
"timer_getoverrun" },
643 { 110,
"timer_settime" },
644 { 111,
"timer_delete" },
645 { 112,
"clock_settime" },
648 { 115,
"clock_nanosleep" },
651 { 118,
"sched_setparam" },
652 { 119,
"sched_setscheduler" },
653 { 120,
"sched_getscheduler" },
655 { 122,
"sched_setaffinity" },
658 { 125,
"sched_get_priority_max" },
659 { 126,
"sched_get_priority_min" },
660 { 127,
"scheD_rr_get_interval" },
661 { 128,
"restart_syscall" },
665 { 132,
"sigaltstack" },
673 { 140,
"setpriority" },
674 { 141,
"getpriority" },
680 { 147,
"setresuid" },
681 { 148,
"getresuid" },
682 { 149,
"getresgid" },
683 { 150,
"getresgid" },
691 { 158,
"getgroups" },
692 { 159,
"setgroups" },
694 { 161,
"sethostname" },
695 { 162,
"setdomainname" },
703 { 170,
"settimeofday" },
714 { 181,
"mq_unlink" },
715 { 182,
"mq_timedsend" },
716 { 183,
"mq_timedrecieve" },
717 { 184,
"mq_notify" },
718 { 185,
"mq_getsetattr" },
725 { 192,
"semtimedop" },
746 { 213,
"readahead" },
751 { 218,
"request_key" },
756 { 223,
"fadvise64" },
767 { 234,
"remap_file_pages" },
769 { 236,
"get_mempolicy" },
770 { 237,
"set_mempolicy" },
771 { 238,
"migrate_pages" },
772 { 239,
"move_pages" },
773 { 240,
"tgsigqueueinfo" },
774 { 241,
"perf_event_open" },
780 { 262,
"fanotify_init" },
781 { 263,
"fanotify_mark" },
782 { 264,
"name_to_handle_at" },
783 { 265,
"open_by_handle_at" },
784 { 266,
"clock_adjtime" },
788 { 270,
"process_vm_ready" },
789 { 271,
"process_vm_writev" },
791 { 273,
"finit_module" },
792 { 274,
"sched_setattr" },
793 { 275,
"sched_getattr" },
794 { 276,
"renameat2" },
797 { 279,
"memfd_create" },
800 { 282,
"userfaultid" },
801 { 283,
"membarrier" },
803 { 285,
"copy_file_range" },
806 { 424,
"pidfd_send_signal" },
807 { 425,
"io_uring_setup" },
808 { 426,
"io_uring_enter" },
809 { 427,
"io_uring_register" },
810 { 428,
"open_tree" },
811 { 429,
"move_mount" },
816 { 434,
"pidfd_open" },
818 { 436,
"close_range" },
820 { 438,
"pidfd_getfd" },
821 { 439,
"faccessat2" },
822 { 440,
"process_madvise" },
823 { 441,
"epoll_pwait2" },
824 { 442,
"mount_setattr" },
825 { 443,
"quotactl_fd" },
826 { 444,
"landlock_create_ruleset" },
827 { 445,
"landlock_add_rule" },
828 { 446,
"landlock_restrict_self" },
829 { 447,
"memfd_secret" },
830 { 448,
"process_mrelease" },
831 { 449,
"futex_waitv" },
832 { 450,
"set_mempolicy_home_node" },
851 { 1042,
"epoll_create" },
852 { 1043,
"inotifiy_init" },
854 { 1045,
"signalfd" },
855 { 1046,
"sendfile" },
862 { 1053,
"fadvise64" },
874#if defined(SYS_getdents)
875 { 1065,
"getdents", getdentsFunc },
877 { 1065,
"getdents" },
879 { 1066,
"futimesat" },
882 { 1069,
"epoll_wait" },
885 { 1072,
"oldwait4" },
893 { 2011,
"getmainvars" }
901 { 4,
"io_getevents" },
909 { 12,
"llistxattr" },
910 { 13,
"flistxattr" },
911 { 14,
"removexattr" },
912 { 15,
"lremovexattr" },
913 { 16,
"fremovexattr" },
915 { 18,
"lookup_dcookie" },
917 { 20,
"epoll_create1" },
919 { 22,
"epoll_pwait" },
923 { 26,
"inotify_init1" },
924 { 27,
"inotify_add_watch" },
925 { 28,
"inotify_rm_watch" },
927 { 30,
"ioprio_get" },
928 { 31,
"ioprio_set" },
938 { 41,
"pivot_root" },
939 { 42,
"nfsservctl" },
958#if defined(SYS_getdents64)
959 { 61,
"getdents64", getdents64Func },
961 { 61,
"getdents64" },
974 { 74,
"signalfd64" },
984 { 84,
"sync_file_range2" },
985 { 85,
"timerfd_create" },
986 { 86,
"timerfd_settime" },
987 { 87,
"timerfd_gettime" },
992 { 92,
"personality" },
1001 { 101,
"nanosleep" },
1002 { 102,
"getitimer" },
1003 { 103,
"setitimer" },
1004 { 104,
"kexec_load" },
1005 { 105,
"init_module" },
1006 { 106,
"delete_module" },
1007 { 107,
"timer_create" },
1008 { 108,
"timer_gettime" },
1009 { 109,
"timer_getoverrun" },
1010 { 110,
"timer_settime" },
1011 { 111,
"timer_delete" },
1012 { 112,
"clock_settime" },
1015 { 115,
"clock_nanosleep" },
1018 { 118,
"sched_setparam" },
1019 { 119,
"sched_setscheduler" },
1020 { 120,
"sched_getscheduler" },
1022 { 122,
"sched_setaffinity" },
1025 { 125,
"sched_get_priority_max" },
1026 { 126,
"sched_get_priority_min" },
1027 { 127,
"scheD_rr_get_interval" },
1028 { 128,
"restart_syscall" },
1032 { 132,
"sigaltstack" },
1040 { 140,
"setpriority" },
1041 { 141,
"getpriority" },
1043 { 143,
"setregid" },
1045 { 145,
"setreuid" },
1047 { 147,
"setresuid" },
1048 { 148,
"getresuid" },
1049 { 149,
"getresgid" },
1050 { 150,
"getresgid" },
1051 { 151,
"setfsuid" },
1052 { 152,
"setfsgid" },
1058 { 158,
"getgroups" },
1059 { 159,
"setgroups" },
1061 { 161,
"sethostname" },
1062 { 162,
"setdomainname" },
1070 { 170,
"settimeofday" },
1071 { 171,
"adjtimex" },
1081 { 181,
"mq_unlink" },
1082 { 182,
"mq_timedsend" },
1083 { 183,
"mq_timedrecieve" },
1084 { 184,
"mq_notify" },
1085 { 185,
"mq_getsetattr" },
1092 { 192,
"semtimedop" },
1113 { 213,
"readahead" },
1118 { 218,
"request_key" },
1123 { 223,
"fadvise64" },
1134 { 234,
"remap_file_pages" },
1136 { 236,
"get_mempolicy" },
1137 { 237,
"set_mempolicy" },
1138 { 238,
"migrate_pages" },
1139 { 239,
"move_pages" },
1140 { 240,
"tgsigqueueinfo" },
1141 { 241,
"perf_event_open" },
1143 { 243,
"recvmmsg" },
1147 { 262,
"fanotify_init" },
1148 { 263,
"fanotify_mark" },
1149 { 264,
"name_to_handle_at" },
1150 { 265,
"open_by_handle_at" },
1151 { 266,
"clock_adjtime" },
1154 { 269,
"sendmmsg" },
1155 { 270,
"process_vm_ready" },
1156 { 271,
"process_vm_writev" },
1158 { 273,
"finit_module" },
1159 { 274,
"sched_setattr" },
1160 { 275,
"sched_getattr" },
1161 { 276,
"renameat2" },
1164 { 279,
"memfd_create" },
1166 { 281,
"execveat" },
1167 { 282,
"userfaultid" },
1168 { 283,
"membarrier" },
1170 { 285,
"copy_file_range" },
1172 { 287,
"pwritev2" },
1191 { 1042,
"epoll_create" },
1192 { 1043,
"inotifiy_init" },
1194 { 1045,
"signalfd" },
1195 { 1046,
"sendfile" },
1202 { 1053,
"fadvise64" },
1214#if defined(SYS_getdents)
1215 { 1065,
"getdents", getdentsFunc },
1217 { 1065,
"getdents" },
1219 { 1066,
"futimesat" },
1222 { 1069,
"epoll_wait" },
1225 { 1072,
"oldwait4" },
1228 { 1075,
"bdflush" },
1233 { 2011,
"getmainvars" }
#define RISCV_HWPROBE_WHICH_CPUS
#define RISCV_HWPROBE_MAX_KEY
bool copyIn(const PortProxy &memproxy)
copy data into simulator space (read from target memory)
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.
Each instance of a Loader subclass will have a chance to try to load an object file when tryLoaders i...
std::shared_ptr< MemState > memState
static SyscallDescTable< SEWorkload::SyscallABI32 > syscallDescs32
32 bit syscall descriptors, indexed by call number.
void syscall(ThreadContext *tc) override
static SyscallDescTable< SEWorkload::SyscallABI64 > syscallDescs64
64 bit syscall descriptors, indexed by call number.
struct gem5::RiscvLinux::cpumask cpumask_t
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.
Addr cacheLineSize() const
Get the cache line size of the system.
ThreadContext is the external interface to all thread state for anything outside of the CPU.
virtual RegVal getReg(const RegId ®) const
virtual System * getSystemPtr()=0
virtual RegVal readMiscRegNoEffect(RegIndex misc_reg) const =0
virtual Process * getProcessPtr()=0
constexpr T bits(T val, unsigned first, unsigned last)
Extract the bitfield from position 'first' to 'last' (inclusive) from 'val' and right justify it.
constexpr T insertBits(T val, unsigned first, unsigned last, B bit_val)
Returns val with bits first to last set to the LSBs of bit_val.
static void cpumask_set_cpu(unsigned int cpu, RiscvLinux::cpumask_t *dstp)
static RiscvLinux::cpumask_t * get_cpu_online_mask(ThreadContext *tc)
static SyscallReturn riscvHWProbeFunc(SyscallDesc *desc, ThreadContext *tc, VPtr<> pairs, typename OS::size_t pair_count, typename OS::size_t cpusetsize, VPtr<> cpus_user, unsigned int flags)
static int hwprobe_get_values(ThreadContext *tc, VPtr<> pairs, typename OS::size_t pair_count, typename OS::size_t cpusetsize, VPtr<> cpus_user, unsigned int flags)
static void cpumask_copy(RiscvLinux::cpumask_t *dstp, const RiscvLinux::cpumask_t *srcp)
static SyscallReturn unameFunc32(SyscallDesc *desc, ThreadContext *tc, VPtr< Linux::utsname > name)
Target uname() handler.
static void cpumask_free(RiscvLinux::cpumask_t *cpu_online_mask)
static void cpumask_and(RiscvLinux::cpumask_t *dstp, const RiscvLinux::cpumask_t *src1p, const RiscvLinux::cpumask_t *src2p)
static bool cpumask_test_cpu(unsigned int cpu, const RiscvLinux::cpumask_t *cpumask)
static void cpumask_clear_cpu(unsigned int cpu, RiscvLinux::cpumask_t *dstp)
static void cpumask_clear(RiscvLinux::cpumask_t *dstp)
static bool riscv_hwprobe_pair_cmp(RiscvLinux::riscv_hwprobe *pair, RiscvLinux::riscv_hwprobe *other_pair)
const std::unordered_map< int, CSRMetadata > CSRData
static bool cpumask_empty(const RiscvLinux::cpumask_t *dstp)
static int hwprobe_get_cpus(ThreadContext *tc, VPtr<> pairs, typename OS::size_t pair_count, typename OS::size_t cpusetsize, VPtr<> cpus_user, unsigned int flags)
static void hwprobe_one_pair(ThreadContext *tc, RiscvLinux::riscv_hwprobe *pair, RiscvLinux::cpumask_t *cpus)
static bool hwprobe_key_is_bitmask(int64_t key)
static bool riscv_hwprobe_key_is_valid(int64_t key)
static RiscvLinux::cpumask_t * cpumask_malloc(ThreadContext *tc)
constexpr auto & SyscallNumReg
static SyscallReturn unameFunc64(SyscallDesc *desc, ThreadContext *tc, VPtr< Linux::utsname > name)
Target uname() handler.
Copyright (c) 2024 Arm Limited All rights reserved.
SyscallReturn linkFunc(SyscallDesc *desc, ThreadContext *tc, VPtr<> pathname, VPtr<> new_pathname)
Target link() handler.
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 gettidFunc(SyscallDesc *desc, ThreadContext *tc)
Target gettid() handler.
SyscallReturn getrandomFunc(SyscallDesc *desc, ThreadContext *tc, VPtr<> buf_ptr, typename OS::size_t count, unsigned int flags)
SyscallReturn recvmsgFunc(SyscallDesc *desc, ThreadContext *tc, int tgt_fd, VPtr<> msgPtr, int flags)
SyscallReturn fstat64Func(SyscallDesc *desc, ThreadContext *tc, int tgt_fd, VPtr< typename OS::tgt_stat64 > tgt_stat)
Target fstat64() handler.
SyscallReturn wait4Func(SyscallDesc *desc, ThreadContext *tc, pid_t pid, VPtr<> statPtr, int options, VPtr<> rusagePtr)
SyscallReturn clock_gettimeFunc(SyscallDesc *desc, ThreadContext *tc, int clk_id, VPtr< typename OS::timespec > tp)
Target clock_gettime() function.
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 pipe2Func(SyscallDesc *desc, ThreadContext *tc, VPtr<> tgt_addr, int flags)
Target pipe() handler.
SyscallReturn getpidFunc(SyscallDesc *desc, ThreadContext *tc)
Target getpid() handler.
SyscallReturn chdirFunc(SyscallDesc *desc, ThreadContext *tc, VPtr<> pathname)
Target chdir() handler.
SyscallReturn fstatFunc(SyscallDesc *desc, ThreadContext *tc, int tgt_fd, VPtr< typename OS::tgt_stat > tgt_stat)
Target fstat() handler.
SyscallReturn truncate64Func(SyscallDesc *desc, ThreadContext *tc, VPtr<> pathname, int64_t length)
Target truncate64() handler.
SyscallReturn getuidFunc(SyscallDesc *desc, ThreadContext *tc)
SyscallReturn pwrite64Func(SyscallDesc *desc, ThreadContext *tc, int tgt_fd, VPtr<> bufPtr, typename OS::size_t nbytes, typename OS::off_t offset)
SyscallReturn getrusageFunc(SyscallDesc *desc, ThreadContext *tc, int who, VPtr< typename OS::rusage > rup)
Target getrusage() function.
SyscallReturn recvfromFunc(SyscallDesc *desc, ThreadContext *tc, int tgt_fd, VPtr<> buf_ptr, typename OS::size_t buf_len, int flags, VPtr<> addr_ptr, VPtr<> addrlen_ptr)
SyscallReturn selectFunc(SyscallDesc *desc, ThreadContext *tc, int nfds, VPtr< typename OS::fd_set > readfds, VPtr< typename OS::fd_set > writefds, VPtr< typename OS::fd_set > errorfds, VPtr< typename OS::timeval > timeout)
SyscallReturn utimesFunc(SyscallDesc *desc, ThreadContext *tc, VPtr<> pathname, VPtr< typename OS::timeval[2]> tp)
Target utimes() handler.
SyscallReturn socketFunc(SyscallDesc *desc, ThreadContext *tc, int domain, int type, int prot)
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 renameFunc(SyscallDesc *desc, ThreadContext *tc, VPtr<> oldpath, VPtr<> newpath)
Target rename() handler.
SyscallReturn mknodFunc(SyscallDesc *desc, ThreadContext *tc, VPtr<> pathname, mode_t mode, dev_t dev)
Target mknod() handler.
SyscallReturn setpgidFunc(SyscallDesc *desc, ThreadContext *tc, int pid, int pgid)
Target setpgid() 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 symlinkFunc(SyscallDesc *desc, ThreadContext *tc, VPtr<> pathname, VPtr<> new_pathname)
Target symlink() 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 gettimeofdayFunc(SyscallDesc *desc, ThreadContext *tc, VPtr< typename OS::timeval > tp, VPtr<> tz_ptr)
Target gettimeofday() handler.
SyscallReturn unlinkatFunc(SyscallDesc *desc, ThreadContext *tc, int dirfd, VPtr<> pathname, int flags)
Target unlinkat() handler.
SyscallReturn pipeFunc(SyscallDesc *desc, ThreadContext *tc, VPtr<> tgt_addr)
Target pipe() handler.
SyscallReturn prlimitFunc(SyscallDesc *desc, ThreadContext *tc, int pid, int resource, VPtr<> n, VPtr< typename OS::rlimit > rlp)
SyscallReturn clock_getresFunc(SyscallDesc *desc, ThreadContext *tc, int clk_id, VPtr< typename OS::timespec > tp)
Target clock_getres() function.
SyscallReturn faccessatFunc(SyscallDesc *desc, ThreadContext *tc, int dirfd, VPtr<> pathname, int mode)
Target facessat() handler.
SyscallReturn getsockoptFunc(SyscallDesc *desc, ThreadContext *tc, int tgt_fd, int level, int optname, VPtr<> valPtr, VPtr<> lenPtr)
SyscallReturn getrlimitFunc(SyscallDesc *desc, ThreadContext *tc, unsigned resource, VPtr< typename OS::rlimit > rlp)
Target getrlimit() handler.
SyscallReturn mknodatFunc(SyscallDesc *desc, ThreadContext *tc, int dirfd, VPtr<> pathname, mode_t mode, dev_t dev)
Target mknodat() handler.
SyscallReturn fallocateFunc(SyscallDesc *desc, ThreadContext *tc, int tgt_fd, int mode, typename OS::off_t offset, typename OS::off_t len)
SyscallReturn fcntl64Func(SyscallDesc *desc, ThreadContext *tc, int tgt_fd, int cmd)
Target fcntl64() handler.
SyscallReturn ignoreWarnOnceFunc(SyscallDesc *desc, ThreadContext *tc)
Like above, but only prints a warning once per syscall desc it's used with.
SyscallReturn socketpairFunc(SyscallDesc *desc, ThreadContext *tc, int domain, int type, int prot, VPtr<> svPtr)
SyscallReturn ftruncateFunc(SyscallDesc *desc, ThreadContext *tc, int tgt_fd, typename OS::off_t length)
Target ftruncate() handler.
SyscallReturn statfsFunc(SyscallDesc *desc, ThreadContext *tc, VPtr<> pathname, VPtr< typename OS::tgt_statfs > tgt_stat)
Target statfs() handler.
SyscallReturn setsockoptFunc(SyscallDesc *desc, ThreadContext *tc, int tgt_fd, int level, int optname, VPtr<> valPtr, socklen_t len)
SyscallReturn lstatFunc(SyscallDesc *desc, ThreadContext *tc, VPtr<> pathname, VPtr< typename OS::tgt_stat > tgt_stat)
Target lstat() handler.
SyscallReturn rmdirFunc(SyscallDesc *desc, ThreadContext *tc, VPtr<> pathname)
SyscallReturn mkdirFunc(SyscallDesc *desc, ThreadContext *tc, VPtr<> pathname, mode_t mode)
Target mkdir() handler.
SyscallReturn readlinkatFunc(SyscallDesc *desc, ThreadContext *tc, int dirfd, VPtr<> pathname, VPtr<> buf_ptr, typename OS::size_t bufsiz)
Target readlinkat() handler.
SyscallReturn getpgrpFunc(SyscallDesc *desc, ThreadContext *tc)
Target getpgrpFunc() handler.
SyscallReturn eventfdFunc(SyscallDesc *desc, ThreadContext *tc, unsigned initval, int in_flags)
Target eventfd() function.
SyscallReturn dupFunc(SyscallDesc *desc, ThreadContext *tc, int tgt_fd)
FIXME: The file description is not shared among file descriptors created with dup.
SyscallReturn listenFunc(SyscallDesc *desc, ThreadContext *tc, int tgt_fd, int backlog)
SyscallReturn ftruncate64Func(SyscallDesc *desc, ThreadContext *tc, int tgt_fd, int64_t length)
Target ftruncate64() handler.
SyscallReturn getcwdFunc(SyscallDesc *desc, ThreadContext *tc, VPtr<> buf_ptr, typename OS::size_t size)
Target getcwd() handler.
SyscallReturn openatFunc(SyscallDesc *desc, ThreadContext *tc, int tgt_dirfd, VPtr<> pathname, int tgt_flags, int mode)
Target open() 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 pread64Func(SyscallDesc *desc, ThreadContext *tc, int tgt_fd, VPtr<> bufPtr, typename OS::size_t nbytes, typename OS::off_t offset)
SyscallReturn setTidAddressFunc(SyscallDesc *desc, ThreadContext *tc, VPtr<> tidPtr)
Target set_tid_address() 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 schedGetaffinityFunc(SyscallDesc *desc, ThreadContext *tc, pid_t pid, typename OS::size_t cpusetsize, VPtr<> cpu_set_mask)
Target sched_getaffinity.
SyscallReturn bindFunc(SyscallDesc *desc, ThreadContext *tc, int tgt_fd, VPtr<> buf_ptr, int addrlen)
SyscallReturn pollFunc(SyscallDesc *desc, ThreadContext *tc, VPtr<> fdsPtr, int nfds, int tmout)
SyscallReturn getegidFunc(SyscallDesc *desc, ThreadContext *tc)
Target getegid() handler.
SyscallReturn timeFunc(SyscallDesc *desc, ThreadContext *tc, VPtr<> taddr)
Target time() function.
SyscallReturn newfstatatFunc(SyscallDesc *desc, ThreadContext *tc, int dirfd, VPtr<> pathname, VPtr< typename OS::tgt_stat64 > tgt_stat, int flags)
Target newfstatat() handler.
SyscallReturn fchmodFunc(SyscallDesc *desc, ThreadContext *tc, int tgt_fd, uint32_t mode)
Target fchmod() handler.
SyscallReturn shutdownFunc(SyscallDesc *desc, ThreadContext *tc, int tgt_fd, int how)
Target shutdown() handler.
SyscallReturn renameatFunc(SyscallDesc *desc, ThreadContext *tc, int olddirfd, VPtr<> oldpath, int newdirfd, VPtr<> newpath)
Target renameat() handler.
SyscallReturn getcpuFunc(SyscallDesc *desc, ThreadContext *tc, VPtr< uint32_t > cpu, VPtr< uint32_t > node, VPtr< uint32_t > tcache)
SyscallReturn getsocknameFunc(SyscallDesc *desc, ThreadContext *tc, int tgt_fd, VPtr<> addrPtr, VPtr<> lenPtr)
SyscallReturn clone3Func(SyscallDesc *desc, ThreadContext *tc, VPtr< typename OS::tgt_clone_args > cl_args, RegVal size)
SyscallReturn ioctlFunc(SyscallDesc *desc, ThreadContext *tc, int tgt_fd, unsigned req, VPtr<> addr)
Target ioctl() handler.
SyscallReturn getpeernameFunc(SyscallDesc *desc, ThreadContext *tc, int tgt_fd, VPtr<> sockAddrPtr, VPtr<> addrlenPtr)
SyscallReturn accessFunc(SyscallDesc *desc, ThreadContext *tc, VPtr<> pathname, mode_t mode)
Target access() handler.
SyscallReturn tgkillFunc(SyscallDesc *desc, ThreadContext *tc, int tgid, int tid, int sig)
SyscallReturn sendmsgFunc(SyscallDesc *desc, ThreadContext *tc, int tgt_fd, VPtr<> msgPtr, int flags)
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 fstatat64Func(SyscallDesc *desc, ThreadContext *tc, int dirfd, VPtr<> pathname, VPtr< typename OS::tgt_stat64 > tgt_stat)
Target fstatat64() handler.
SyscallReturn ignoreFunc(SyscallDesc *desc, ThreadContext *tc)
Handler for unimplemented syscalls that we never intend to implement (signal handling,...
SyscallReturn acceptFunc(SyscallDesc *desc, ThreadContext *tc, int tgt_fd, VPtr<> addrPtr, VPtr<> lenPtr)
SyscallReturn futexFunc(SyscallDesc *desc, ThreadContext *tc, VPtr<> uaddr, int op, int val, int timeout, VPtr<> uaddr2, int val3)
Futex system call Implemented by Daniel Sanchez Used by printf's in multi-threaded apps.
SyscallReturn fstatfsFunc(SyscallDesc *desc, ThreadContext *tc, int tgt_fd, VPtr< typename OS::tgt_statfs > tgt_stat)
Target fstatfs() handler.
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 stat64Func(SyscallDesc *desc, ThreadContext *tc, VPtr<> pathname, VPtr< typename OS::tgt_stat64 > tgt_stat)
Target stat64() handler.
SyscallReturn connectFunc(SyscallDesc *desc, ThreadContext *tc, int tgt_fd, VPtr<> buf_ptr, int addrlen)
SyscallReturn execveFunc(SyscallDesc *desc, ThreadContext *tc, VPtr<> pathname, VPtr<> argv_mem_loc, VPtr<> envp_mem_loc)
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 dup2Func(SyscallDesc *desc, ThreadContext *tc, int old_tgt_fd, int new_tgt_fd)
Target dup2() handler.
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.
SyscallReturn sendtoFunc(SyscallDesc *desc, ThreadContext *tc, int tgt_fd, VPtr<> buf_ptr, typename OS::size_t buf_len, int flags, VPtr<> addr_ptr, socklen_t addr_len)
SyscallReturn mkdiratFunc(SyscallDesc *desc, ThreadContext *tc, int dirfd, VPtr<> pathname, mode_t mode)
Target mkdirat() handler.
This file defines objects used to emulate syscalls from the target application on the host machine.
const std::string & name()