Time: Add a mechanism to prevent M5 from running faster than real time.
[gem5.git] / src / sim / syscall_emul.hh
index 703bbd1e0e1a194e54f7030521343dc09b7ed517..1dc51ad5686944d01ebe586e3fd0bff5ac55acbf 100644 (file)
@@ -62,6 +62,7 @@
 #include "cpu/thread_context.hh"
 #include "mem/translating_port.hh"
 #include "mem/page_table.hh"
+#include "sim/byteswap.hh"
 #include "sim/system.hh"
 #include "sim/process.hh"
 
@@ -362,7 +363,7 @@ template <class T1, class T2>
 void
 getElapsedTime(T1 &sec, T2 &usec)
 {
-    int elapsed_usecs = curTick / SimClock::Int::us;
+    int elapsed_usecs = curTick() / SimClock::Int::us;
     sec = elapsed_usecs / one_million;
     usec = elapsed_usecs % one_million;
 }
@@ -511,8 +512,8 @@ ioctlFunc(SyscallDesc *desc, int callnum, LiveProcess *process,
         return -ENOTTY;
 
       default:
-        fatal("Unsupported ioctl call: ioctl(%d, 0x%x, ...) @ 0x%llx\n",
-              fd, req, tc->readPC());
+        fatal("Unsupported ioctl call: ioctl(%d, 0x%x, ...) @ \n",
+              fd, req, tc->pcState());
     }
 }
 
@@ -1189,7 +1190,7 @@ timesFunc(SyscallDesc *desc, int callnum, LiveProcess *process,
     TypedBufferArg<typename OS::tms> bufp(process->getSyscallArg(tc, index));
 
     // Fill in the time structure (in clocks)
-    int64_t clocks = curTick * OS::M5_SC_CLK_TCK / SimClock::Int::s;
+    int64_t clocks = curTick() * OS::M5_SC_CLK_TCK / SimClock::Int::s;
     bufp->tms_utime = clocks;
     bufp->tms_stime = 0;
     bufp->tms_cutime = 0;