From: Nilay Vaish Date: Wed, 22 Oct 2014 20:59:57 +0000 (-0500) Subject: sim: revert 6709bbcf564d X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=6523aad25c32f2443c48b114db4dab078bfb16d1;p=gem5.git sim: revert 6709bbcf564d The identifier SYS_getdents is not available on Mac OS X. Therefore, its use results in compilation failure. It seems there is no straight forward way to implement the system call getdents using readdir() or similar C functions. Hence the commit 6709bbcf564d is being rolled back. --- diff --git a/src/arch/alpha/linux/process.cc b/src/arch/alpha/linux/process.cc index fab758f47..ebe06510d 100644 --- a/src/arch/alpha/linux/process.cc +++ b/src/arch/alpha/linux/process.cc @@ -431,7 +431,7 @@ SyscallDesc AlphaLinuxProcess::syscallDescs[] = { /* 302 */ SyscallDesc("mount", unimplementedFunc), /* 303 */ SyscallDesc("old_adjtimex", unimplementedFunc), /* 304 */ SyscallDesc("swapoff", unimplementedFunc), - /* 305 */ SyscallDesc("getdents", getdentsFunc), + /* 305 */ SyscallDesc("getdents", unimplementedFunc), /* 306 */ SyscallDesc("create_module", unimplementedFunc), /* 307 */ SyscallDesc("init_module", unimplementedFunc), /* 308 */ SyscallDesc("delete_module", unimplementedFunc), @@ -503,7 +503,7 @@ SyscallDesc AlphaLinuxProcess::syscallDescs[] = { /* 374 */ SyscallDesc("pivot_root", unimplementedFunc), /* 375 */ SyscallDesc("mincore", unimplementedFunc), /* 376 */ SyscallDesc("pciconfig_iobase", unimplementedFunc), - /* 377 */ SyscallDesc("getdents64", getdents64Func), + /* 377 */ SyscallDesc("getdents64", unimplementedFunc), /* 378 */ SyscallDesc("gettid", unimplementedFunc), /* 379 */ SyscallDesc("readahead", unimplementedFunc), /* 380 */ SyscallDesc("security", unimplementedFunc), diff --git a/src/arch/arm/linux/process.cc b/src/arch/arm/linux/process.cc index 7f53eaae8..faa39fd34 100644 --- a/src/arch/arm/linux/process.cc +++ b/src/arch/arm/linux/process.cc @@ -260,7 +260,7 @@ static SyscallDesc syscallDescs32[] = { /* 138 */ SyscallDesc("setfsuid", unimplementedFunc), /* 139 */ SyscallDesc("setfsgid", unimplementedFunc), /* 140 */ SyscallDesc("llseek", _llseekFunc), - /* 141 */ SyscallDesc("getdents", getdentsFunc), + /* 141 */ SyscallDesc("getdents", unimplementedFunc), /* 142 */ SyscallDesc("newselect", unimplementedFunc), /* 143 */ SyscallDesc("flock", unimplementedFunc), /* 144 */ SyscallDesc("msync", unimplementedFunc), @@ -336,7 +336,7 @@ static SyscallDesc syscallDescs32[] = { /* 214 */ SyscallDesc("setgid", unimplementedFunc), /* 215 */ SyscallDesc("setfsuid", unimplementedFunc), /* 216 */ SyscallDesc("setfsgid", unimplementedFunc), - /* 217 */ SyscallDesc("getdents64", getdents64Func), + /* 217 */ SyscallDesc("getdents64", unimplementedFunc), /* 218 */ SyscallDesc("pivot_root", unimplementedFunc), /* 219 */ SyscallDesc("mincore", unimplementedFunc), /* 220 */ SyscallDesc("madvise", unimplementedFunc), diff --git a/src/arch/mips/linux/process.cc b/src/arch/mips/linux/process.cc index 375288290..ef21179e5 100644 --- a/src/arch/mips/linux/process.cc +++ b/src/arch/mips/linux/process.cc @@ -277,7 +277,7 @@ SyscallDesc MipsLinuxProcess::syscallDescs[] = { /* 138 */ SyscallDesc("setfsuid", unimplementedFunc), /* 139 */ SyscallDesc("setfsgid", unimplementedFunc), /* 140 */ SyscallDesc("llseek", unimplementedFunc), - /* 141 */ SyscallDesc("getdents", getdentsFunc), + /* 141 */ SyscallDesc("getdents", unimplementedFunc), /* 142 */ SyscallDesc("newselect", unimplementedFunc), /* 143 */ SyscallDesc("flock", unimplementedFunc), /* 144 */ SyscallDesc("msync", unimplementedFunc), @@ -355,7 +355,7 @@ SyscallDesc MipsLinuxProcess::syscallDescs[] = { /* 216 */ SyscallDesc("pivot_root", unimplementedFunc), /* 217 */ SyscallDesc("mincore", unimplementedFunc), /* 218 */ SyscallDesc("madvise", unimplementedFunc), - /* 219 */ SyscallDesc("getdents64", getdents64Func), + /* 219 */ SyscallDesc("getdents64", unimplementedFunc), /* 220 */ SyscallDesc("fcntl64", fcntl64Func), /* 221 */ SyscallDesc("reserved#221", unimplementedFunc), /* 222 */ SyscallDesc("gettid", unimplementedFunc), diff --git a/src/arch/power/linux/process.cc b/src/arch/power/linux/process.cc index eef334d01..b00e02a87 100644 --- a/src/arch/power/linux/process.cc +++ b/src/arch/power/linux/process.cc @@ -205,7 +205,7 @@ SyscallDesc PowerLinuxProcess::syscallDescs[] = { /* 138 */ SyscallDesc("setfsuid", unimplementedFunc), /* 139 */ SyscallDesc("setfsgid", unimplementedFunc), /* 140 */ SyscallDesc("llseek", _llseekFunc), - /* 141 */ SyscallDesc("getdents", getdentsFunc), + /* 141 */ SyscallDesc("getdents", unimplementedFunc), /* 142 */ SyscallDesc("newselect", unimplementedFunc), /* 143 */ SyscallDesc("flock", unimplementedFunc), /* 144 */ SyscallDesc("msync", unimplementedFunc), @@ -281,7 +281,7 @@ SyscallDesc PowerLinuxProcess::syscallDescs[] = { /* 214 */ SyscallDesc("setgid", unimplementedFunc), /* 215 */ SyscallDesc("setfsuid", unimplementedFunc), /* 216 */ SyscallDesc("setfsgid", unimplementedFunc), - /* 217 */ SyscallDesc("getdents64", getdents64Func), + /* 217 */ SyscallDesc("getdents64", unimplementedFunc), /* 218 */ SyscallDesc("pivot_root", unimplementedFunc), /* 219 */ SyscallDesc("mincore", unimplementedFunc), /* 220 */ SyscallDesc("madvise", unimplementedFunc), diff --git a/src/arch/sparc/linux/syscalls.cc b/src/arch/sparc/linux/syscalls.cc index 232ff7140..66e8e1fe1 100644 --- a/src/arch/sparc/linux/syscalls.cc +++ b/src/arch/sparc/linux/syscalls.cc @@ -241,7 +241,7 @@ SyscallDesc SparcLinuxProcess::syscall32Descs[] = { /* 151 */ SyscallDesc("inotify_init", unimplementedFunc), /* 152 */ SyscallDesc("inotify_add_watch", unimplementedFunc), /* 153 */ SyscallDesc("poll", unimplementedFunc), - /* 154 */ SyscallDesc("getdents64", getdents64Func), + /* 154 */ SyscallDesc("getdents64", unimplementedFunc), /* 155 */ SyscallDesc("fcntl64", unimplementedFunc), /* 156 */ SyscallDesc("inotify_rm_watch", unimplementedFunc), /* 157 */ SyscallDesc("statfs", unimplementedFunc), @@ -261,7 +261,7 @@ SyscallDesc SparcLinuxProcess::syscall32Descs[] = { /* 171 */ SyscallDesc("fsetxattr", unimplementedFunc), // 32 bit /* 172 */ SyscallDesc("getxattr", unimplementedFunc), /* 173 */ SyscallDesc("lgetxattr", unimplementedFunc), - /* 174 */ SyscallDesc("getdents", getdentsFunc), + /* 174 */ SyscallDesc("getdents", unimplementedFunc), /* 175 */ SyscallDesc("setsid", unimplementedFunc), /* 176 */ SyscallDesc("fchdir", unimplementedFunc), /* 177 */ SyscallDesc("fgetxattr", unimplementedFunc), // 32 bit @@ -547,7 +547,7 @@ SyscallDesc SparcLinuxProcess::syscallDescs[] = { /* 151 */ SyscallDesc("inotify_init", unimplementedFunc), /* 152 */ SyscallDesc("inotify_add_watch", unimplementedFunc), /* 153 */ SyscallDesc("poll", unimplementedFunc), - /* 154 */ SyscallDesc("getdents64", getdents64Func), + /* 154 */ SyscallDesc("getdents64", unimplementedFunc), /* 155 */ SyscallDesc("fcntl64", unimplementedFunc), /* 156 */ SyscallDesc("inotify_rm_watch", unimplementedFunc), /* 157 */ SyscallDesc("statfs", unimplementedFunc), @@ -567,7 +567,7 @@ SyscallDesc SparcLinuxProcess::syscallDescs[] = { /* 171 */ SyscallDesc("fsetxattr", unimplementedFunc), /* 172 */ SyscallDesc("getxattr", unimplementedFunc), /* 173 */ SyscallDesc("lgetxattr", unimplementedFunc), - /* 174 */ SyscallDesc("getdents", getdentsFunc), + /* 174 */ SyscallDesc("getdents", unimplementedFunc), /* 175 */ SyscallDesc("setsid", unimplementedFunc), /* 176 */ SyscallDesc("fchdir", unimplementedFunc), /* 177 */ SyscallDesc("fgetxattr", unimplementedFunc), diff --git a/src/arch/x86/linux/process.cc b/src/arch/x86/linux/process.cc index 047cce351..297688323 100644 --- a/src/arch/x86/linux/process.cc +++ b/src/arch/x86/linux/process.cc @@ -296,7 +296,7 @@ static SyscallDesc syscallDescs64[] = { /* 75 */ SyscallDesc("fdatasync", unimplementedFunc), /* 76 */ SyscallDesc("truncate", truncateFunc), /* 77 */ SyscallDesc("ftruncate", ftruncateFunc), - /* 78 */ SyscallDesc("getdents", getdentsFunc), + /* 78 */ SyscallDesc("getdents", unimplementedFunc), /* 79 */ SyscallDesc("getcwd", getcwdFunc), /* 80 */ SyscallDesc("chdir", unimplementedFunc), /* 81 */ SyscallDesc("fchdir", unimplementedFunc), @@ -435,7 +435,7 @@ static SyscallDesc syscallDescs64[] = { /* 214 */ SyscallDesc("epoll_ctl_old", unimplementedFunc), /* 215 */ SyscallDesc("epoll_wait_old", unimplementedFunc), /* 216 */ SyscallDesc("remap_file_pages", unimplementedFunc), - /* 217 */ SyscallDesc("getdents64", getdents64Func), + /* 217 */ SyscallDesc("getdents64", unimplementedFunc), /* 218 */ SyscallDesc("set_tid_address", unimplementedFunc), /* 219 */ SyscallDesc("restart_syscall", unimplementedFunc), /* 220 */ SyscallDesc("semtimedop", unimplementedFunc), diff --git a/src/sim/syscall_emul.cc b/src/sim/syscall_emul.cc index 7eeacd319..d8df891dd 100644 --- a/src/sim/syscall_emul.cc +++ b/src/sim/syscall_emul.cc @@ -31,7 +31,6 @@ #include #include -#include #include #include @@ -868,41 +867,6 @@ cloneFunc(SyscallDesc *desc, int callnum, LiveProcess *process, } } -SyscallReturn -getdentsFunc(SyscallDesc *desc, int num, LiveProcess *p, - ThreadContext *tc) -{ - int index = 0; - int fd = p->sim_fd(p->getSyscallArg(tc, index)); - Addr bufPtr = p->getSyscallArg(tc, index); - int nbytes = p->getSyscallArg(tc, index); - BufferArg bufArg(bufPtr, nbytes); - - int bytes_read = syscall(SYS_getdents, fd, bufArg.bufferPtr(), nbytes); - - if (bytes_read != -1) - bufArg.copyOut(tc->getMemProxy()); - - return bytes_read; -} - -SyscallReturn -getdents64Func(SyscallDesc *desc, int num, LiveProcess *p, - ThreadContext *tc) -{ - int index = 0; - int fd = p->sim_fd(p->getSyscallArg(tc, index)); - Addr bufPtr = p->getSyscallArg(tc, index); - int nbytes = p->getSyscallArg(tc, index); - BufferArg bufArg(bufPtr, nbytes); - - int bytes_read = syscall(SYS_getdents64, fd, bufArg.bufferPtr(), nbytes); - - if (bytes_read != -1) - bufArg.copyOut(tc->getMemProxy()); - - return bytes_read; -} SyscallReturn accessFunc(SyscallDesc *desc, int callnum, LiveProcess *p, ThreadContext *tc, int index) diff --git a/src/sim/syscall_emul.hh b/src/sim/syscall_emul.hh index f793bc41f..dff34982d 100644 --- a/src/sim/syscall_emul.hh +++ b/src/sim/syscall_emul.hh @@ -439,14 +439,6 @@ futexFunc(SyscallDesc *desc, int callnum, LiveProcess *process, } -/// Target getdents() handler. -SyscallReturn getdentsFunc(SyscallDesc *desc, int num, - LiveProcess *process, ThreadContext *tc); - -/// Target getdents64() handler. -SyscallReturn getdents64Func(SyscallDesc *desc, int num, - LiveProcess *process, ThreadContext *tc); - /// Pseudo Funcs - These functions use a different return convension, /// returning a second value in a register other than the normal return register