diff options
author | Giacomo Travaglini <giacomo.travaglini@arm.com> | 2019-12-02 12:39:26 +0000 |
---|---|---|
committer | Giacomo Travaglini <giacomo.travaglini@arm.com> | 2019-12-03 10:12:02 +0000 |
commit | 7e4967995e4bbcfac877852437c4ab6bf6d70e47 (patch) | |
tree | ae43ca8cca90153afe95c51239d30b6ee8402ab6 /src | |
parent | 78e5caef696b017b15447c2a12311e94961cfdb4 (diff) | |
download | gem5-7e4967995e4bbcfac877852437c4ab6bf6d70e47.tar.xz |
sim-se: Avoid function overloading for syscall implementation
This patch is aligning the readlink and access syscalls to the open one,
which is not overloading the openFunc, but it is factoring the
implementation into a openImpl, which is used by both open and openat.
This is needed if passing them to std::function, whose constructor is
not able to handle overloaded functions.
Change-Id: I50a8aacdfd675181b6fe9a2696220ee29cc5bc4b
Signed-off-by: Giacomo Travaglini <giacomo.travaglini@arm.com>
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/23260
Reviewed-by: Brandon Potter <Brandon.Potter@amd.com>
Maintainer: Brandon Potter <Brandon.Potter@amd.com>
Tested-by: kokoro <noreply+kokoro@google.com>
Diffstat (limited to 'src')
-rw-r--r-- | src/sim/syscall_emul.cc | 8 | ||||
-rw-r--r-- | src/sim/syscall_emul.hh | 12 |
2 files changed, 10 insertions, 10 deletions
diff --git a/src/sim/syscall_emul.cc b/src/sim/syscall_emul.cc index 49fee7e8f..8dc055c5d 100644 --- a/src/sim/syscall_emul.cc +++ b/src/sim/syscall_emul.cc @@ -422,11 +422,11 @@ getcwdFunc(SyscallDesc *desc, int num, ThreadContext *tc) SyscallReturn readlinkFunc(SyscallDesc *desc, int callnum, ThreadContext *tc) { - return readlinkFunc(desc, callnum, tc, 0); + return readlinkImpl(desc, callnum, tc, 0); } SyscallReturn -readlinkFunc(SyscallDesc *desc, int num, ThreadContext *tc, int index) +readlinkImpl(SyscallDesc *desc, int num, ThreadContext *tc, int index) { string path; auto p = tc->getProcessPtr(); @@ -1147,7 +1147,7 @@ fallocateFunc(SyscallDesc *desc, int callnum, ThreadContext *tc) } SyscallReturn -accessFunc(SyscallDesc *desc, int callnum, ThreadContext *tc, int index) +accessImpl(SyscallDesc *desc, int callnum, ThreadContext *tc, int index) { string path; auto p = tc->getProcessPtr(); @@ -1166,7 +1166,7 @@ accessFunc(SyscallDesc *desc, int callnum, ThreadContext *tc, int index) SyscallReturn accessFunc(SyscallDesc *desc, int callnum, ThreadContext *tc) { - return accessFunc(desc, callnum, tc, 0); + return accessImpl(desc, callnum, tc, 0); } SyscallReturn diff --git a/src/sim/syscall_emul.hh b/src/sim/syscall_emul.hh index 0eaec4c1f..fc6ed62d1 100644 --- a/src/sim/syscall_emul.hh +++ b/src/sim/syscall_emul.hh @@ -171,8 +171,8 @@ SyscallReturn gethostnameFunc(SyscallDesc *desc, int num, ThreadContext *tc); SyscallReturn getcwdFunc(SyscallDesc *desc, int num, ThreadContext *tc); /// Target readlink() handler. -SyscallReturn readlinkFunc(SyscallDesc *desc, int num, ThreadContext *tc, - int index = 0); +SyscallReturn readlinkImpl(SyscallDesc *desc, int num, ThreadContext *tc, + int index); SyscallReturn readlinkFunc(SyscallDesc *desc, int num, ThreadContext *tc); /// Target unlink() handler. @@ -313,9 +313,9 @@ SyscallReturn geteuidFunc(SyscallDesc *desc, int num, ThreadContext *tc); SyscallReturn getegidFunc(SyscallDesc *desc, int num, ThreadContext *tc); /// Target access() handler -SyscallReturn accessFunc(SyscallDesc *desc, int num, ThreadContext *tc); -SyscallReturn accessFunc(SyscallDesc *desc, int num, ThreadContext *tc, +SyscallReturn accessImpl(SyscallDesc *desc, int num, ThreadContext *tc, int index); +SyscallReturn accessFunc(SyscallDesc *desc, int num, ThreadContext *tc); // Target getsockopt() handler. SyscallReturn getsockoptFunc(SyscallDesc *desc, int num, ThreadContext *tc); @@ -953,7 +953,7 @@ faccessatFunc(SyscallDesc *desc, int callnum, ThreadContext *tc) int dirfd = process->getSyscallArg(tc, index); if (dirfd != OS::TGT_AT_FDCWD) warn("faccessat: first argument not AT_FDCWD; unlikely to work"); - return accessFunc(desc, callnum, tc, 1); + return accessImpl(desc, callnum, tc, 1); } /// Target readlinkat() handler @@ -966,7 +966,7 @@ readlinkatFunc(SyscallDesc *desc, int callnum, ThreadContext *tc) int dirfd = process->getSyscallArg(tc, index); if (dirfd != OS::TGT_AT_FDCWD) warn("openat: first argument not AT_FDCWD; unlikely to work"); - return readlinkFunc(desc, callnum, tc, 1); + return readlinkImpl(desc, callnum, tc, 1); } /// Target renameat() handler. |