summaryrefslogtreecommitdiff
path: root/sim/syscall_emul.cc
diff options
context:
space:
mode:
authorSteve Reinhardt <stever@eecs.umich.edu>2005-06-03 16:19:34 -0400
committerSteve Reinhardt <stever@eecs.umich.edu>2005-06-03 16:19:34 -0400
commit22eccce34ba7d803d3f46ffeef80925a5e5ff2e3 (patch)
treeeac58d1958dd5f37b6ed20e4b952ac354ec4981f /sim/syscall_emul.cc
parent890e37ecd9bd9cf3d1b6abb61bb07447747a977d (diff)
downloadgem5-22eccce34ba7d803d3f46ffeef80925a5e5ff2e3.tar.xz
Additions/fixes for Tru64 syscall emulation.
We can now run the SimpleScalar wupwise binary to completion on the test input. Didn't have time to do more testing, but I fixed a major problem w/getdirentries that should help a lot more programs run. arch/alpha/alpha_tru64_process.cc: Add truncate, ftruncate, statfs, and fstatfs. Add v4.x (pre-F64) stat, fstat, and lstat. Add setsysinfo (though all it does is provide more specific warning messages). Fix subtle but major bug in getdirentries. sim/syscall_emul.cc: sim/syscall_emul.hh: Add truncate, ftruncate, statfs, and fstatfs. --HG-- extra : convert_revision : 9037393d00dc49b0074a41603ea647587f5a9ec7
Diffstat (limited to 'sim/syscall_emul.cc')
-rw-r--r--sim/syscall_emul.cc35
1 files changed, 31 insertions, 4 deletions
diff --git a/sim/syscall_emul.cc b/sim/syscall_emul.cc
index 22d62e4d1..13df2b7a2 100644
--- a/sim/syscall_emul.cc
+++ b/sim/syscall_emul.cc
@@ -193,7 +193,7 @@ gethostnameFunc(SyscallDesc *desc, int num, Process *p, ExecContext *xc)
SyscallReturn
unlinkFunc(SyscallDesc *desc, int num, Process *p, ExecContext *xc)
{
- std::string path;
+ string path;
if (xc->mem->readString(path, xc->getSyscallArg(0)) != No_Fault)
return (TheISA::IntReg)-EFAULT;
@@ -205,17 +205,44 @@ unlinkFunc(SyscallDesc *desc, int num, Process *p, ExecContext *xc)
SyscallReturn
renameFunc(SyscallDesc *desc, int num, Process *p, ExecContext *xc)
{
- std::string old_name;
+ string old_name;
if (xc->mem->readString(old_name, xc->getSyscallArg(0)) != No_Fault)
return -EFAULT;
- std::string new_name;
+ string new_name;
if (xc->mem->readString(new_name, xc->getSyscallArg(1)) != No_Fault)
return -EFAULT;
- int64_t result = rename(old_name.c_str(),new_name.c_str());
+ int64_t result = rename(old_name.c_str(), new_name.c_str());
return (result == -1) ? -errno : result;
}
+SyscallReturn
+truncateFunc(SyscallDesc *desc, int num, Process *p, ExecContext *xc)
+{
+ string path;
+
+ if (xc->mem->readString(path, xc->getSyscallArg(0)) != No_Fault)
+ return -EFAULT;
+
+ off_t length = xc->getSyscallArg(1);
+
+ int result = truncate(path.c_str(), length);
+ return (result == -1) ? -errno : result;
+}
+
+SyscallReturn
+ftruncateFunc(SyscallDesc *desc, int num, Process *process, ExecContext *xc)
+{
+ int fd = process->sim_fd(xc->getSyscallArg(0));
+
+ if (fd < 0)
+ return -EBADF;
+
+ off_t length = xc->getSyscallArg(1);
+
+ int result = ftruncate(fd, length);
+ return (result == -1) ? -errno : result;
+}