syscall_emul.cc (3669:3607aaed36b6) syscall_emul.cc (4118:ddd23e5282d7)
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;

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

179
180 off_t result = lseek(fd, offs, whence);
181
182 return (result == (off_t)-1) ? -errno : result;
183}
184
185
186SyscallReturn
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;

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

179
180 off_t result = lseek(fd, offs, whence);
181
182 return (result == (off_t)-1) ? -errno : result;
183}
184
185
186SyscallReturn
187_llseekFunc(SyscallDesc *desc, int num, LiveProcess *p, ThreadContext *tc)
188{
189 int fd = p->sim_fd(tc->getSyscallArg(0));
190 uint64_t offset_high = tc->getSyscallArg(1);
191 uint32_t offset_low = tc->getSyscallArg(2);
192 Addr result_ptr = tc->getSyscallArg(3);
193 int whence = tc->getSyscallArg(4);
194
195 uint64_t offset = (offset_high << 32) | offset_low;
196
197 uint64_t result = lseek(fd, offset, whence);
198 result = TheISA::htog(result);
199
200 if (result == (off_t)-1) {
201 //The seek failed.
202 return -errno;
203 } else {
204 //The seek succeeded.
205 //Copy "result" to "result_ptr"
206 //XXX We'll assume that the size of loff_t is 64 bits on the
207 //target platform
208 BufferArg result_buf(result_ptr, sizeof(result));
209 memcpy(result_buf.bufferPtr(), &result, sizeof(result));
210 result_buf.copyOut(tc->getMemPort());
211 return 0;
212 }
213
214
215 return (result == (off_t)-1) ? -errno : result;
216}
217
218
219SyscallReturn
187munmapFunc(SyscallDesc *desc, int num, LiveProcess *p, ThreadContext *tc)
188{
189 // given that we don't really implement mmap, munmap is really easy
190 return 0;
191}
192
193
194const char *hostname = "m5.eecs.umich.edu";

--- 320 unchanged lines hidden ---
220munmapFunc(SyscallDesc *desc, int num, LiveProcess *p, ThreadContext *tc)
221{
222 // given that we don't really implement mmap, munmap is really easy
223 return 0;
224}
225
226
227const char *hostname = "m5.eecs.umich.edu";

--- 320 unchanged lines hidden ---