changeset 4e3bf51208ba in /z/repo/gem5
details: http://repo.gem5.org/gem5?cmd=changeset;node=4e3bf51208ba
description:
        syscall_emul: Implement clock_getres() system call

        This patch implements the clock_getres() system call for arm and x86 in 
linux
        SE mode.

diffstat:

 src/arch/arm/linux/process.cc |   2 +-
 src/arch/x86/linux/process.cc |   2 +-
 src/sim/syscall_emul.hh       |  17 +++++++++++++++++
 3 files changed, 19 insertions(+), 2 deletions(-)

diffs (51 lines):

diff -r b318499f676c -r 4e3bf51208ba src/arch/arm/linux/process.cc
--- a/src/arch/arm/linux/process.cc     Wed Feb 10 04:08:27 2016 -0500
+++ b/src/arch/arm/linux/process.cc     Sat Feb 13 12:33:07 2016 -0500
@@ -383,7 +383,7 @@
     /* 261 */ SyscallDesc("timer_delete", unimplementedFunc),
     /* 262 */ SyscallDesc("clock_settime", unimplementedFunc),
     /* 263 */ SyscallDesc("clock_gettime", clock_gettimeFunc<ArmLinux32>),
-    /* 264 */ SyscallDesc("clock_getres", unimplementedFunc),
+    /* 264 */ SyscallDesc("clock_getres", clock_getresFunc<ArmLinux32>),
     /* 265 */ SyscallDesc("clock_nanosleep", unimplementedFunc),
     /* 266 */ SyscallDesc("statfs64", unimplementedFunc),
     /* 267 */ SyscallDesc("fstatfs64", unimplementedFunc),
diff -r b318499f676c -r 4e3bf51208ba src/arch/x86/linux/process.cc
--- a/src/arch/x86/linux/process.cc     Wed Feb 10 04:08:27 2016 -0500
+++ b/src/arch/x86/linux/process.cc     Sat Feb 13 12:33:07 2016 -0500
@@ -447,7 +447,7 @@
     /* 226 */ SyscallDesc("timer_delete", unimplementedFunc),
     /* 227 */ SyscallDesc("clock_settime", unimplementedFunc),
     /* 228 */ SyscallDesc("clock_gettime", clock_gettimeFunc<X86Linux64>),
-    /* 229 */ SyscallDesc("clock_getres", unimplementedFunc),
+    /* 229 */ SyscallDesc("clock_getres", clock_getresFunc<X86Linux64>),
     /* 230 */ SyscallDesc("clock_nanosleep", unimplementedFunc),
     /* 231 */ SyscallDesc("exit_group", exitGroupFunc),
     /* 232 */ SyscallDesc("epoll_wait", unimplementedFunc),
diff -r b318499f676c -r 4e3bf51208ba src/sim/syscall_emul.hh
--- a/src/sim/syscall_emul.hh   Wed Feb 10 04:08:27 2016 -0500
+++ b/src/sim/syscall_emul.hh   Sat Feb 13 12:33:07 2016 -0500
@@ -1357,6 +1357,23 @@
     return 0;
 }
 
+/// Target clock_getres() function.
+template <class OS>
+SyscallReturn
+clock_getresFunc(SyscallDesc *desc, int num, LiveProcess *p, ThreadContext *tc)
+{
+    int index = 1;
+    TypedBufferArg<typename OS::timespec> tp(p->getSyscallArg(tc, index));
+
+    // Set resolution at ns, which is what clock_gettime() returns
+    tp->tv_sec = 0;
+    tp->tv_nsec = 1;
+
+    tp.copyOut(tc->getMemProxy());
+
+    return 0;
+}
+
 /// Target gettimeofday() handler.
 template <class OS>
 SyscallReturn
_______________________________________________
gem5-dev mailing list
[email protected]
http://m5sim.org/mailman/listinfo/gem5-dev

Reply via email to