diff options
author | Brandon Potter <brandon.potter@amd.com> | 2018-04-18 14:57:57 -0400 |
---|---|---|
committer | Anthony Gutierrez <anthony.gutierrez@amd.com> | 2019-01-22 02:05:48 +0000 |
commit | bc74c58eaf55005a6a4b2e67657da4121554943c (patch) | |
tree | 92b04de877f151c7d5c562a117d695fdf913dc37 /src/sim/syscall_emul.cc | |
parent | c4e67f68377d9b3e909c76412b6ed2fde6a50e01 (diff) | |
download | gem5-bc74c58eaf55005a6a4b2e67657da4121554943c.tar.xz |
sim-se: add syscalls related to polling
Fix poll so that it will use the syscall retry capability
instead of causing a blocking call.
Add the accept and wait4 system calls.
Add polling to read to remove deadlocks that occur in the
event queue that are caused by blocking system calls.
Modify the write system call to return an error number in
case of error.
Change-Id: I0b4091a2e41e4187ebf69d63e0088f988f37d5da
Reviewed-on: https://gem5-review.googlesource.com/c/12115
Reviewed-by: Anthony Gutierrez <anthony.gutierrez@amd.com>
Maintainer: Anthony Gutierrez <anthony.gutierrez@amd.com>
Diffstat (limited to 'src/sim/syscall_emul.cc')
-rw-r--r-- | src/sim/syscall_emul.cc | 47 |
1 files changed, 0 insertions, 47 deletions
diff --git a/src/sim/syscall_emul.cc b/src/sim/syscall_emul.cc index 89f70a1cb..74ca1e924 100644 --- a/src/sim/syscall_emul.cc +++ b/src/sim/syscall_emul.cc @@ -279,53 +279,6 @@ closeFunc(SyscallDesc *desc, int num, Process *p, ThreadContext *tc) return p->fds->closeFDEntry(tgt_fd); } - -SyscallReturn -readFunc(SyscallDesc *desc, int num, Process *p, ThreadContext *tc) -{ - int index = 0; - int tgt_fd = p->getSyscallArg(tc, index); - Addr buf_ptr = p->getSyscallArg(tc, index); - int nbytes = p->getSyscallArg(tc, index); - - auto hbfdp = std::dynamic_pointer_cast<HBFDEntry>((*p->fds)[tgt_fd]); - if (!hbfdp) - return -EBADF; - int sim_fd = hbfdp->getSimFD(); - - BufferArg bufArg(buf_ptr, nbytes); - int bytes_read = read(sim_fd, bufArg.bufferPtr(), nbytes); - - if (bytes_read > 0) - bufArg.copyOut(tc->getMemProxy()); - - return bytes_read; -} - -SyscallReturn -writeFunc(SyscallDesc *desc, int num, Process *p, ThreadContext *tc) -{ - int index = 0; - int tgt_fd = p->getSyscallArg(tc, index); - Addr buf_ptr = p->getSyscallArg(tc, index); - int nbytes = p->getSyscallArg(tc, index); - - auto hbfdp = std::dynamic_pointer_cast<HBFDEntry>((*p->fds)[tgt_fd]); - if (!hbfdp) - return -EBADF; - int sim_fd = hbfdp->getSimFD(); - - BufferArg bufArg(buf_ptr, nbytes); - bufArg.copyIn(tc->getMemProxy()); - - int bytes_written = write(sim_fd, bufArg.bufferPtr(), nbytes); - - fsync(sim_fd); - - return bytes_written; -} - - SyscallReturn lseekFunc(SyscallDesc *desc, int num, Process *p, ThreadContext *tc) { |