summaryrefslogtreecommitdiff
path: root/src/sim/syscall_emul.hh
diff options
context:
space:
mode:
authorTony Gutierrez <anthony.gutierrez@amd.com>2016-08-04 12:32:21 -0400
committerTony Gutierrez <anthony.gutierrez@amd.com>2016-08-04 12:32:21 -0400
commit0b68475b102a9ecc769d1a3493a34055e08c2e7e (patch)
tree57f62500e90ec13cb02ae741e008742d97f2bdde /src/sim/syscall_emul.hh
parent8eb9cf8e944dac240c135cd2baff261e90c0c2b9 (diff)
downloadgem5-0b68475b102a9ecc769d1a3493a34055e08c2e7e.tar.xz
x86, sim: add some syscalls to X86
this patch adds an implementation for the pwrite64 syscall and enables it for x86_64, and enables fstatfs for x86_64.
Diffstat (limited to 'src/sim/syscall_emul.hh')
-rw-r--r--src/sim/syscall_emul.hh22
1 files changed, 22 insertions, 0 deletions
diff --git a/src/sim/syscall_emul.hh b/src/sim/syscall_emul.hh
index e9ed130f0..906a01edb 100644
--- a/src/sim/syscall_emul.hh
+++ b/src/sim/syscall_emul.hh
@@ -1389,6 +1389,28 @@ mmapImpl(SyscallDesc *desc, int num, LiveProcess *p, ThreadContext *tc,
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