changeset 04cba5a03e2e in /z/repo/m5
details: http://repo.m5sim.org/m5?cmd=changeset;node=04cba5a03e2e
description:
        syscall: Implementation of the time system call.

diffstat:

2 files changed, 20 insertions(+)
src/kern/linux/linux.hh |    1 +
src/sim/syscall_emul.hh |   19 +++++++++++++++++++

diffs (40 lines):

diff -r 5e0fcc528fe5 -r 04cba5a03e2e src/kern/linux/linux.hh
--- a/src/kern/linux/linux.hh   Sat Oct 24 10:53:57 2009 -0700
+++ b/src/kern/linux/linux.hh   Sat Oct 24 10:53:57 2009 -0700
@@ -62,6 +62,7 @@
     typedef uint64_t size_t;
     typedef uint64_t off_t;
     typedef int64_t time_t;
+    typedef int64_t clock_t;
     typedef uint32_t uid_t;
     typedef uint32_t gid_t;
     //@}
diff -r 5e0fcc528fe5 -r 04cba5a03e2e src/sim/syscall_emul.hh
--- a/src/sim/syscall_emul.hh   Sat Oct 24 10:53:57 2009 -0700
+++ b/src/sim/syscall_emul.hh   Sat Oct 24 10:53:57 2009 -0700
@@ -1156,6 +1156,25 @@
     return clocks;
 }
 
+/// Target time() function.
+template <class OS>
+SyscallReturn
+timeFunc(SyscallDesc *desc, int callnum, LiveProcess *process,
+           ThreadContext *tc)
+{
+    typename OS::time_t sec, usec;
+    getElapsedTime(sec, usec);
+    sec += seconds_since_epoch;
+
+    Addr taddr = (Addr)process->getSyscallArg(tc, 0);
+    if(taddr != 0) {
+        typename OS::time_t t = sec;
+        t = htog(t);
+        TranslatingPort *p = tc->getMemPort();
+        p->writeBlob(taddr, (uint8_t*)&t, (int)sizeof(typename OS::time_t));
+    }
+    return sec;
+}
 
 
 #endif // __SIM_SYSCALL_EMUL_HH__
_______________________________________________
m5-dev mailing list
[email protected]
http://m5sim.org/mailman/listinfo/m5-dev

Reply via email to