sim-se: only implement getdentsFunc on supported hosts
The implementation of the getdents syscall relies on SYS_getdents, which is not available on all archs, because the getdents syscall has been superseded by getdents64, and does not exist on newer archs such as aarch64. This leads the build to break on aarch64 hosts with error: error: 'SYS_getdents' was not declared in this scope Change-Id: I8701fb5b61c0418b14a9463ef135a391a7f7a9ba Reviewed-on: https://gem5-review.googlesource.com/c/14596 Reviewed-by: Brandon Potter <Brandon.Potter@amd.com> Maintainer: Brandon Potter <Brandon.Potter@amd.com>
This commit is contained in:
@@ -298,7 +298,11 @@ static SyscallDesc syscallDescs64[] = {
|
|||||||
/* 75 */ SyscallDesc("fdatasync", unimplementedFunc),
|
/* 75 */ SyscallDesc("fdatasync", unimplementedFunc),
|
||||||
/* 76 */ SyscallDesc("truncate", truncateFunc),
|
/* 76 */ SyscallDesc("truncate", truncateFunc),
|
||||||
/* 77 */ SyscallDesc("ftruncate", ftruncateFunc),
|
/* 77 */ SyscallDesc("ftruncate", ftruncateFunc),
|
||||||
|
#if defined(SYS_getdents)
|
||||||
/* 78 */ SyscallDesc("getdents", getdentsFunc),
|
/* 78 */ SyscallDesc("getdents", getdentsFunc),
|
||||||
|
#else
|
||||||
|
/* 78 */ SyscallDesc("getdents", unimplementedFunc),
|
||||||
|
#endif
|
||||||
/* 79 */ SyscallDesc("getcwd", getcwdFunc),
|
/* 79 */ SyscallDesc("getcwd", getcwdFunc),
|
||||||
/* 80 */ SyscallDesc("chdir", chdirFunc),
|
/* 80 */ SyscallDesc("chdir", chdirFunc),
|
||||||
/* 81 */ SyscallDesc("fchdir", unimplementedFunc),
|
/* 81 */ SyscallDesc("fchdir", unimplementedFunc),
|
||||||
@@ -690,7 +694,11 @@ static SyscallDesc syscallDescs32[] = {
|
|||||||
/* 138 */ SyscallDesc("setfsuid", unimplementedFunc),
|
/* 138 */ SyscallDesc("setfsuid", unimplementedFunc),
|
||||||
/* 139 */ SyscallDesc("setfsgid", unimplementedFunc),
|
/* 139 */ SyscallDesc("setfsgid", unimplementedFunc),
|
||||||
/* 140 */ SyscallDesc("_llseek", _llseekFunc),
|
/* 140 */ SyscallDesc("_llseek", _llseekFunc),
|
||||||
|
#if defined(SYS_getdents)
|
||||||
/* 141 */ SyscallDesc("getdents", getdentsFunc),
|
/* 141 */ SyscallDesc("getdents", getdentsFunc),
|
||||||
|
#else
|
||||||
|
/* 141 */ SyscallDesc("getdents", unimplementedFunc),
|
||||||
|
#endif
|
||||||
/* 142 */ SyscallDesc("_newselect", unimplementedFunc),
|
/* 142 */ SyscallDesc("_newselect", unimplementedFunc),
|
||||||
/* 143 */ SyscallDesc("flock", unimplementedFunc),
|
/* 143 */ SyscallDesc("flock", unimplementedFunc),
|
||||||
/* 144 */ SyscallDesc("msync", unimplementedFunc),
|
/* 144 */ SyscallDesc("msync", unimplementedFunc),
|
||||||
|
|||||||
@@ -1151,6 +1151,7 @@ rmdirFunc(SyscallDesc *desc, int num, Process *p, ThreadContext *tc)
|
|||||||
return (result == -1) ? -errno : result;
|
return (result == -1) ? -errno : result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if defined(SYS_getdents)
|
||||||
SyscallReturn
|
SyscallReturn
|
||||||
getdentsFunc(SyscallDesc *desc, int callnum, Process *p, ThreadContext *tc)
|
getdentsFunc(SyscallDesc *desc, int callnum, Process *p, ThreadContext *tc)
|
||||||
{
|
{
|
||||||
@@ -1198,4 +1199,4 @@ getdentsFunc(SyscallDesc *desc, int callnum, Process *p, ThreadContext *tc)
|
|||||||
buf_arg.copyOut(tc->getMemProxy());
|
buf_arg.copyOut(tc->getMemProxy());
|
||||||
return status;
|
return status;
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|||||||
@@ -303,9 +303,11 @@ SyscallReturn pipeImpl(SyscallDesc *desc, int num, Process *p,
|
|||||||
SyscallReturn getpidFunc(SyscallDesc *desc, int num,
|
SyscallReturn getpidFunc(SyscallDesc *desc, int num,
|
||||||
Process *p, ThreadContext *tc);
|
Process *p, ThreadContext *tc);
|
||||||
|
|
||||||
|
#if defined(SYS_getdents)
|
||||||
// Target getdents() handler.
|
// Target getdents() handler.
|
||||||
SyscallReturn getdentsFunc(SyscallDesc *desc, int num,
|
SyscallReturn getdentsFunc(SyscallDesc *desc, int num,
|
||||||
Process *p, ThreadContext *tc);
|
Process *p, ThreadContext *tc);
|
||||||
|
#endif
|
||||||
|
|
||||||
// Target getuid() handler.
|
// Target getuid() handler.
|
||||||
SyscallReturn getuidFunc(SyscallDesc *desc, int num,
|
SyscallReturn getuidFunc(SyscallDesc *desc, int num,
|
||||||
|
|||||||
Reference in New Issue
Block a user