summaryrefslogtreecommitdiff
path: root/src/sim/emul_driver.hh
diff options
context:
space:
mode:
authorMichael LeBeane <michael.lebeane@amd.com>2016-09-13 23:12:46 -0400
committerMichael LeBeane <michael.lebeane@amd.com>2016-09-13 23:12:46 -0400
commitf17a5faf44b01a07a2f97ff98fad01f974ec427b (patch)
tree255c32c07d324279dbc6a91a7e250513047524c3 /src/sim/emul_driver.hh
parent6a668d0c0cc915ee2f1950e907cd61723d6b72c7 (diff)
downloadgem5-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/emul_driver.hh')
-rw-r--r--src/sim/emul_driver.hh15
1 files changed, 13 insertions, 2 deletions
diff --git a/src/sim/emul_driver.hh b/src/sim/emul_driver.hh
index 778fc6461..62ba61507 100644
--- a/src/sim/emul_driver.hh
+++ b/src/sim/emul_driver.hh
@@ -46,8 +46,8 @@ class ThreadContext;
* hardware inside gem5 can be created by deriving from this class and
* overriding the abstract virtual methods.
*
- * Currently only open() and ioctl() calls are supported, but other calls
- * (e.g., read(), write(), mmap()) could be added as needed.
+ * Currently only open(), ioctl(), and mmap() calls are supported, but other
+ * calls (e.g., read(), write()) could be added as needed.
*/
class EmulatedDriver : public SimObject
{
@@ -85,6 +85,17 @@ class EmulatedDriver : public SimObject
* (see the SyscallReturn class).
*/
virtual int ioctl(LiveProcess *p, ThreadContext *tc, unsigned req) = 0;
+
+ /**
+ * Virtual method, invoked when the user program calls mmap() on
+ * the file descriptor returned by a previous open(). The parameters
+ * are the same as those passed in to mmapFunc() (q.v.).
+ * @return The return ptr for the mmap, or the negation of the errno
+ * (see the SyscallReturn class).
+ */
+ virtual Addr mmap(LiveProcess *p, ThreadContext *tc, Addr start,
+ uint64_t length, int prot, int tgtFlags, int tgtFd,
+ int offset) { return -EBADF; }
};
#endif // __SIM_EMUL_DRIVER_HH