syscall_emul.hh (6744:408673e38566) syscall_emul.hh (7064:586b0e3a12b3)
1/*
2 * Copyright (c) 2003-2005 The Regents of The University of Michigan
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are
7 * met: redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer;

--- 346 unchanged lines hidden (view full) ---

355const unsigned seconds_since_epoch = 1000000000;
356
357/// Helper function to convert current elapsed time to seconds and
358/// microseconds.
359template <class T1, class T2>
360void
361getElapsedTime(T1 &sec, T2 &usec)
362{
1/*
2 * Copyright (c) 2003-2005 The Regents of The University of Michigan
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are
7 * met: redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer;

--- 346 unchanged lines hidden (view full) ---

355const unsigned seconds_since_epoch = 1000000000;
356
357/// Helper function to convert current elapsed time to seconds and
358/// microseconds.
359template <class T1, class T2>
360void
361getElapsedTime(T1 &sec, T2 &usec)
362{
363 int elapsed_usecs = curTick / Clock::Int::us;
363 int elapsed_usecs = curTick / SimClock::Int::us;
364 sec = elapsed_usecs / one_million;
365 usec = elapsed_usecs % one_million;
366}
367
368//////////////////////////////////////////////////////////////////////
369//
370// The following emulation functions are generic, but need to be
371// templated to account for differences in types, constants, etc.

--- 810 unchanged lines hidden (view full) ---

1182SyscallReturn
1183timesFunc(SyscallDesc *desc, int callnum, LiveProcess *process,
1184 ThreadContext *tc)
1185{
1186 int index = 0;
1187 TypedBufferArg<typename OS::tms> bufp(process->getSyscallArg(tc, index));
1188
1189 // Fill in the time structure (in clocks)
364 sec = elapsed_usecs / one_million;
365 usec = elapsed_usecs % one_million;
366}
367
368//////////////////////////////////////////////////////////////////////
369//
370// The following emulation functions are generic, but need to be
371// templated to account for differences in types, constants, etc.

--- 810 unchanged lines hidden (view full) ---

1182SyscallReturn
1183timesFunc(SyscallDesc *desc, int callnum, LiveProcess *process,
1184 ThreadContext *tc)
1185{
1186 int index = 0;
1187 TypedBufferArg<typename OS::tms> bufp(process->getSyscallArg(tc, index));
1188
1189 // Fill in the time structure (in clocks)
1190 int64_t clocks = curTick * OS::M5_SC_CLK_TCK / Clock::Int::s;
1190 int64_t clocks = curTick * OS::M5_SC_CLK_TCK / SimClock::Int::s;
1191 bufp->tms_utime = clocks;
1192 bufp->tms_stime = 0;
1193 bufp->tms_cutime = 0;
1194 bufp->tms_cstime = 0;
1195
1196 // Convert to host endianness
1197 bufp->tms_utime = htog(bufp->tms_utime);
1198

--- 30 unchanged lines hidden ---
1191 bufp->tms_utime = clocks;
1192 bufp->tms_stime = 0;
1193 bufp->tms_cutime = 0;
1194 bufp->tms_cstime = 0;
1195
1196 // Convert to host endianness
1197 bufp->tms_utime = htog(bufp->tms_utime);
1198

--- 30 unchanged lines hidden ---