From 4cc31e1aefc337fe37c4b6373fe263e8b26e0b7d Mon Sep 17 00:00:00 2001 From: Korey Sewell Date: Fri, 9 Jun 2006 17:07:13 -0400 Subject: add fcntl64Func use ThreadContext rename src/arch/mips/isa/formats/branch.isa: src/arch/mips/isa/formats/fp.isa: src/arch/mips/isa/includes.isa: Use ThreadContext src/sim/syscall_emul.cc: fcntl64 function using TC src/sim/syscall_emul.hh: Add fcntl64func --HG-- extra : convert_revision : b5e2348530473704388b1c5a2b59bf78360260a9 --- src/sim/syscall_emul.cc | 29 +++++++++++++++++++++++++++++ src/sim/syscall_emul.hh | 4 ++++ 2 files changed, 33 insertions(+) (limited to 'src/sim') diff --git a/src/sim/syscall_emul.cc b/src/sim/syscall_emul.cc index 888c133c0..e32295131 100644 --- a/src/sim/syscall_emul.cc +++ b/src/sim/syscall_emul.cc @@ -340,6 +340,35 @@ fcntlFunc(SyscallDesc *desc, int num, Process *process, } } +SyscallReturn +fcntl64Func(SyscallDesc *desc, int num, Process *process, + ThreadContext *tc) +{ + int fd = tc->getSyscallArg(0); + + if (fd < 0 || process->sim_fd(fd) < 0) + return -EBADF; + + int cmd = tc->getSyscallArg(1); + switch (cmd) { + case 33: //F_GETLK64 + warn("fcntl64(%d, F_GETLK64) not supported, error returned\n", fd); + return -EMFILE; + + case 34: // F_SETLK64 + case 35: // F_SETLKW64 + warn("fcntl64(%d, F_SETLK(W)64) not supported, error returned\n", fd); + return -EMFILE; + + default: + // not sure if this is totally valid, but we'll pass it through + // to the underlying OS + warn("fcntl64(%d, %d) passed through to host\n", fd, cmd); + return fcntl(process->sim_fd(fd), cmd); + // return 0; + } +} + SyscallReturn pipePseudoFunc(SyscallDesc *desc, int callnum, Process *process, ThreadContext *tc) diff --git a/src/sim/syscall_emul.hh b/src/sim/syscall_emul.hh index 874eaf6a4..ffd12dd83 100644 --- a/src/sim/syscall_emul.hh +++ b/src/sim/syscall_emul.hh @@ -249,6 +249,10 @@ SyscallReturn fchownFunc(SyscallDesc *desc, int num, SyscallReturn fcntlFunc(SyscallDesc *desc, int num, Process *process, ThreadContext *tc); +/// Target fcntl64() handler. +SyscallReturn fcntl64Func(SyscallDesc *desc, int num, + Process *process, ThreadContext *tc); + /// Target setuid() handler. SyscallReturn setuidFunc(SyscallDesc *desc, int num, Process *p, ThreadContext *tc); -- cgit v1.2.3