summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorMitch Hayenga <mitch.hayenga+gem5@gmail.com>2013-01-08 08:54:07 -0500
committerMitch Hayenga <mitch.hayenga+gem5@gmail.com>2013-01-08 08:54:07 -0500
commit4a752b1655c531a2fd7d98dbe24239fed5261291 (patch)
treef950f5788bf2ee608d2364988b934e287d5a99e3 /src
parentc7dbd5e7686bbb065dfe2a74b92f4d9463ddfa80 (diff)
downloadgem5-4a752b1655c531a2fd7d98dbe24239fed5261291.tar.xz
arm: add access syscall for ARM SE mode
This patch adds the "access" syscall for ARM SE as required by some spec2006 benchmarks.
Diffstat (limited to 'src')
-rw-r--r--src/arch/arm/linux/process.cc2
-rw-r--r--src/sim/syscall_emul.cc17
-rw-r--r--src/sim/syscall_emul.hh4
3 files changed, 22 insertions, 1 deletions
diff --git a/src/arch/arm/linux/process.cc b/src/arch/arm/linux/process.cc
index 088f9907e..169565a04 100644
--- a/src/arch/arm/linux/process.cc
+++ b/src/arch/arm/linux/process.cc
@@ -108,7 +108,7 @@ SyscallDesc ArmLinuxProcess::syscallDescs[] = {
/* 30 */ SyscallDesc("utime", unimplementedFunc),
/* 31 */ SyscallDesc("unused#31", unimplementedFunc),
/* 32 */ SyscallDesc("unused#32", unimplementedFunc),
- /* 33 */ SyscallDesc("access", unimplementedFunc),
+ /* 33 */ SyscallDesc("access", accessFunc),
/* 34 */ SyscallDesc("nice", unimplementedFunc),
/* 35 */ SyscallDesc("unused#35", unimplementedFunc),
/* 36 */ SyscallDesc("sync", unimplementedFunc),
diff --git a/src/sim/syscall_emul.cc b/src/sim/syscall_emul.cc
index 779e567f5..a86065317 100644
--- a/src/sim/syscall_emul.cc
+++ b/src/sim/syscall_emul.cc
@@ -851,3 +851,20 @@ cloneFunc(SyscallDesc *desc, int callnum, LiveProcess *process,
}
}
+SyscallReturn
+accessFunc(SyscallDesc *desc, int callnum, LiveProcess *p, ThreadContext *tc)
+{
+ int index = 0;
+
+ string path;
+ if (!tc->getMemProxy().tryReadString(path, p->getSyscallArg(tc, index)))
+ return (TheISA::IntReg)-EFAULT;
+
+ // Adjust path for current working directory
+ path = p->fullPath(path);
+
+ mode_t mode = p->getSyscallArg(tc, index);
+
+ int result = access(path.c_str(), mode);
+ return (result == -1) ? -errno : result;
+}
diff --git a/src/sim/syscall_emul.hh b/src/sim/syscall_emul.hh
index e98e771d5..364b66c0a 100644
--- a/src/sim/syscall_emul.hh
+++ b/src/sim/syscall_emul.hh
@@ -335,6 +335,10 @@ SyscallReturn getegidFunc(SyscallDesc *desc, int num,
SyscallReturn cloneFunc(SyscallDesc *desc, int num,
LiveProcess *p, ThreadContext *tc);
+/// Target access() handler
+SyscallReturn accessFunc(SyscallDesc *desc, int num,
+ LiveProcess *p, ThreadContext *tc);
+
/// Futex system call
/// Implemented by Daniel Sanchez
/// Used by printf's in multi-threaded apps