There's a copyOut() method on TypedBufferArg (inherited from BaseBufferArg) specifically for this purpose, so just add tp.copyOut(rc->getMemPort()) right after the assignment . It's just a wrapper around writeBlob (for now), but it's nice in that it handles the size etc. for you.
Steve On Wed, Sep 23, 2009 at 1:35 AM, Timothy M Jones <[email protected]> wrote: > I did send in a patch for this syscall, yes. I used writeBlob to send the > value back to memory. > > Incidentally, I saw Vince needed ftruncate64 to be implemented. I also > sent in a patch for that too. Do you want me to do anything with those > patches or can they just be added as they are (do I do that - if so how?) > > Cheers > Tim > > On Tue, 22 Sep 2009 15:57:01 +0100, Korey Sewell <[email protected]> wrote: >> I saw a similar patch (for a time-syscall) from a Timothy Jones (?) on >> the >> list-serv .... >> >> Is this the same thing? Did anyone import Timothy's patches into their >> queue? >> >> On Tue, Sep 22, 2009 at 12:20 AM, Vince Weaver >> <[email protected]>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 >>> >> >> >> > > > -- > The University of Edinburgh is a charitable body, registered in > Scotland, with registration number SC005336. > > _______________________________________________ > 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
