changeset ae3b12c845b8 in /z/repo/gem5
details: http://repo.gem5.org/gem5?cmd=changeset;node=ae3b12c845b8
description:
arm: Add unlinkat syscall implementation
added ARM aarch64 unlinkat syscall support, modeled on other <xxx>at
syscalls.
This gets all of the cpu2006 int workloads passing in SE mode on
aarch64.
Committed by: Nilay Vaish <[email protected]>
diffstat:
src/arch/arm/linux/process.cc | 2 +-
src/sim/syscall_emul.cc | 8 +++++++-
src/sim/syscall_emul.hh | 17 +++++++++++++++++
3 files changed, 25 insertions(+), 2 deletions(-)
diffs (66 lines):
diff -r b415e0dabe21 -r ae3b12c845b8 src/arch/arm/linux/process.cc
--- a/src/arch/arm/linux/process.cc Sat Jan 03 17:51:48 2015 -0600
+++ b/src/arch/arm/linux/process.cc Sat Jan 03 17:51:48 2015 -0600
@@ -523,7 +523,7 @@
/* 32 */ SyscallDesc("flock", unimplementedFunc),
/* 33 */ SyscallDesc("mknodat", unimplementedFunc),
/* 34 */ SyscallDesc("mkdirat", unimplementedFunc),
- /* 35 */ SyscallDesc("unlinkat", unimplementedFunc),
+ /* 35 */ SyscallDesc("unlinkat", unlinkatFunc<ArmLinux64>),
/* 36 */ SyscallDesc("symlinkat", unimplementedFunc),
/* 37 */ SyscallDesc("linkat", unimplementedFunc),
/* 38 */ SyscallDesc("renameat", unimplementedFunc),
diff -r b415e0dabe21 -r ae3b12c845b8 src/sim/syscall_emul.cc
--- a/src/sim/syscall_emul.cc Sat Jan 03 17:51:48 2015 -0600
+++ b/src/sim/syscall_emul.cc Sat Jan 03 17:51:48 2015 -0600
@@ -400,9 +400,15 @@
SyscallReturn
unlinkFunc(SyscallDesc *desc, int num, LiveProcess *p, ThreadContext *tc)
{
+ return unlinkHelper(desc, num, p, tc, 0);
+}
+
+SyscallReturn
+unlinkHelper(SyscallDesc *desc, int num, LiveProcess *p, ThreadContext *tc,
+ int index)
+{
string path;
- int index = 0;
if (!tc->getMemProxy().tryReadString(path, p->getSyscallArg(tc, index)))
return -EFAULT;
diff -r b415e0dabe21 -r ae3b12c845b8 src/sim/syscall_emul.hh
--- a/src/sim/syscall_emul.hh Sat Jan 03 17:51:48 2015 -0600
+++ b/src/sim/syscall_emul.hh Sat Jan 03 17:51:48 2015 -0600
@@ -195,6 +195,9 @@
LiveProcess *p, ThreadContext *tc);
/// Target unlink() handler.
+SyscallReturn unlinkHelper(SyscallDesc *desc, int num,
+ LiveProcess *p, ThreadContext *tc,
+ int index);
SyscallReturn unlinkFunc(SyscallDesc *desc, int num,
LiveProcess *p, ThreadContext *tc);
@@ -655,6 +658,20 @@
return openFunc<OS>(desc, callnum, process, tc, 1);
}
+/// Target unlinkat() handler.
+template <class OS>
+SyscallReturn
+unlinkatFunc(SyscallDesc *desc, int callnum, LiveProcess *process,
+ ThreadContext *tc)
+{
+ int index = 0;
+ int dirfd = process->getSyscallArg(tc, index);
+ if (dirfd != OS::TGT_AT_FDCWD)
+ warn("unlinkat: first argument not AT_FDCWD; unlikely to work");
+
+ return unlinkHelper(desc, callnum, process, tc, 1);
+}
+
/// Target facessat() handler
template <class OS>
SyscallReturn
_______________________________________________
gem5-dev mailing list
[email protected]
http://m5sim.org/mailman/listinfo/gem5-dev