writeBlob will probably do what you want. Make sure to do endian
conversion on it first. Does the system call really return the time? Or
does it return success or failure? I honestly don't know, but returning
a success/error code seems more likely.
Gabe
Vince Weaver wrote:
> This implements the time syscall. It should probably somehow
> flush the changed value back out to the memory subsystem, I wasn't sure
> how to do that when it's an int (and not a structure) being written out.
>
>
> diff -r 1cc467793e1c src/arch/x86/linux/linux.hh
> --- a/src/arch/x86/linux/linux.hh Mon Sep 21 23:16:48 2009 -0400
> +++ b/src/arch/x86/linux/linux.hh Mon Sep 21 23:37:15 2009 -0400
> @@ -127,6 +127,8 @@
> uint64_t mem_unit; /* Memory unit size in bytes */
> } tgt_sysinfo;
>
> + typedef uint64_t timet;
> +
> };
>
> class X86Linux32 : public Linux
> @@ -191,6 +193,9 @@
> uint32_t freehigh; /* Available high memory size */
> uint32_t mem_unit; /* Memory unit size in bytes */
> } tgt_sysinfo;
> +
> + typedef uint32_t timet;
> +
> };
>
> #endif
> diff -r 1cc467793e1c src/arch/x86/linux/syscalls.cc
> --- a/src/arch/x86/linux/syscalls.cc Mon Sep 21 23:16:48 2009 -0400
> +++ b/src/arch/x86/linux/syscalls.cc Mon Sep 21 23:37:15 2009 -0400
> @@ -429,7 +429,7 @@
> /* 198 */ SyscallDesc("lremovexattr", unimplementedFunc),
> /* 199 */ SyscallDesc("fremovexattr", unimplementedFunc),
> /* 200 */ SyscallDesc("tkill", unimplementedFunc),
> - /* 201 */ SyscallDesc("time", unimplementedFunc),
> + /* 201 */ SyscallDesc("time", timeFunc<X86Linux64>),
> /* 202 */ SyscallDesc("futex", ignoreFunc),
> /* 203 */ SyscallDesc("sched_setaffinity", unimplementedFunc),
> /* 204 */ SyscallDesc("sched_getaffinity", unimplementedFunc),
> @@ -520,7 +520,7 @@
> /* 10 */ SyscallDesc("unlink", unimplementedFunc),
> /* 11 */ SyscallDesc("execve", unimplementedFunc),
> /* 12 */ SyscallDesc("chdir", unimplementedFunc),
> - /* 13 */ SyscallDesc("time", unimplementedFunc),
> + /* 13 */ SyscallDesc("time", timeFunc<X86Linux32>),
> /* 14 */ SyscallDesc("mknod", unimplementedFunc),
> /* 15 */ SyscallDesc("chmod", unimplementedFunc),
> /* 16 */ SyscallDesc("lchown", unimplementedFunc),
> diff -r 1cc467793e1c src/sim/syscall_emul.hh
> --- a/src/sim/syscall_emul.hh Mon Sep 21 23:16:48 2009 -0400
> +++ b/src/sim/syscall_emul.hh Mon Sep 21 23:37:15 2009 -0400
> @@ -1034,6 +1034,24 @@
> return 0;
> }
>
> +/// Target time() handler.
> +template <class OS>
> +SyscallReturn
> +timeFunc(SyscallDesc *desc, int callnum, LiveProcess *process,
> + ThreadContext *tc)
> +{
> + TypedBufferArg<typename OS::timet> tp(process->getSyscallArg(tc, 0));
> +
> + struct timeval hostTimeval;
> + getElapsedTime(hostTimeval.tv_sec, hostTimeval.tv_usec);
> +
> + if (tp!=NULL) {
> + *tp=seconds_since_epoch+hostTimeval.tv_sec;
> + }
> + return seconds_since_epoch+hostTimeval.tv_sec;
> +
> +}
> +
>
> /// Target utimes() handler.
> template <class OS>
> _______________________________________________
> m5-dev mailing list
> [email protected]
> http://m5sim.org/mailman/listinfo/m5-dev
>
_______________________________________________
m5-dev mailing list
[email protected]
http://m5sim.org/mailman/listinfo/m5-dev