syscall_emul.hh (6683:5e0fcc528fe5) syscall_emul.hh (6684:04cba5a03e2e)
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;

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

1151
1152 // Write back
1153 bufp.copyOut(tc->getMemPort());
1154
1155 // Return clock ticks since system boot
1156 return clocks;
1157}
1158
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;

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

1151
1152 // Write back
1153 bufp.copyOut(tc->getMemPort());
1154
1155 // Return clock ticks since system boot
1156 return clocks;
1157}
1158
1159/// Target time() function.
1160template <class OS>
1161SyscallReturn
1162timeFunc(SyscallDesc *desc, int callnum, LiveProcess *process,
1163 ThreadContext *tc)
1164{
1165 typename OS::time_t sec, usec;
1166 getElapsedTime(sec, usec);
1167 sec += seconds_since_epoch;
1159
1168
1169 Addr taddr = (Addr)process->getSyscallArg(tc, 0);
1170 if(taddr != 0) {
1171 typename OS::time_t t = sec;
1172 t = htog(t);
1173 TranslatingPort *p = tc->getMemPort();
1174 p->writeBlob(taddr, (uint8_t*)&t, (int)sizeof(typename OS::time_t));
1175 }
1176 return sec;
1177}
1160
1178
1179
1161#endif // __SIM_SYSCALL_EMUL_HH__
1180#endif // __SIM_SYSCALL_EMUL_HH__