diff options
author | Michael LeBeane <michael.lebeane@amd.com> | 2016-09-13 23:12:46 -0400 |
---|---|---|
committer | Michael LeBeane <michael.lebeane@amd.com> | 2016-09-13 23:12:46 -0400 |
commit | f17a5faf44b01a07a2f97ff98fad01f974ec427b (patch) | |
tree | 255c32c07d324279dbc6a91a7e250513047524c3 /src/sim/syscall_emul.hh | |
parent | 6a668d0c0cc915ee2f1950e907cd61723d6b72c7 (diff) | |
download | gem5-f17a5faf44b01a07a2f97ff98fad01f974ec427b.tar.xz |
sim, syscall_emul: Add mmap to EmulatedDriver
Add support for calling mmap on an EmulatedDriver file descriptor.
Diffstat (limited to 'src/sim/syscall_emul.hh')
-rw-r--r-- | src/sim/syscall_emul.hh | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/src/sim/syscall_emul.hh b/src/sim/syscall_emul.hh index 7cce9e9c0..c11e9865f 100644 --- a/src/sim/syscall_emul.hh +++ b/src/sim/syscall_emul.hh @@ -1284,7 +1284,17 @@ mmapImpl(SyscallDesc *desc, int num, LiveProcess *p, ThreadContext *tc, int sim_fd = -1; uint8_t *pmap = nullptr; if (!(tgt_flags & OS::TGT_MAP_ANONYMOUS)) { - sim_fd = p->getSimFD(tgt_fd); + // Check for EmulatedDriver mmap + FDEntry *fde = p->getFDEntry(tgt_fd); + if (fde == NULL) + return -EBADF; + + if (fde->driver != NULL) { + return fde->driver->mmap(p, tc, start, length, prot, + tgt_flags, tgt_fd, offset); + } + sim_fd = fde->fd; + if (sim_fd < 0) return -EBADF; |