summaryrefslogtreecommitdiff
path: root/src/sim/syscall_emul.cc
diff options
context:
space:
mode:
Diffstat (limited to 'src/sim/syscall_emul.cc')
-rw-r--r--src/sim/syscall_emul.cc34
1 files changed, 32 insertions, 2 deletions
diff --git a/src/sim/syscall_emul.cc b/src/sim/syscall_emul.cc
index 888c133c0..848b6f869 100644
--- a/src/sim/syscall_emul.cc
+++ b/src/sim/syscall_emul.cc
@@ -27,6 +27,7 @@
*
* Authors: Steve Reinhardt
* Ali Saidi
+ * Korey Sewell
*/
#include <fcntl.h>
@@ -43,7 +44,7 @@
#include "mem/page_table.hh"
#include "sim/process.hh"
-#include "sim/sim_events.hh"
+#include "sim/sim_exit.hh"
using namespace std;
using namespace TheISA;
@@ -91,7 +92,7 @@ SyscallReturn
exitFunc(SyscallDesc *desc, int callnum, Process *process,
ThreadContext *tc)
{
- new SimExitEvent("target called exit()", tc->getSyscallArg(0) & 0xff);
+ exitSimLoop("target called exit()", tc->getSyscallArg(0) & 0xff);
return 1;
}
@@ -341,6 +342,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)
{