summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAli Saidi <saidi@eecs.umich.edu>2007-09-13 12:30:12 -0400
committerAli Saidi <saidi@eecs.umich.edu>2007-09-13 12:30:12 -0400
commite282d9601cb515f59eeb1701ec990f0985001ba9 (patch)
tree266868569fba255017c79afd666180e96a0b53b2
parent136cb057d405449593f54c38bdd40046d70e587f (diff)
downloadgem5-e282d9601cb515f59eeb1701ec990f0985001ba9.tar.xz
Syscall Emulation: Add stat64 syscall.
Patch submitted by: Jonas Diemer [diemer (a) ida.ing.tu-bs.de] --HG-- extra : convert_revision : 07638c05bb3f79aacce49457bbb8c17d0a3a7238
-rw-r--r--src/arch/alpha/linux/process.cc2
-rw-r--r--src/sim/syscall_emul.hh26
2 files changed, 27 insertions, 1 deletions
diff --git a/src/arch/alpha/linux/process.cc b/src/arch/alpha/linux/process.cc
index f7d946e2e..b638aa927 100644
--- a/src/arch/alpha/linux/process.cc
+++ b/src/arch/alpha/linux/process.cc
@@ -549,7 +549,7 @@ SyscallDesc AlphaLinuxProcess::syscallDescs[] = {
/* 422 */ SyscallDesc("clock_nanosleep", unimplementedFunc),
/* 423 */ SyscallDesc("semtimedop", unimplementedFunc),
/* 424 */ SyscallDesc("tgkill", unimplementedFunc),
- /* 425 */ SyscallDesc("stat64", unimplementedFunc),
+ /* 425 */ SyscallDesc("stat64", stat64Func<AlphaLinux>),
/* 426 */ SyscallDesc("lstat64", lstat64Func<AlphaLinux>),
/* 427 */ SyscallDesc("fstat64", fstat64Func<AlphaLinux>),
/* 428 */ SyscallDesc("vserver", unimplementedFunc),
diff --git a/src/sim/syscall_emul.hh b/src/sim/syscall_emul.hh
index a3d95b8ec..e2d13067c 100644
--- a/src/sim/syscall_emul.hh
+++ b/src/sim/syscall_emul.hh
@@ -604,6 +604,32 @@ statFunc(SyscallDesc *desc, int callnum, LiveProcess *process,
}
+/// Target stat64() handler.
+template <class OS>
+SyscallReturn
+stat64Func(SyscallDesc *desc, int callnum, LiveProcess *process,
+ ThreadContext *tc)
+{
+ std::string path;
+
+ if (!tc->getMemPort()->tryReadString(path, tc->getSyscallArg(0)))
+ return -EFAULT;
+
+ // Adjust path for current working directory
+ path = process->fullPath(path);
+
+ struct stat64 hostBuf;
+ int result = stat64(path.c_str(), &hostBuf);
+
+ if (result < 0)
+ return -errno;
+
+ copyOutStat64Buf<OS>(tc->getMemPort(), tc->getSyscallArg(1), &hostBuf);
+
+ return 0;
+}
+
+
/// Target fstat64() handler.
template <class OS>
SyscallReturn