/* 15 */ SyscallDesc("rt_sigreturn", unimplementedFunc),
/* 16 */ SyscallDesc("ioctl", ioctlFunc<X86Linux64>),
/* 17 */ SyscallDesc("pread64", unimplementedFunc),
- /* 18 */ SyscallDesc("pwrite64", unimplementedFunc),
+ /* 18 */ SyscallDesc("pwrite64", pwrite64Func<X86Linux64>),
/* 19 */ SyscallDesc("readv", unimplementedFunc),
/* 20 */ SyscallDesc("writev", writevFunc<X86Linux64>),
/* 21 */ SyscallDesc("access", ignoreFunc),
/* 135 */ SyscallDesc("personality", unimplementedFunc),
/* 136 */ SyscallDesc("ustat", unimplementedFunc),
/* 137 */ SyscallDesc("statfs", unimplementedFunc),
- /* 138 */ SyscallDesc("fstatfs", unimplementedFunc),
+ /* 138 */ SyscallDesc("fstatfs", fstatfsFunc<X86Linux64>),
/* 139 */ SyscallDesc("sysfs", unimplementedFunc),
/* 140 */ SyscallDesc("getpriority", unimplementedFunc),
/* 141 */ SyscallDesc("setpriority", unimplementedFunc),
return start;
}
+template <class OS>
+SyscallReturn
+pwrite64Func(SyscallDesc *desc, int num, LiveProcess *p, ThreadContext *tc)
+{
+ int index = 0;
+ int tgt_fd = p->getSyscallArg(tc, index);
+ Addr bufPtr = p->getSyscallArg(tc, index);
+ int nbytes = p->getSyscallArg(tc, index);
+ int offset = p->getSyscallArg(tc, index);
+
+ int sim_fd = p->getSimFD(tgt_fd);
+ if (sim_fd < 0)
+ return -EBADF;
+
+ BufferArg bufArg(bufPtr, nbytes);
+ bufArg.copyIn(tc->getMemProxy());
+
+ int bytes_written = pwrite64(sim_fd, bufArg.bufferPtr(), nbytes, offset);
+
+ return (bytes_written == -1) ? -errno : bytes_written;
+}
+
/// Target mmap() handler.
template <class OS>
SyscallReturn