sim-se: Add prlimit system call
[gem5.git] / src / sim / emul_driver.hh
index 778fc6461ccf672b81047a2f5c8d7f398fd3cc9c..97ba572240367d44883f9451a2f0370e6e71f9c2 100644 (file)
@@ -36,7 +36,7 @@
 #include "params/EmulatedDriver.hh"
 #include "sim/sim_object.hh"
 
-class LiveProcess;
+class Process;
 class ThreadContext;
 
 /**
@@ -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
 {
@@ -74,7 +74,7 @@ class EmulatedDriver : public SimObject
      * to openFunc() (q.v.).
      * @return A newly allocated target fd, or -1 on error.
      */
-    virtual int open(LiveProcess *p, ThreadContext *tc,
+    virtual int open(Process *p, ThreadContext *tc,
                      int mode, int flags) = 0;
 
     /**
@@ -84,7 +84,18 @@ class EmulatedDriver : public SimObject
      * @return The return code for the ioctl, or the negation of the errno
      * (see the SyscallReturn class).
      */
-    virtual int ioctl(LiveProcess *p, ThreadContext *tc, unsigned req) = 0;
+    virtual int ioctl(Process *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(Process *p, ThreadContext *tc, Addr start,
+                      uint64_t length, int prot, int tgtFlags, int tgtFd,
+                      int offset) { return -EBADF; }
 };
 
 #endif // __SIM_EMUL_DRIVER_HH