From: Michael LeBeane Date: Sat, 13 Feb 2016 17:33:07 +0000 (-0500) Subject: syscall_emul: Implement clock_getres() system call X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=8d923c7380f1d5a1418c1d4b71cd4cfc63429448;p=gem5.git syscall_emul: Implement clock_getres() system call This patch implements the clock_getres() system call for arm and x86 in linux SE mode. --- diff --git a/src/arch/arm/linux/process.cc b/src/arch/arm/linux/process.cc index 89a085002..48aebadc8 100644 --- a/src/arch/arm/linux/process.cc +++ b/src/arch/arm/linux/process.cc @@ -383,7 +383,7 @@ static SyscallDesc syscallDescs32[] = { /* 261 */ SyscallDesc("timer_delete", unimplementedFunc), /* 262 */ SyscallDesc("clock_settime", unimplementedFunc), /* 263 */ SyscallDesc("clock_gettime", clock_gettimeFunc), - /* 264 */ SyscallDesc("clock_getres", unimplementedFunc), + /* 264 */ SyscallDesc("clock_getres", clock_getresFunc), /* 265 */ SyscallDesc("clock_nanosleep", unimplementedFunc), /* 266 */ SyscallDesc("statfs64", unimplementedFunc), /* 267 */ SyscallDesc("fstatfs64", unimplementedFunc), diff --git a/src/arch/x86/linux/process.cc b/src/arch/x86/linux/process.cc index 5bb237c10..9651f7436 100644 --- a/src/arch/x86/linux/process.cc +++ b/src/arch/x86/linux/process.cc @@ -447,7 +447,7 @@ static SyscallDesc syscallDescs64[] = { /* 226 */ SyscallDesc("timer_delete", unimplementedFunc), /* 227 */ SyscallDesc("clock_settime", unimplementedFunc), /* 228 */ SyscallDesc("clock_gettime", clock_gettimeFunc), - /* 229 */ SyscallDesc("clock_getres", unimplementedFunc), + /* 229 */ SyscallDesc("clock_getres", clock_getresFunc), /* 230 */ SyscallDesc("clock_nanosleep", unimplementedFunc), /* 231 */ SyscallDesc("exit_group", exitGroupFunc), /* 232 */ SyscallDesc("epoll_wait", unimplementedFunc), diff --git a/src/sim/syscall_emul.hh b/src/sim/syscall_emul.hh index ee305fbe9..bff7b79a4 100644 --- a/src/sim/syscall_emul.hh +++ b/src/sim/syscall_emul.hh @@ -1357,6 +1357,23 @@ clock_gettimeFunc(SyscallDesc *desc, int num, LiveProcess *p, ThreadContext *tc) return 0; } +/// Target clock_getres() function. +template +SyscallReturn +clock_getresFunc(SyscallDesc *desc, int num, LiveProcess *p, ThreadContext *tc) +{ + int index = 1; + TypedBufferArg 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 SyscallReturn