summaryrefslogtreecommitdiff
path: root/src/arch/sparc/linux/process.cc
blob: 8c2de8ca355a5d273fa18223e9b8bf2cb1b517a1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
/*
 * Copyright (c) 2003-2005 The Regents of The University of Michigan
 * All rights reserved.
 *
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions are
 * met: redistributions of source code must retain the above copyright
 * notice, this list of conditions and the following disclaimer;
 * redistributions in binary form must reproduce the above copyright
 * notice, this list of conditions and the following disclaimer in the
 * documentation and/or other materials provided with the distribution;
 * neither the name of the copyright holders nor the names of its
 * contributors may be used to endorse or promote products derived from
 * this software without specific prior written permission.
 *
 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 *
 * Authors: Steve Reinhardt
 *          Gabe Black
 *          Ali Saidi
 */

#include "arch/sparc/isa_traits.hh"
#include "arch/sparc/linux/process.hh"
#include "arch/sparc/regfile.hh"

#include "base/trace.hh"
#include "cpu/thread_context.hh"
#include "kern/linux/linux.hh"

#include "sim/process.hh"
#include "sim/syscall_emul.hh"

using namespace std;
using namespace SparcISA;


/// Target uname() handler.
static SyscallReturn
unameFunc(SyscallDesc *desc, int callnum, Process *process,
          ThreadContext *tc)
{
    TypedBufferArg<Linux::utsname> name(tc->getSyscallArg(0));

    strcpy(name->sysname, "Linux");
    strcpy(name->nodename, "m5.eecs.umich.edu");
    strcpy(name->release, "2.4.20");
    strcpy(name->version, "#1 Mon Aug 18 11:32:15 EDT 2003");
    strcpy(name->machine, "sparc");

    name.copyOut(tc->getMemPort());

    return 0;
}


SyscallReturn SparcISA::getresuidFunc(SyscallDesc *desc, int num,
                                         Process *p, ThreadContext *tc)
{
    const IntReg id = htog(100);
    Addr ruid = tc->getSyscallArg(0);
    Addr euid = tc->getSyscallArg(1);
    Addr suid = tc->getSyscallArg(2);
    //Handle the EFAULT case
    //Set the ruid
    if(ruid)
    {
        BufferArg ruidBuff(ruid, sizeof(IntReg));
        memcpy(ruidBuff.bufferPtr(), &id, sizeof(IntReg));
        ruidBuff.copyOut(tc->getMemPort());
    }
    //Set the euid
    if(euid)
    {
        BufferArg euidBuff(euid, sizeof(IntReg));
        memcpy(euidBuff.bufferPtr(), &id, sizeof(IntReg));
        euidBuff.copyOut(tc->getMemPort());
    }
    //Set the suid
    if(suid)
    {
        BufferArg suidBuff(suid, sizeof(IntReg));
        memcpy(suidBuff.bufferPtr(), &id, sizeof(IntReg));
        suidBuff.copyOut(tc->getMemPort());
    }
    return 0;
}

SyscallDesc SparcLinuxProcess::syscallDescs[] = {
    /*  0 */ SyscallDesc("restart_syscall", unimplementedFunc),
    /*  1 */ SyscallDesc("exit", exitFunc),
    /*  2 */ SyscallDesc("fork", unimplementedFunc),
    /*  3 */ SyscallDesc("read", readFunc),
    /*  4 */ SyscallDesc("write", writeFunc),
    /*  5 */ SyscallDesc("open", openFunc<SparcLinux>),
    /*  6 */ SyscallDesc("close", closeFunc),
    /*  7 */ SyscallDesc("wait4", unimplementedFunc),
    /*  8 */ SyscallDesc("creat", unimplementedFunc),
    /*  9 */ SyscallDesc("link", unimplementedFunc),
    /* 10 */ SyscallDesc("unlink", unlinkFunc),
    /* 11 */ SyscallDesc("execv", unimplementedFunc),
    /* 12 */ SyscallDesc("chdir", unimplementedFunc),
    /* 13 */ SyscallDesc("chown", chownFunc),
    /* 14 */ SyscallDesc("mknod", unimplementedFunc),
    /* 15 */ SyscallDesc("chmod", chmodFunc<Linux>),
    /* 16 */ SyscallDesc("lchown", unimplementedFunc),
    /* 17 */ SyscallDesc("brk", obreakFunc),
    /* 18 */ SyscallDesc("perfctr", unimplementedFunc),
    /* 19 */ SyscallDesc("lseek", lseekFunc),
    /* 20 */ SyscallDesc("getpid", getpidFunc),
    /* 21 */ SyscallDesc("capget", unimplementedFunc),
    /* 22 */ SyscallDesc("capset", unimplementedFunc),
    /* 23 */ SyscallDesc("setuid", setuidFunc),
    /* 24 */ SyscallDesc("getuid", getuidFunc),
    /* 25 */ SyscallDesc("time", unimplementedFunc),
    /* 26 */ SyscallDesc("ptrace", unimplementedFunc),
    /* 27 */ SyscallDesc("alarm", unimplementedFunc),
    /* 28 */ SyscallDesc("sigaltstack", unimplementedFunc),
    /* 29 */ SyscallDesc("pause", unimplementedFunc),
    /* 30 */ SyscallDesc("utime", unimplementedFunc),
    /* 31 */ SyscallDesc("lchown32", unimplementedFunc),
    /* 32 */ SyscallDesc("fchown32", unimplementedFunc),
    /* 33 */ SyscallDesc("access", unimplementedFunc),
    /* 34 */ SyscallDesc("nice", unimplementedFunc),
    /* 35 */ SyscallDesc("chown32", unimplementedFunc),
    /* 36 */ SyscallDesc("sync", unimplementedFunc),
    /* 37 */ SyscallDesc("kill", unimplementedFunc),
    /* 38 */ SyscallDesc("stat", unimplementedFunc),
    /* 39 */ SyscallDesc("sendfile", unimplementedFunc),
    /* 40 */ SyscallDesc("lstat", unimplementedFunc),
    /* 41 */ SyscallDesc("dup", unimplementedFunc),
    /* 42 */ SyscallDesc("pipe", pipePseudoFunc),
    /* 43 */ SyscallDesc("times", unimplementedFunc),
    /* 44 */ SyscallDesc("getuid32", unimplementedFunc),
    /* 45 */ SyscallDesc("umount2", unimplementedFunc),
    /* 46 */ SyscallDesc("setgid", unimplementedFunc),
    /* 47 */ SyscallDesc("getgid", getgidFunc),
    /* 48 */ SyscallDesc("signal", unimplementedFunc),
    /* 49 */ SyscallDesc("geteuid", geteuidFunc),
    /* 50 */ SyscallDesc("getegid", getegidFunc),
    /* 51 */ SyscallDesc("acct", unimplementedFunc),
    /* 52 */ SyscallDesc("memory_ordering", unimplementedFunc),
    /* 53 */ SyscallDesc("getgid32", unimplementedFunc),
    /* 54 */ SyscallDesc("ioctl", unimplementedFunc),
    /* 55 */ SyscallDesc("reboot", unimplementedFunc),
    /* 56 */ SyscallDesc("mmap2", unimplementedFunc),
    /* 57 */ SyscallDesc("symlink", unimplementedFunc),
    /* 58 */ SyscallDesc("readlink", unimplementedFunc),
    /* 59 */ SyscallDesc("execve", unimplementedFunc),
    /* 60 */ SyscallDesc("umask", unimplementedFunc),
    /* 61 */ SyscallDesc("chroot", unimplementedFunc),
    /* 62 */ SyscallDesc("fstat", fstatFunc<SparcLinux>),
    /* 63 */ SyscallDesc("fstat64", unimplementedFunc),
    /* 64 */ SyscallDesc("getpagesize", unimplementedFunc),
    /* 65 */ SyscallDesc("msync", unimplementedFunc),
    /* 66 */ SyscallDesc("vfork", unimplementedFunc),
    /* 67 */ SyscallDesc("pread64", unimplementedFunc),
    /* 68 */ SyscallDesc("pwrite64", unimplementedFunc),
    /* 69 */ SyscallDesc("geteuid32", unimplementedFunc),
    /* 70 */ SyscallDesc("getdgid32", unimplementedFunc),
    /* 71 */ SyscallDesc("mmap", mmapFunc<SparcLinux>),
    /* 72 */ SyscallDesc("setreuid32", unimplementedFunc),
    /* 73 */ SyscallDesc("munmap", munmapFunc),
    /* 74 */ SyscallDesc("mprotect", unimplementedFunc),
    /* 75 */ SyscallDesc("madvise", unimplementedFunc),
    /* 76 */ SyscallDesc("vhangup", unimplementedFunc),
    /* 77 */ SyscallDesc("truncate64", unimplementedFunc),
    /* 78 */ SyscallDesc("mincore", unimplementedFunc),
    /* 79 */ SyscallDesc("getgroups", unimplementedFunc),
    /* 80 */ SyscallDesc("setgroups", unimplementedFunc),
    /* 81 */ SyscallDesc("getpgrp", unimplementedFunc),
    /* 82 */ SyscallDesc("setgroups32", unimplementedFunc),
    /* 83 */ SyscallDesc("setitimer", unimplementedFunc),
    /* 84 */ SyscallDesc("ftruncate64", unimplementedFunc),
    /* 85 */ SyscallDesc("swapon", unimplementedFunc),
    /* 86 */ SyscallDesc("getitimer", unimplementedFunc),
    /* 87 */ SyscallDesc("setuid32", unimplementedFunc),
    /* 88 */ SyscallDesc("sethostname", unimplementedFunc),
    /* 89 */ SyscallDesc("setgid32", unimplementedFunc),
    /* 90 */ SyscallDesc("dup2", unimplementedFunc),
    /* 91 */ SyscallDesc("setfsuid32", unimplementedFunc),
    /* 92 */ SyscallDesc("fcntl", unimplementedFunc),
    /* 93 */ SyscallDesc("select", unimplementedFunc),
    /* 94 */ SyscallDesc("setfsgid32", unimplementedFunc),
    /* 95 */ SyscallDesc("fsync", unimplementedFunc),
    /* 96 */ SyscallDesc("setpriority", unimplementedFunc),
    /* 97 */ SyscallDesc("socket", unimplementedFunc),
    /* 98 */ SyscallDesc("connect", unimplementedFunc),
    /* 99 */ SyscallDesc("accept", unimplementedFunc),
    /* 100 */ SyscallDesc("getpriority", unimplementedFunc),
    /* 101 */ SyscallDesc("rt_sigreturn", unimplementedFunc),
    /* 102 */ SyscallDesc("rt_sigaction", ignoreFunc),
    /* 103 */ SyscallDesc("rt_sigprocmask", unimplementedFunc),
    /* 104 */ SyscallDesc("rt_sigpending", unimplementedFunc),
    /* 105 */ SyscallDesc("rt_sigtimedwait", unimplementedFunc),
    /* 106 */ SyscallDesc("rt_sigqueueinfo", unimplementedFunc),
    /* 107 */ SyscallDesc("rt_sigsuspend", unimplementedFunc),
    /* 108 */ SyscallDesc("setresuid", unimplementedFunc),
    /* 109 */ SyscallDesc("getresuid", getresuidFunc),
    /* 110 */ SyscallDesc("setresgid", unimplementedFunc),
    /* 111 */ SyscallDesc("getresgid", unimplementedFunc),
    /* 112 */ SyscallDesc("setregid32", unimplementedFunc),
    /* 113 */ SyscallDesc("recvmsg", unimplementedFunc),
    /* 114 */ SyscallDesc("sendmsg", unimplementedFunc),
    /* 115 */ SyscallDesc("getgroups32", unimplementedFunc),
    /* 116 */ SyscallDesc("gettimeofday", unimplementedFunc),
    /* 117 */ SyscallDesc("getrusage", unimplementedFunc),
    /* 118 */ SyscallDesc("getsockopt", unimplementedFunc),
    /* 119 */ SyscallDesc("getcwd", unimplementedFunc),
    /* 120 */ SyscallDesc("readv", unimplementedFunc),
    /* 121 */ SyscallDesc("writev", unimplementedFunc),
    /* 122 */ SyscallDesc("settimeofday", unimplementedFunc),
    /* 123 */ SyscallDesc("fchown", unimplementedFunc),
    /* 124 */ SyscallDesc("fchmod", unimplementedFunc),
    /* 125 */ SyscallDesc("recvfrom", unimplementedFunc),
    /* 126 */ SyscallDesc("setreuid", unimplementedFunc),
    /* 127 */ SyscallDesc("setregid", unimplementedFunc),
    /* 128 */ SyscallDesc("rename", unimplementedFunc),
    /* 129 */ SyscallDesc("truncate", unimplementedFunc),
    /* 130 */ SyscallDesc("ftruncate", unimplementedFunc),
    /* 131 */ SyscallDesc("flock", unimplementedFunc),
    /* 132 */ SyscallDesc("lstat64", unimplementedFunc),
    /* 133 */ SyscallDesc("sendto", unimplementedFunc),
    /* 134 */ SyscallDesc("shutdown", unimplementedFunc),
    /* 135 */ SyscallDesc("socketpair", unimplementedFunc),
    /* 136 */ SyscallDesc("mkdir", unimplementedFunc),
    /* 137 */ SyscallDesc("rmdir", unimplementedFunc),
    /* 138 */ SyscallDesc("utimes", unimplementedFunc),
    /* 139 */ SyscallDesc("stat64", unimplementedFunc),
    /* 140 */ SyscallDesc("sendfile64", unimplementedFunc),
    /* 141 */ SyscallDesc("getpeername", unimplementedFunc),
    /* 142 */ SyscallDesc("futex", unimplementedFunc),
    /* 143 */ SyscallDesc("gettid", unimplementedFunc),
    /* 144 */ SyscallDesc("getrlimit", unimplementedFunc),
    /* 145 */ SyscallDesc("setrlimit", unimplementedFunc),
    /* 146 */ SyscallDesc("pivot_root", unimplementedFunc),
    /* 147 */ SyscallDesc("prctl", unimplementedFunc),
    /* 148 */ SyscallDesc("pciconfig_read", unimplementedFunc),
    /* 149 */ SyscallDesc("pciconfig_write", unimplementedFunc),
    /* 150 */ SyscallDesc("getsockname", unimplementedFunc),
    /* 151 */ SyscallDesc("inotify_init", unimplementedFunc),
    /* 152 */ SyscallDesc("inotify_add_watch", unimplementedFunc),
    /* 153 */ SyscallDesc("poll", unimplementedFunc),
    /* 154 */ SyscallDesc("getdents64", unimplementedFunc),
    /* 155 */ SyscallDesc("fcntl64", unimplementedFunc),
    /* 156 */ SyscallDesc("inotify_rm_watch", unimplementedFunc),
    /* 157 */ SyscallDesc("statfs", unimplementedFunc),
    /* 158 */ SyscallDesc("fstatfs", unimplementedFunc),
    /* 159 */ SyscallDesc("umount", unimplementedFunc),
    /* 160 */ SyscallDesc("sched_set_affinity", unimplementedFunc),
    /* 161 */ SyscallDesc("sched_get_affinity", unimplementedFunc),
    /* 162 */ SyscallDesc("getdomainname", unimplementedFunc),
    /* 163 */ SyscallDesc("setdomainname", unimplementedFunc),
    /* 164 */ SyscallDesc("utrap_install", unimplementedFunc),
    /* 165 */ SyscallDesc("quotactl", unimplementedFunc),
    /* 166 */ SyscallDesc("set_tid_address", unimplementedFunc),
    /* 167 */ SyscallDesc("mount", unimplementedFunc),
    /* 168 */ SyscallDesc("ustat", unimplementedFunc),
    /* 169 */ SyscallDesc("setxattr", unimplementedFunc),
    /* 170 */ SyscallDesc("lsetxattr", unimplementedFunc),
    /* 171 */ SyscallDesc("fsetxattr", unimplementedFunc),
    /* 172 */ SyscallDesc("getxattr", unimplementedFunc),
    /* 173 */ SyscallDesc("lgetxattr", unimplementedFunc),
    /* 174 */ SyscallDesc("getdents", unimplementedFunc),
    /* 175 */ SyscallDesc("setsid", unimplementedFunc),
    /* 176 */ SyscallDesc("fchdir", unimplementedFunc),
    /* 177 */ SyscallDesc("fgetxattr", unimplementedFunc),
    /* 178 */ SyscallDesc("listxattr", unimplementedFunc),
    /* 179 */ SyscallDesc("llistxattr", unimplementedFunc),
    /* 180 */ SyscallDesc("flistxattr", unimplementedFunc),
    /* 181 */ SyscallDesc("removexattr", unimplementedFunc),
    /* 182 */ SyscallDesc("lremovexattr", unimplementedFunc),
    /* 183 */ SyscallDesc("sigpending", unimplementedFunc),
    /* 184 */ SyscallDesc("query_module", unimplementedFunc),
    /* 185 */ SyscallDesc("setpgid", unimplementedFunc),
    /* 186 */ SyscallDesc("fremovexattr", unimplementedFunc),
    /* 187 */ SyscallDesc("tkill", unimplementedFunc),
    /* 188 */ SyscallDesc("exit_group", exitFunc),
    /* 189 */ SyscallDesc("uname", unameFunc),
    /* 190 */ SyscallDesc("init_module", unimplementedFunc),
    /* 191 */ SyscallDesc("personality", unimplementedFunc),
    /* 192 */ SyscallDesc("remap_file_pages", unimplementedFunc),
    /* 193 */ SyscallDesc("epoll_create", unimplementedFunc),
    /* 194 */ SyscallDesc("epoll_ctl", unimplementedFunc),
    /* 195 */ SyscallDesc("epoll_wait", unimplementedFunc),
    /* 196 */ SyscallDesc("ioprio_set", unimplementedFunc),
    /* 197 */ SyscallDesc("getppid", getppidFunc),
    /* 198 */ SyscallDesc("sigaction", ignoreFunc),
    /* 199 */ SyscallDesc("sgetmask", unimplementedFunc),
    /* 200 */ SyscallDesc("ssetmask", unimplementedFunc),
    /* 201 */ SyscallDesc("sigsuspend", unimplementedFunc),
    /* 202 */ SyscallDesc("oldlstat", unimplementedFunc),
    /* 203 */ SyscallDesc("uselib", unimplementedFunc),
    /* 204 */ SyscallDesc("readdir", unimplementedFunc),
    /* 205 */ SyscallDesc("readahead", unimplementedFunc),
    /* 206 */ SyscallDesc("socketcall", unimplementedFunc),
    /* 207 */ SyscallDesc("syslog", unimplementedFunc),
    /* 208 */ SyscallDesc("lookup_dcookie", unimplementedFunc),
    /* 209 */ SyscallDesc("fadvise64", unimplementedFunc),
    /* 210 */ SyscallDesc("fadvise64_64", unimplementedFunc),
    /* 211 */ SyscallDesc("tgkill", unimplementedFunc),
    /* 212 */ SyscallDesc("waitpid", unimplementedFunc),
    /* 213 */ SyscallDesc("swapoff", unimplementedFunc),
    /* 214 */ SyscallDesc("sysinfo", unimplementedFunc),
    /* 215 */ SyscallDesc("ipc", unimplementedFunc),
    /* 216 */ SyscallDesc("sigreturn", unimplementedFunc),
    /* 217 */ SyscallDesc("clone", unimplementedFunc),
    /* 218 */ SyscallDesc("ioprio_get", unimplementedFunc),
    /* 219 */ SyscallDesc("adjtimex", unimplementedFunc),
    /* 220 */ SyscallDesc("sigprocmask", unimplementedFunc),
    /* 221 */ SyscallDesc("create_module", unimplementedFunc),
    /* 222 */ SyscallDesc("delete_module", unimplementedFunc),
    /* 223 */ SyscallDesc("get_kernel_syms", unimplementedFunc),
    /* 224 */ SyscallDesc("getpgid", unimplementedFunc),
    /* 225 */ SyscallDesc("bdflush", unimplementedFunc),
    /* 226 */ SyscallDesc("sysfs", unimplementedFunc),
    /* 227 */ SyscallDesc("afs_syscall", unimplementedFunc),
    /* 228 */ SyscallDesc("setfsuid", unimplementedFunc),
    /* 229 */ SyscallDesc("setfsgid", unimplementedFunc),
    /* 230 */ SyscallDesc("_newselect", unimplementedFunc),
    /* 231 */ SyscallDesc("time", unimplementedFunc),
    /* 232 */ SyscallDesc("oldstat", unimplementedFunc),
    /* 233 */ SyscallDesc("stime", unimplementedFunc),
    /* 234 */ SyscallDesc("statfs64", unimplementedFunc),
    /* 235 */ SyscallDesc("fstatfs64", unimplementedFunc),
    /* 236 */ SyscallDesc("_llseek", unimplementedFunc),
    /* 237 */ SyscallDesc("mlock", unimplementedFunc),
    /* 238 */ SyscallDesc("munlock", unimplementedFunc),
    /* 239 */ SyscallDesc("mlockall", unimplementedFunc),
    /* 240 */ SyscallDesc("munlockall", unimplementedFunc),
    /* 241 */ SyscallDesc("sched_setparam", unimplementedFunc),
    /* 242 */ SyscallDesc("sched_getparam", unimplementedFunc),
    /* 243 */ SyscallDesc("sched_setscheduler", unimplementedFunc),
    /* 244 */ SyscallDesc("sched_getscheduler", unimplementedFunc),
    /* 245 */ SyscallDesc("sched_yield", unimplementedFunc),
    /* 246 */ SyscallDesc("sched_get_priority_max", unimplementedFunc),
    /* 247 */ SyscallDesc("sched_get_priority_min", unimplementedFunc),
    /* 248 */ SyscallDesc("sched_rr_get_interval", unimplementedFunc),
    /* 249 */ SyscallDesc("nanosleep", unimplementedFunc),
    /* 250 */ SyscallDesc("mremap", unimplementedFunc),
    /* 251 */ SyscallDesc("_sysctl", unimplementedFunc),
    /* 252 */ SyscallDesc("getsid", unimplementedFunc),
    /* 253 */ SyscallDesc("fdatasync", unimplementedFunc),
    /* 254 */ SyscallDesc("nfsservctl", unimplementedFunc),
    /* 255 */ SyscallDesc("aplib", unimplementedFunc),
    /* 256 */ SyscallDesc("clock_settime", unimplementedFunc),
    /* 257 */ SyscallDesc("clock_gettime", unimplementedFunc),
    /* 258 */ SyscallDesc("clock_getres", unimplementedFunc),
    /* 259 */ SyscallDesc("clock_nanosleep", unimplementedFunc),
    /* 260 */ SyscallDesc("sched_getaffinity", unimplementedFunc),
    /* 261 */ SyscallDesc("sched_setaffinity", unimplementedFunc),
    /* 262 */ SyscallDesc("timer_settime", unimplementedFunc),
    /* 263 */ SyscallDesc("timer_gettime", unimplementedFunc),
    /* 264 */ SyscallDesc("timer_getoverrun", unimplementedFunc),
    /* 265 */ SyscallDesc("timer_delete", unimplementedFunc),
    /* 266 */ SyscallDesc("timer_create", unimplementedFunc),
    /* 267 */ SyscallDesc("vserver", unimplementedFunc),
    /* 268 */ SyscallDesc("io_setup", unimplementedFunc),
    /* 269 */ SyscallDesc("io_destroy", unimplementedFunc),
    /* 270 */ SyscallDesc("io_submit", unimplementedFunc),
    /* 271 */ SyscallDesc("io_cancel", unimplementedFunc),
    /* 272 */ SyscallDesc("io_getevents", unimplementedFunc),
    /* 273 */ SyscallDesc("mq_open", unimplementedFunc),
    /* 274 */ SyscallDesc("mq_unlink", unimplementedFunc),
    /* 275 */ SyscallDesc("mq_timedsend", unimplementedFunc),
    /* 276 */ SyscallDesc("mq_timedreceive", unimplementedFunc),
    /* 277 */ SyscallDesc("mq_notify", unimplementedFunc),
    /* 278 */ SyscallDesc("mq_getsetattr", unimplementedFunc),
    /* 279 */ SyscallDesc("waitid", unimplementedFunc),
    /* 280 */ SyscallDesc("sys_setaltroot", unimplementedFunc),
    /* 281 */ SyscallDesc("add_key", unimplementedFunc),
    /* 282 */ SyscallDesc("request_key", unimplementedFunc),
    /* 283 */ SyscallDesc("keyctl", unimplementedFunc)
};

SparcLinuxProcess::SparcLinuxProcess(const std::string &name,
                                     ObjectFile *objFile,
                                     System * system,
                                     int stdin_fd,
                                     int stdout_fd,
                                     int stderr_fd,
                                     std::vector<std::string> &argv,
                                     std::vector<std::string> &envp)
    : SparcLiveProcess(name, objFile, system,
            stdin_fd, stdout_fd, stderr_fd, argv, envp),
     Num_Syscall_Descs(sizeof(syscallDescs) / sizeof(SyscallDesc))
{
    // The sparc syscall table must be <= 284 entries because that is all there
    // is space for.
    assert(Num_Syscall_Descs <= 284);
}



SyscallDesc*
SparcLinuxProcess::getDesc(int callnum)
{
    if (callnum < 0 || callnum > Num_Syscall_Descs)
        return NULL;
    return &syscallDescs[callnum];
}