process.cc revision 2686
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;
9 * redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the
11 * documentation and/or other materials provided with the distribution;
12 * neither the name of the copyright holders nor the names of its
13 * contributors may be used to endorse or promote products derived from
14 * this software without specific prior written permission.
15 *
16 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
17 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
18 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
19 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
20 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
21 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
22 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
23 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
24 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
26 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27 *
28 * Authors: Korey Sewell
29 */
30
31#include "arch/mips/linux/linux.hh"
32#include "arch/mips/linux/process.hh"
33#include "arch/mips/isa_traits.hh"
34
35#include "base/trace.hh"
36#include "cpu/thread_context.hh"
37#include "kern/linux/linux.hh"
38
39#include "sim/process.hh"
40#include "sim/syscall_emul.hh"
41
42using namespace std;
43using namespace MipsISA;
44
45/// Target uname() handler.
46static SyscallReturn
47unameFunc(SyscallDesc *desc, int callnum, Process *process,
48          ThreadContext *tc)
49{
50    TypedBufferArg<Linux::utsname> name(tc->getSyscallArg(0));
51
52    strcpy(name->sysname, "Linux");
53    strcpy(name->nodename, "m5.eecs.umich.edu");
54    strcpy(name->release, "2.4.20");
55    strcpy(name->version, "#1 Mon Aug 18 11:32:15 EDT 2003");
56    strcpy(name->machine, "mips");
57
58    name.copyOut(tc->getMemPort());
59    return 0;
60}
61
62/// Target sys_getsysyinfo() handler.  Even though this call is
63/// borrowed from Tru64, the subcases that get used appear to be
64/// different in practice from those used by Tru64 processes.
65static SyscallReturn
66sys_getsysinfoFunc(SyscallDesc *desc, int callnum, Process *process,
67                   ThreadContext *tc)
68{
69    unsigned op = tc->getSyscallArg(0);
70    // unsigned nbytes = tc->getSyscallArg(2);
71
72    switch (op) {
73
74      case 45: { // GSI_IEEE_FP_CONTROL
75          TypedBufferArg<uint64_t> fpcr(tc->getSyscallArg(1));
76          // I don't think this exactly matches the HW FPCR
77          *fpcr = 0;
78          fpcr.copyOut(tc->getMemPort());
79          return 0;
80      }
81
82      default:
83        cerr << "sys_getsysinfo: unknown op " << op << endl;
84        abort();
85        break;
86    }
87
88    return 1;
89}
90
91/// Target sys_setsysinfo() handler.
92static SyscallReturn
93sys_setsysinfoFunc(SyscallDesc *desc, int callnum, Process *process,
94                   ThreadContext *tc)
95{
96    unsigned op = tc->getSyscallArg(0);
97    // unsigned nbytes = tc->getSyscallArg(2);
98
99    switch (op) {
100
101      case 14: { // SSI_IEEE_FP_CONTROL
102          TypedBufferArg<uint64_t> fpcr(tc->getSyscallArg(1));
103          // I don't think this exactly matches the HW FPCR
104          fpcr.copyIn(tc->getMemPort());
105          DPRINTFR(SyscallVerbose, "sys_setsysinfo(SSI_IEEE_FP_CONTROL): "
106                   " setting FPCR to 0x%x\n", gtoh(*(uint64_t*)fpcr));
107          return 0;
108      }
109
110      default:
111        cerr << "sys_setsysinfo: unknown op " << op << endl;
112        abort();
113        break;
114    }
115
116    return 1;
117}
118
119
120SyscallDesc MipsLinuxProcess::syscallDescs[] = {
121    /*  0 */ SyscallDesc("syscall", unimplementedFunc),
122    /*  1 */ SyscallDesc("exit", exitFunc),
123    /*  2 */ SyscallDesc("fork", unimplementedFunc),
124    /*  3 */ SyscallDesc("read", readFunc),
125    /*  4 */ SyscallDesc("write", writeFunc),
126    /*  5 */ SyscallDesc("open", openFunc<MipsLinux>),
127    /*  6 */ SyscallDesc("close", closeFunc),
128    /*  7 */ SyscallDesc("waitpid", unimplementedFunc),
129    /*  8 */ SyscallDesc("creat", unimplementedFunc),
130    /*  9 */ SyscallDesc("link", unimplementedFunc),
131    /* 10 */ SyscallDesc("unlink", unlinkFunc),
132    /* 11 */ SyscallDesc("execve", unimplementedFunc),
133    /* 12 */ SyscallDesc("chdir", unimplementedFunc),
134    /* 13 */ SyscallDesc("time", unimplementedFunc),
135    /* 14 */ SyscallDesc("mknod", unimplementedFunc),
136    /* 15 */ SyscallDesc("chmod", chmodFunc<MipsLinux>),
137    /* 16 */ SyscallDesc("lchown", chownFunc),
138    /* 17 */ SyscallDesc("break", obreakFunc),
139    /* 18 */ SyscallDesc("unused#18", unimplementedFunc),
140    /* 19 */ SyscallDesc("lseek", lseekFunc),
141    /* 20 */ SyscallDesc("getpid", getpidFunc),
142    /* 21 */ SyscallDesc("mount", unimplementedFunc),
143    /* 22 */ SyscallDesc("umount", unimplementedFunc),
144    /* 23 */ SyscallDesc("setuid", setuidFunc),
145    /* 24 */ SyscallDesc("getuid", getuidFunc),
146    /* 25 */ SyscallDesc("stime", unimplementedFunc),
147    /* 26 */ SyscallDesc("ptrace", unimplementedFunc),
148    /* 27 */ SyscallDesc("alarm", unimplementedFunc),
149    /* 28 */ SyscallDesc("unused#28", unimplementedFunc),
150    /* 29 */ SyscallDesc("pause", unimplementedFunc),
151    /* 30 */ SyscallDesc("utime", unimplementedFunc),
152    /* 31 */ SyscallDesc("stty", unimplementedFunc),
153    /* 32 */ SyscallDesc("gtty", unimplementedFunc),
154    /* 33 */ SyscallDesc("access", unimplementedFunc),
155    /* 34 */ SyscallDesc("nice", unimplementedFunc),
156    /* 35 */ SyscallDesc("ftime", unimplementedFunc),
157    /* 36 */ SyscallDesc("sync", unimplementedFunc),
158    /* 37 */ SyscallDesc("kill", ignoreFunc),
159    /* 38 */ SyscallDesc("rename", unimplementedFunc),
160    /* 39 */ SyscallDesc("mkdir", unimplementedFunc),
161    /* 40 */ SyscallDesc("rmdir", unimplementedFunc),
162    /* 41 */ SyscallDesc("dup", unimplementedFunc),
163    /* 42 */ SyscallDesc("pipe", unimplementedFunc),
164    /* 43 */ SyscallDesc("times", unimplementedFunc),
165    /* 44 */ SyscallDesc("prof", unimplementedFunc),
166    /* 45 */ SyscallDesc("brk", obreakFunc),
167    /* 46 */ SyscallDesc("setgid", unimplementedFunc),
168    /* 47 */ SyscallDesc("getgid", getgidFunc),
169    /* 48 */ SyscallDesc("signal", ignoreFunc),
170    /* 49 */ SyscallDesc("geteuid", geteuidFunc),
171    /* 50 */ SyscallDesc("getegid", getegidFunc),
172    /* 51 */ SyscallDesc("acct", unimplementedFunc),
173    /* 52 */ SyscallDesc("umount2", unimplementedFunc),
174    /* 53 */ SyscallDesc("lock", unimplementedFunc),
175    /* 54 */ SyscallDesc("ioctl", ioctlFunc<MipsLinux>),
176    /* 55 */ SyscallDesc("fcntl", fcntlFunc),
177    /* 56 */ SyscallDesc("mpx", unimplementedFunc),
178    /* 57 */ SyscallDesc("setpgid", unimplementedFunc),
179    /* 58 */ SyscallDesc("ulimit", unimplementedFunc),
180    /* 59 */ SyscallDesc("unused#59", unimplementedFunc),
181    /* 60 */ SyscallDesc("umask", unimplementedFunc),
182    /* 61 */ SyscallDesc("chroot", unimplementedFunc),
183    /* 62 */ SyscallDesc("ustat", unimplementedFunc),
184    /* 63 */ SyscallDesc("dup2", unimplementedFunc),
185    /* 64 */ SyscallDesc("getppid", getpagesizeFunc),
186    /* 65 */ SyscallDesc("getpgrp", unimplementedFunc),
187    /* 66 */ SyscallDesc("setsid", unimplementedFunc),
188    /* 67 */ SyscallDesc("sigaction",unimplementedFunc),
189    /* 68 */ SyscallDesc("sgetmask", unimplementedFunc),
190    /* 69 */ SyscallDesc("ssetmask", unimplementedFunc),
191    /* 70 */ SyscallDesc("setreuid", unimplementedFunc),
192    /* 71 */ SyscallDesc("setregid", unimplementedFunc),
193    /* 72 */ SyscallDesc("sigsuspend", unimplementedFunc),
194    /* 73 */ SyscallDesc("sigpending", unimplementedFunc),
195    /* 74 */ SyscallDesc("sethostname", ignoreFunc),
196    /* 75 */ SyscallDesc("setrlimit", unimplementedFunc),
197    /* 76 */ SyscallDesc("getrlimit", unimplementedFunc),
198    /* 77 */ SyscallDesc("getrusage", unimplementedFunc),
199    /* 78 */ SyscallDesc("gettimeofday", unimplementedFunc),
200    /* 79 */ SyscallDesc("settimeofday", unimplementedFunc),
201    /* 80 */ SyscallDesc("getgroups", unimplementedFunc),
202    /* 81 */ SyscallDesc("setgroups", unimplementedFunc),
203    /* 82 */ SyscallDesc("reserved#82", unimplementedFunc),
204    /* 83 */ SyscallDesc("symlink", unimplementedFunc),
205    /* 84 */ SyscallDesc("unused#84", unimplementedFunc),
206    /* 85 */ SyscallDesc("readlink", unimplementedFunc),
207    /* 86 */ SyscallDesc("uselib", unimplementedFunc),
208    /* 87 */ SyscallDesc("swapon", gethostnameFunc),
209    /* 88 */ SyscallDesc("reboot", unimplementedFunc),
210    /* 89 */ SyscallDesc("readdir", unimplementedFunc),
211    /* 90 */ SyscallDesc("mmap", mmapFunc<MipsLinux>),
212    /* 91 */ SyscallDesc("munmap",munmapFunc),
213    /* 92 */ SyscallDesc("truncate", truncateFunc),
214    /* 93 */ SyscallDesc("ftruncate", ftruncateFunc),
215    /* 94 */ SyscallDesc("fchmod", unimplementedFunc),
216    /* 95 */ SyscallDesc("fchown", unimplementedFunc),
217    /* 96 */ SyscallDesc("getpriority", unimplementedFunc),
218    /* 97 */ SyscallDesc("setpriority", unimplementedFunc),
219    /* 98 */ SyscallDesc("profil", unimplementedFunc),
220    /* 99 */ SyscallDesc("statfs", unimplementedFunc),
221    /* 100 */ SyscallDesc("fstatfs", unimplementedFunc),
222    /* 101 */ SyscallDesc("ioperm", unimplementedFunc),
223    /* 102 */ SyscallDesc("socketcall", unimplementedFunc),
224    /* 103 */ SyscallDesc("syslog", unimplementedFunc),
225    /* 104 */ SyscallDesc("setitimer", unimplementedFunc),
226    /* 105 */ SyscallDesc("getitimer", unimplementedFunc),
227    /* 106 */ SyscallDesc("stat",  statFunc<MipsLinux>),
228    /* 107 */ SyscallDesc("lstat", unimplementedFunc),
229    /* 108 */ SyscallDesc("fstat", fstatFunc<MipsLinux>),
230    /* 109 */ SyscallDesc("unused#109", unimplementedFunc),
231    /* 110 */ SyscallDesc("iopl", unimplementedFunc),
232    /* 111 */ SyscallDesc("vhangup", unimplementedFunc),
233    /* 112 */ SyscallDesc("idle", ignoreFunc),
234    /* 113 */ SyscallDesc("vm86", unimplementedFunc),
235    /* 114 */ SyscallDesc("wait4", unimplementedFunc),
236    /* 115 */ SyscallDesc("swapoff", unimplementedFunc),
237    /* 116 */ SyscallDesc("sysinfo", unimplementedFunc),
238    /* 117 */ SyscallDesc("ipc", unimplementedFunc),
239    /* 118 */ SyscallDesc("fsync", unimplementedFunc),
240    /* 119 */ SyscallDesc("sigreturn", unimplementedFunc),
241    /* 120 */ SyscallDesc("clone", unimplementedFunc),
242    /* 121 */ SyscallDesc("setdomainname", unimplementedFunc),
243    /* 122 */ SyscallDesc("uname", unameFunc),
244    /* 123 */ SyscallDesc("modify_ldt", unimplementedFunc),
245    /* 124 */ SyscallDesc("adjtimex", unimplementedFunc),
246    /* 125 */ SyscallDesc("mprotect", ignoreFunc),
247    /* 126 */ SyscallDesc("sigprocmask", unimplementedFunc),
248    /* 127 */ SyscallDesc("create_module", unimplementedFunc),
249    /* 128 */ SyscallDesc("init_module", unimplementedFunc),
250    /* 129 */ SyscallDesc("delete_module", unimplementedFunc),
251    /* 130 */ SyscallDesc("get_kernel_syms", unimplementedFunc),
252    /* 131 */ SyscallDesc("quotactl", unimplementedFunc),
253    /* 132 */ SyscallDesc("getpgid", unimplementedFunc),
254    /* 133 */ SyscallDesc("fchdir", unimplementedFunc),
255    /* 134 */ SyscallDesc("bdflush", unimplementedFunc),
256    /* 135 */ SyscallDesc("sysfs", unimplementedFunc),
257    /* 136 */ SyscallDesc("personality", unimplementedFunc),
258    /* 137 */ SyscallDesc("afs_syscall", unimplementedFunc),
259    /* 138 */ SyscallDesc("setfsuid", unimplementedFunc),
260    /* 139 */ SyscallDesc("setfsgid", unimplementedFunc),
261    /* 140 */ SyscallDesc("llseek", unimplementedFunc),
262    /* 141 */ SyscallDesc("getdents", unimplementedFunc),
263    /* 142 */ SyscallDesc("newselect", unimplementedFunc),
264    /* 143 */ SyscallDesc("flock", unimplementedFunc),
265    /* 144 */ SyscallDesc("msync", unimplementedFunc),
266    /* 145 */ SyscallDesc("readv", unimplementedFunc),
267    /* 146 */ SyscallDesc("writev", writevFunc<MipsLinux>),
268    /* 147 */ SyscallDesc("cacheflush", unimplementedFunc),
269    /* 148 */ SyscallDesc("cachectl", unimplementedFunc),
270    /* 149 */ SyscallDesc("sysmips", unimplementedFunc),
271    /* 150 */ SyscallDesc("unused#150", unimplementedFunc),
272    /* 151 */ SyscallDesc("getsid", unimplementedFunc),
273    /* 152 */ SyscallDesc("fdatasync", unimplementedFunc),
274    /* 153 */ SyscallDesc("sysctl", unimplementedFunc),
275    /* 154 */ SyscallDesc("mlock", unimplementedFunc),
276    /* 155 */ SyscallDesc("munlock", unimplementedFunc),
277    /* 156 */ SyscallDesc("mlockall", unimplementedFunc),
278    /* 157 */ SyscallDesc("munlockall", unimplementedFunc),
279    /* 158 */ SyscallDesc("sched_setparam", unimplementedFunc),
280    /* 159 */ SyscallDesc("sched_getparam", unimplementedFunc),
281    /* 160 */ SyscallDesc("sched_setscheduler", unimplementedFunc),
282    /* 161 */ SyscallDesc("sched_getscheduler", unimplementedFunc),
283    /* 162 */ SyscallDesc("sched_yield", unimplementedFunc),
284    /* 163 */ SyscallDesc("sched_get_prioritymax", unimplementedFunc),
285    /* 164 */ SyscallDesc("sched_get_priority_min", unimplementedFunc),
286    /* 165 */ SyscallDesc("sched_rr_get_interval", unimplementedFunc),
287    /* 166 */ SyscallDesc("nanosleep", unimplementedFunc),
288    /* 167 */ SyscallDesc("mremap", unimplementedFunc),
289    /* 168 */ SyscallDesc("accept", unimplementedFunc),
290    /* 169 */ SyscallDesc("bind", unimplementedFunc),
291    /* 170 */ SyscallDesc("connect", unimplementedFunc),
292    /* 171 */ SyscallDesc("getpeername", unimplementedFunc),
293    /* 172 */ SyscallDesc("getsockname", unimplementedFunc),
294    /* 173 */ SyscallDesc("getsockopt", unimplementedFunc),
295    /* 174 */ SyscallDesc("listen", unimplementedFunc),
296    /* 175 */ SyscallDesc("recv", unimplementedFunc),
297    /* 176 */ SyscallDesc("recvmsg", unimplementedFunc),
298    /* 177 */ SyscallDesc("send", unimplementedFunc),
299    /* 178 */ SyscallDesc("sendmsg", ignoreFunc),
300    /* 179 */ SyscallDesc("sendto", unimplementedFunc),
301    /* 180 */ SyscallDesc("setsockopt", unimplementedFunc),
302    /* 181 */ SyscallDesc("shutdown", unimplementedFunc),
303    /* 182 */ SyscallDesc("unknown #182", unimplementedFunc),
304    /* 183 */ SyscallDesc("socket", ignoreFunc),
305    /* 184 */ SyscallDesc("socketpair", unimplementedFunc),
306    /* 185 */ SyscallDesc("setresuid", unimplementedFunc),
307    /* 186 */ SyscallDesc("getresuid", unimplementedFunc),
308    /* 187 */ SyscallDesc("query_module", unimplementedFunc),
309    /* 188 */ SyscallDesc("poll", unimplementedFunc),
310    /* 189 */ SyscallDesc("nfsservctl", unimplementedFunc),
311    /* 190 */ SyscallDesc("setresgid", unimplementedFunc),
312    /* 191 */ SyscallDesc("getresgid", unimplementedFunc),
313    /* 192 */ SyscallDesc("prctl", unimplementedFunc),
314    /* 193 */ SyscallDesc("rt_sigreturn", unimplementedFunc),
315    /* 194 */ SyscallDesc("rt_sigaction", ignoreFunc),
316    /* 195 */ SyscallDesc("rt_sigprocmask", ignoreFunc),
317    /* 196 */ SyscallDesc("rt_sigpending", unimplementedFunc),
318    /* 197 */ SyscallDesc("rt_sigtimedwait", unimplementedFunc),
319    /* 198 */ SyscallDesc("rt_sigqueueinfo", ignoreFunc),
320    /* 199 */ SyscallDesc("rt_sigsuspend", unimplementedFunc),
321    /* 200 */ SyscallDesc("pread64", unimplementedFunc),
322    /* 201 */ SyscallDesc("pwrite64", unimplementedFunc),
323    /* 202 */ SyscallDesc("chown", unimplementedFunc),
324    /* 203 */ SyscallDesc("getcwd", unimplementedFunc),
325    /* 204 */ SyscallDesc("capget", unimplementedFunc),
326    /* 205 */ SyscallDesc("capset", unimplementedFunc),
327    /* 206 */ SyscallDesc("sigalstack", unimplementedFunc),
328    /* 207 */ SyscallDesc("sendfile", unimplementedFunc),
329    /* 208 */ SyscallDesc("getpmsg", unimplementedFunc),
330    /* 209 */ SyscallDesc("putpmsg", unimplementedFunc),
331    /* 210 */ SyscallDesc("mmap2", unimplementedFunc),
332    /* 211 */ SyscallDesc("truncate64", unimplementedFunc),
333    /* 212 */ SyscallDesc("ftruncate64", unimplementedFunc),
334    /* 213 */ SyscallDesc("stat64", unimplementedFunc),
335    /* 214 */ SyscallDesc("lstat64", lstat64Func<MipsLinux>),
336    /* 215 */ SyscallDesc("fstat64", fstat64Func<MipsLinux>),
337    /* 216 */ SyscallDesc("pivot_root", unimplementedFunc),
338    /* 217 */ SyscallDesc("mincore", unimplementedFunc),
339    /* 218 */ SyscallDesc("madvise", unimplementedFunc),
340    /* 219 */ SyscallDesc("getdents64", unimplementedFunc),
341    /* 220 */ SyscallDesc("fcntl64", fcntl64Func),
342    /* 221 */ SyscallDesc("reserved#221", unimplementedFunc),
343    /* 222 */ SyscallDesc("gettid", unimplementedFunc),
344    /* 223 */ SyscallDesc("readahead", unimplementedFunc),
345    /* 224 */ SyscallDesc("setxattr", unimplementedFunc),
346    /* 225 */ SyscallDesc("lsetxattr", unimplementedFunc),
347    /* 226 */ SyscallDesc("fsetxattr", unimplementedFunc),
348    /* 227 */ SyscallDesc("getxattr", unimplementedFunc),
349    /* 228 */ SyscallDesc("lgetxattr", unimplementedFunc),
350    /* 229 */ SyscallDesc("fgetxattr", unimplementedFunc),
351    /* 230 */ SyscallDesc("listxattr", unimplementedFunc),
352    /* 231 */ SyscallDesc("llistxattr", unimplementedFunc),
353    /* 232 */ SyscallDesc("flistxattr", unimplementedFunc),
354    /* 233 */ SyscallDesc("removexattr", unimplementedFunc),
355    /* 234 */ SyscallDesc("lremovexattr", unimplementedFunc),
356    /* 235 */ SyscallDesc("fremovexattr", ignoreFunc),
357    /* 236 */ SyscallDesc("tkill", unimplementedFunc),
358    /* 237 */ SyscallDesc("sendfile64", unimplementedFunc),
359    /* 238 */ SyscallDesc("futex", unimplementedFunc),
360    /* 239 */ SyscallDesc("sched_setaffinity", unimplementedFunc),
361    /* 240 */ SyscallDesc("sched_getaffinity", unimplementedFunc),
362    /* 241 */ SyscallDesc("io_setup", unimplementedFunc),
363    /* 242 */ SyscallDesc("io_destroy", unimplementedFunc),
364    /* 243 */ SyscallDesc("io_getevents", unimplementedFunc),
365    /* 244 */ SyscallDesc("io_submit", unimplementedFunc),
366    /* 245 */ SyscallDesc("io_cancel", unimplementedFunc),
367    /* 246 */ SyscallDesc("exit_group", exitFunc),
368    /* 247 */ SyscallDesc("lookup_dcookie", unimplementedFunc),
369    /* 248 */ SyscallDesc("epoll_create", unimplementedFunc),
370    /* 249 */ SyscallDesc("epoll_ctl", unimplementedFunc),
371    /* 250 */ SyscallDesc("epoll_wait", unimplementedFunc),
372    /* 251 */ SyscallDesc("remap_file_pages", unimplementedFunc),
373    /* 252 */ SyscallDesc("set_tid_address", unimplementedFunc),
374    /* 253 */ SyscallDesc("restart_syscall", unimplementedFunc),
375    /* 254 */ SyscallDesc("fadvise64", unimplementedFunc),
376    /* 255 */ SyscallDesc("statfs64", unimplementedFunc),
377    /* 256 */ SyscallDesc("fstafs64", unimplementedFunc),
378    /* 257 */ SyscallDesc("timer_create", sys_getsysinfoFunc),
379    /* 258 */ SyscallDesc("timer_settime", sys_setsysinfoFunc),
380    /* 259 */ SyscallDesc("timer_gettime", unimplementedFunc),
381    /* 260 */ SyscallDesc("timer_getoverrun", unimplementedFunc),
382    /* 261 */ SyscallDesc("timer_delete", unimplementedFunc),
383    /* 262 */ SyscallDesc("clock_settime", unimplementedFunc),
384    /* 263 */ SyscallDesc("clock_gettime", unimplementedFunc),
385    /* 264 */ SyscallDesc("clock_getres", unimplementedFunc),
386    /* 265 */ SyscallDesc("clock_nanosleep", unimplementedFunc),
387    /* 266 */ SyscallDesc("tgkill", unimplementedFunc),
388    /* 267 */ SyscallDesc("utimes", unimplementedFunc),
389    /* 268 */ SyscallDesc("mbind", unimplementedFunc),
390    /* 269 */ SyscallDesc("get_mempolicy", unimplementedFunc),
391    /* 270 */ SyscallDesc("set_mempolicy", unimplementedFunc),
392    /* 271 */ SyscallDesc("mq_open", unimplementedFunc),
393    /* 272 */ SyscallDesc("mq_unlink", unimplementedFunc),
394    /* 273 */ SyscallDesc("mq_timedsend", unimplementedFunc),
395    /* 274 */ SyscallDesc("mq_timedreceive", unimplementedFunc),
396    /* 275 */ SyscallDesc("mq_notify", unimplementedFunc),
397    /* 276 */ SyscallDesc("mq_getsetattr", unimplementedFunc),
398    /* 277 */ SyscallDesc("vserver", unimplementedFunc),
399    /* 278 */ SyscallDesc("waitid", unimplementedFunc),
400    /* 279 */ SyscallDesc("unknown #279", unimplementedFunc),
401    /* 280 */ SyscallDesc("add_key", unimplementedFunc),
402    /* 281 */ SyscallDesc("request_key", unimplementedFunc),
403    /* 282 */ SyscallDesc("keyctl", unimplementedFunc),
404};
405
406MipsLinuxProcess::MipsLinuxProcess(const std::string &name,
407                                     ObjectFile *objFile,
408                                     System *system,
409                                     int stdin_fd,
410                                     int stdout_fd,
411                                     int stderr_fd,
412                                     std::vector<std::string> &argv,
413                                     std::vector<std::string> &envp)
414    : MipsLiveProcess(name, objFile, system, stdin_fd, stdout_fd, stderr_fd,
415                      argv, envp),
416     Num_Syscall_Descs(sizeof(syscallDescs) / sizeof(SyscallDesc))
417{ }
418
419SyscallDesc*
420MipsLinuxProcess::getDesc(int callnum)
421{
422    //MIPS32 syscalls are in the range of 4000 - 4999
423    int m5_sys_idx = callnum - 4000;
424
425    if (m5_sys_idx < 0 || m5_sys_idx > Num_Syscall_Descs)
426        return NULL;
427
428    return &syscallDescs[m5_sys_idx];
429}
430