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