Merge zizzer:/bk/multiarch
[gem5.git] / arch / alpha / alpha_linux_process.cc
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
29 #include <dirent.h>
30 #include <errno.h>
31 #include <fcntl.h> // for host open() flags
32 #include <string.h> // for memset()
33 #include <sys/stat.h>
34 #include <sys/types.h>
35 #include <unistd.h>
36
37 #include "cpu/base.hh"
38 #include "cpu/exec_context.hh"
39 #include "mem/functional/functional.hh"
40 #include "sim/fake_syscall.hh"
41 #include "sim/host.hh"
42 #include "sim/process.hh"
43 #include "sim/sim_events.hh"
44
45 #include "arch/alpha/isa_traits.hh"
46 #include "arch/alpha/alpha_common_syscall_emul.hh"
47 #include "sim/syscall_emul.hh"
48 #include "sim/root.hh" // for curTick & ticksPerSecond
49
50 #include "arch/alpha/alpha_linux_process.hh"
51
52 #include "base/trace.hh"
53
54 using namespace std;
55
56 ///
57 /// This class encapsulates the types, structures, constants,
58 /// functions, and syscall-number mappings specific to the Alpha Linux
59 /// syscall interface.
60 ///
61 class Linux {
62
63 public:
64
65 //@{
66 /// Basic Linux types.
67 typedef uint64_t size_t;
68 typedef uint64_t off_t;
69 typedef int64_t time_t;
70 typedef uint32_t uid_t;
71 typedef uint32_t gid_t;
72 //@}
73
74 #if BSD_HOST
75 typedef struct stat hst_stat;
76 typedef struct stat hst_stat64;
77 #else
78 typedef struct stat hst_stat ;
79 typedef struct stat64 hst_stat64;
80 #endif
81
82
83 //@{
84 /// open(2) flag values.
85 static const int TGT_O_RDONLY = 00000000; //!< O_RDONLY
86 static const int TGT_O_WRONLY = 00000001; //!< O_WRONLY
87 static const int TGT_O_RDWR = 00000002; //!< O_RDWR
88 static const int TGT_O_NONBLOCK = 00000004; //!< O_NONBLOCK
89 static const int TGT_O_APPEND = 00000010; //!< O_APPEND
90 static const int TGT_O_CREAT = 00001000; //!< O_CREAT
91 static const int TGT_O_TRUNC = 00002000; //!< O_TRUNC
92 static const int TGT_O_EXCL = 00004000; //!< O_EXCL
93 static const int TGT_O_NOCTTY = 00010000; //!< O_NOCTTY
94 static const int TGT_O_SYNC = 00040000; //!< O_SYNC
95 static const int TGT_O_DRD = 00100000; //!< O_DRD
96 static const int TGT_O_DIRECTIO = 00200000; //!< O_DIRECTIO
97 static const int TGT_O_CACHE = 00400000; //!< O_CACHE
98 static const int TGT_O_DSYNC = 02000000; //!< O_DSYNC
99 static const int TGT_O_RSYNC = 04000000; //!< O_RSYNC
100 //@}
101
102 /// This table maps the target open() flags to the corresponding
103 /// host open() flags.
104 static OpenFlagTransTable openFlagTable[];
105
106 /// Number of entries in openFlagTable[].
107 static const int NUM_OPEN_FLAGS;
108
109 /// Stat buffer. Note that we can't call it 'stat' since that
110 /// gets #defined to something else on some systems.
111 struct tgt_stat {
112 uint32_t st_dev; //!< device
113 uint32_t st_ino; //!< inode
114 uint32_t st_mode; //!< mode
115 uint32_t st_nlink; //!< link count
116 uint32_t st_uid; //!< owner's user ID
117 uint32_t st_gid; //!< owner's group ID
118 uint32_t st_rdev; //!< device number
119 int32_t _pad1; //!< for alignment
120 int64_t st_size; //!< file size in bytes
121 uint64_t st_atimeX; //!< time of last access
122 uint64_t st_mtimeX; //!< time of last modification
123 uint64_t st_ctimeX; //!< time of last status change
124 uint32_t st_blksize; //!< optimal I/O block size
125 int32_t st_blocks; //!< number of blocks allocated
126 uint32_t st_flags; //!< flags
127 uint32_t st_gen; //!< unknown
128 };
129
130 // same for stat64
131 struct tgt_stat64 {
132 uint64_t st_dev;
133 uint64_t st_ino;
134 uint64_t st_rdev;
135 int64_t st_size;
136 uint64_t st_blocks;
137
138 uint32_t st_mode;
139 uint32_t st_uid;
140 uint32_t st_gid;
141 uint32_t st_blksize;
142 uint32_t st_nlink;
143 uint32_t __pad0;
144
145 uint64_t tgt_st_atime;
146 uint64_t st_atime_nsec;
147 uint64_t tgt_st_mtime;
148 uint64_t st_mtime_nsec;
149 uint64_t tgt_st_ctime;
150 uint64_t st_ctime_nsec;
151 int64_t ___unused[3];
152 };
153
154 /// Length of strings in struct utsname (plus 1 for null char).
155 static const int _SYS_NMLN = 65;
156
157 /// Interface struct for uname().
158 struct utsname {
159 char sysname[_SYS_NMLN]; //!< System name.
160 char nodename[_SYS_NMLN]; //!< Node name.
161 char release[_SYS_NMLN]; //!< OS release.
162 char version[_SYS_NMLN]; //!< OS version.
163 char machine[_SYS_NMLN]; //!< Machine type.
164 };
165
166
167 //@{
168 /// ioctl() command codes.
169 static const unsigned TIOCGETP = 0x40067408;
170 static const unsigned TIOCSETP = 0x80067409;
171 static const unsigned TIOCSETN = 0x8006740a;
172 static const unsigned TIOCSETC = 0x80067411;
173 static const unsigned TIOCGETC = 0x40067412;
174 static const unsigned FIONREAD = 0x4004667f;
175 static const unsigned TIOCISATTY = 0x2000745e;
176 static const unsigned TIOCGETS = 0x402c7413;
177 static const unsigned TIOCGETA = 0x40127417;
178 //@}
179
180 /// Resource enumeration for getrlimit().
181 enum rlimit_resources {
182 TGT_RLIMIT_CPU = 0,
183 TGT_RLIMIT_FSIZE = 1,
184 TGT_RLIMIT_DATA = 2,
185 TGT_RLIMIT_STACK = 3,
186 TGT_RLIMIT_CORE = 4,
187 TGT_RLIMIT_RSS = 5,
188 TGT_RLIMIT_NOFILE = 6,
189 TGT_RLIMIT_AS = 7,
190 TGT_RLIMIT_VMEM = 7,
191 TGT_RLIMIT_NPROC = 8,
192 TGT_RLIMIT_MEMLOCK = 9,
193 TGT_RLIMIT_LOCKS = 10
194 };
195
196 /// Limit struct for getrlimit/setrlimit.
197 struct rlimit {
198 uint64_t rlim_cur; //!< soft limit
199 uint64_t rlim_max; //!< hard limit
200 };
201
202
203 /// For mmap().
204 static const unsigned TGT_MAP_ANONYMOUS = 0x10;
205
206 /// For gettimeofday().
207 struct timeval {
208 int64_t tv_sec; //!< seconds
209 int64_t tv_usec; //!< microseconds
210 };
211
212 // For writev/readv
213 struct tgt_iovec {
214 uint64_t iov_base; // void *
215 uint64_t iov_len;
216 };
217
218 //@{
219 /// For getrusage().
220 static const int TGT_RUSAGE_SELF = 0;
221 static const int TGT_RUSAGE_CHILDREN = -1;
222 static const int TGT_RUSAGE_BOTH = -2;
223 //@}
224
225 /// For getrusage().
226 struct rusage {
227 struct timeval ru_utime; //!< user time used
228 struct timeval ru_stime; //!< system time used
229 int64_t ru_maxrss; //!< max rss
230 int64_t ru_ixrss; //!< integral shared memory size
231 int64_t ru_idrss; //!< integral unshared data "
232 int64_t ru_isrss; //!< integral unshared stack "
233 int64_t ru_minflt; //!< page reclaims - total vmfaults
234 int64_t ru_majflt; //!< page faults
235 int64_t ru_nswap; //!< swaps
236 int64_t ru_inblock; //!< block input operations
237 int64_t ru_oublock; //!< block output operations
238 int64_t ru_msgsnd; //!< messages sent
239 int64_t ru_msgrcv; //!< messages received
240 int64_t ru_nsignals; //!< signals received
241 int64_t ru_nvcsw; //!< voluntary context switches
242 int64_t ru_nivcsw; //!< involuntary "
243 };
244
245 /// Helper function to convert a host stat buffer to a target stat
246 /// buffer. Also copies the target buffer out to the simulated
247 /// memory space. Used by stat(), fstat(), and lstat().
248 #if !BSD_HOST
249 static void
250 copyOutStatBuf(FunctionalMemory *mem, Addr addr, hst_stat *host)
251 {
252 TypedBufferArg<Linux::tgt_stat> tgt(addr);
253
254 tgt->st_dev = htog(host->st_dev);
255 tgt->st_ino = htog(host->st_ino);
256 tgt->st_mode = htog(host->st_mode);
257 tgt->st_nlink = htog(host->st_nlink);
258 tgt->st_uid = htog(host->st_uid);
259 tgt->st_gid = htog(host->st_gid);
260 tgt->st_rdev = htog(host->st_rdev);
261 tgt->st_size = htog(host->st_size);
262 tgt->st_atimeX = htog(host->st_atime);
263 tgt->st_mtimeX = htog(host->st_mtime);
264 tgt->st_ctimeX = htog(host->st_ctime);
265 tgt->st_blksize = htog(host->st_blksize);
266 tgt->st_blocks = htog(host->st_blocks);
267
268 tgt.copyOut(mem);
269 }
270 #else
271 // Third version for bsd systems which no longer have any support for
272 // the old stat() call and stat() is actually a stat64()
273 static void
274 copyOutStatBuf(FunctionalMemory *mem, Addr addr, hst_stat64 *host)
275 {
276 TypedBufferArg<Linux::tgt_stat> tgt(addr);
277
278 tgt->st_dev = htog(host->st_dev);
279 tgt->st_ino = htog(host->st_ino);
280 tgt->st_mode = htog(host->st_mode);
281 tgt->st_nlink = htog(host->st_nlink);
282 tgt->st_uid = htog(host->st_uid);
283 tgt->st_gid = htog(host->st_gid);
284 tgt->st_rdev = htog(host->st_rdev);
285 tgt->st_size = htog(host->st_size);
286 tgt->st_atimeX = htog(host->st_atime);
287 tgt->st_mtimeX = htog(host->st_mtime);
288 tgt->st_ctimeX = htog(host->st_ctime);
289 tgt->st_blksize = htog(host->st_blksize);
290 tgt->st_blocks = htog(host->st_blocks);
291
292 tgt.copyOut(mem);
293 }
294 #endif
295
296
297 // Same for stat64
298 static void
299 copyOutStat64Buf(FunctionalMemory *mem, int fd, Addr addr, hst_stat64 *host)
300 {
301 TypedBufferArg<Linux::tgt_stat64> tgt(addr);
302
303 // fd == 1 checks are because libc does some checks
304 // that the stdout is interactive vs. a file
305 // this makes it work on non-linux systems
306 if (fd == 1)
307 tgt->st_dev = htog((uint64_t)0xA);
308 else
309 tgt->st_dev = htog((uint64_t)host->st_dev);
310 // XXX What about STAT64_HAS_BROKEN_ST_INO ???
311 tgt->st_ino = htog((uint64_t)host->st_ino);
312 if (fd == 1)
313 tgt->st_rdev = htog((uint64_t)0x880d);
314 else
315 tgt->st_rdev = htog((uint64_t)host->st_rdev);
316 tgt->st_size = htog((int64_t)host->st_size);
317 tgt->st_blocks = htog((uint64_t)host->st_blocks);
318
319 if (fd == 1)
320 tgt->st_mode = htog((uint32_t)0x2190);
321 else
322 tgt->st_mode = htog((uint32_t)host->st_mode);
323 tgt->st_uid = htog((uint32_t)host->st_uid);
324 tgt->st_gid = htog((uint32_t)host->st_gid);
325 tgt->st_blksize = htog((uint32_t)host->st_blksize);
326 tgt->st_nlink = htog((uint32_t)host->st_nlink);
327 tgt->tgt_st_atime = htog((uint64_t)host->st_atime);
328 tgt->tgt_st_mtime = htog((uint64_t)host->st_mtime);
329 tgt->tgt_st_ctime = htog((uint64_t)host->st_ctime);
330 #if defined(STAT_HAVE_NSEC)
331 tgt->st_atime_nsec = htog(host->st_atime_nsec);
332 tgt->st_mtime_nsec = htog(host->st_mtime_nsec);
333 tgt->st_ctime_nsec = htog(host->st_ctime_nsec);
334 #else
335 tgt->st_atime_nsec = 0;
336 tgt->st_mtime_nsec = 0;
337 tgt->st_ctime_nsec = 0;
338 #endif
339
340 tgt.copyOut(mem);
341 }
342
343 /// The target system's hostname.
344 static const char *hostname;
345
346 /// Target uname() handler.
347 static SyscallReturn
348 unameFunc(SyscallDesc *desc, int callnum, Process *process,
349 ExecContext *xc)
350 {
351 TypedBufferArg<Linux::utsname> name(xc->getSyscallArg(0));
352
353 strcpy(name->sysname, "Linux");
354 strcpy(name->nodename, hostname);
355 strcpy(name->release, "2.4.20");
356 strcpy(name->version, "#1 Mon Aug 18 11:32:15 EDT 2003");
357 strcpy(name->machine, "alpha");
358
359 name.copyOut(xc->mem);
360 return 0;
361 }
362
363 /// Target osf_getsysyinfo() handler. Even though this call is
364 /// borrowed from Tru64, the subcases that get used appear to be
365 /// different in practice from those used by Tru64 processes.
366 static SyscallReturn
367 osf_getsysinfoFunc(SyscallDesc *desc, int callnum, Process *process,
368 ExecContext *xc)
369 {
370 unsigned op = xc->getSyscallArg(0);
371 // unsigned nbytes = xc->getSyscallArg(2);
372
373 switch (op) {
374
375 case 45: { // GSI_IEEE_FP_CONTROL
376 TypedBufferArg<uint64_t> fpcr(xc->getSyscallArg(1));
377 // I don't think this exactly matches the HW FPCR
378 *fpcr = 0;
379 fpcr.copyOut(xc->mem);
380 return 0;
381 }
382
383 default:
384 cerr << "osf_getsysinfo: unknown op " << op << endl;
385 abort();
386 break;
387 }
388
389 return 1;
390 }
391
392 /// Target osf_setsysinfo() handler.
393 static SyscallReturn
394 osf_setsysinfoFunc(SyscallDesc *desc, int callnum, Process *process,
395 ExecContext *xc)
396 {
397 unsigned op = xc->getSyscallArg(0);
398 // unsigned nbytes = xc->getSyscallArg(2);
399
400 switch (op) {
401
402 case 14: { // SSI_IEEE_FP_CONTROL
403 TypedBufferArg<uint64_t> fpcr(xc->getSyscallArg(1));
404 // I don't think this exactly matches the HW FPCR
405 fpcr.copyIn(xc->mem);
406 DPRINTFR(SyscallVerbose, "osf_setsysinfo(SSI_IEEE_FP_CONTROL): "
407 " setting FPCR to 0x%x\n", gtoh(*(uint64_t*)fpcr));
408 return 0;
409 }
410
411 default:
412 cerr << "osf_setsysinfo: unknown op " << op << endl;
413 abort();
414 break;
415 }
416
417 return 1;
418 }
419
420 /// Target fnctl() handler.
421 static SyscallReturn
422 fcntlFunc(SyscallDesc *desc, int callnum, Process *process,
423 ExecContext *xc)
424 {
425 int fd = xc->getSyscallArg(0);
426
427 if (fd < 0 || process->sim_fd(fd) < 0)
428 return -EBADF;
429
430 int cmd = xc->getSyscallArg(1);
431 switch (cmd) {
432 case 0: // F_DUPFD
433 // if we really wanted to support this, we'd need to do it
434 // in the target fd space.
435 warn("fcntl(%d, F_DUPFD) not supported, error returned\n", fd);
436 return -EMFILE;
437
438 case 1: // F_GETFD (get close-on-exec flag)
439 case 2: // F_SETFD (set close-on-exec flag)
440 return 0;
441
442 case 3: // F_GETFL (get file flags)
443 case 4: // F_SETFL (set file flags)
444 // not sure if this is totally valid, but we'll pass it through
445 // to the underlying OS
446 warn("fcntl(%d, %d) passed through to host\n", fd, cmd);
447 return fcntl(process->sim_fd(fd), cmd);
448 // return 0;
449
450 case 7: // F_GETLK (get lock)
451 case 8: // F_SETLK (set lock)
452 case 9: // F_SETLKW (set lock and wait)
453 // don't mess with file locking... just act like it's OK
454 warn("File lock call (fcntl(%d, %d)) ignored.\n", fd, cmd);
455 return 0;
456
457 default:
458 warn("Unknown fcntl command %d\n", cmd);
459 return 0;
460 }
461 }
462
463 /// Array of syscall descriptors, indexed by call number.
464 static SyscallDesc syscallDescs[];
465
466 /// Number of syscalls in syscallDescs[].
467 static const int Num_Syscall_Descs;
468
469 /// Max supported syscall number.
470 static const int Max_Syscall_Desc;
471
472 /// Do the specified syscall. Just looks the call number up in
473 /// the table and invokes the appropriate handler.
474 static void
475 doSyscall(int callnum, Process *process, ExecContext *xc)
476 {
477 if (callnum < 0 || callnum > Max_Syscall_Desc) {
478 fatal("Syscall %d out of range", callnum);
479 }
480
481 SyscallDesc *desc = &syscallDescs[callnum];
482
483 desc->doSyscall(callnum, process, xc);
484 }
485 }; // class Linux
486
487
488 // open(2) flags translation table
489 OpenFlagTransTable Linux::openFlagTable[] = {
490 #ifdef _MSC_VER
491 { Linux::TGT_O_RDONLY, _O_RDONLY },
492 { Linux::TGT_O_WRONLY, _O_WRONLY },
493 { Linux::TGT_O_RDWR, _O_RDWR },
494 { Linux::TGT_O_APPEND, _O_APPEND },
495 { Linux::TGT_O_CREAT, _O_CREAT },
496 { Linux::TGT_O_TRUNC, _O_TRUNC },
497 { Linux::TGT_O_EXCL, _O_EXCL },
498 #ifdef _O_NONBLOCK
499 { Linux::TGT_O_NONBLOCK, _O_NONBLOCK },
500 #endif
501 #ifdef _O_NOCTTY
502 { Linux::TGT_O_NOCTTY, _O_NOCTTY },
503 #endif
504 #ifdef _O_SYNC
505 { Linux::TGT_O_SYNC, _O_SYNC },
506 #endif
507 #else /* !_MSC_VER */
508 { Linux::TGT_O_RDONLY, O_RDONLY },
509 { Linux::TGT_O_WRONLY, O_WRONLY },
510 { Linux::TGT_O_RDWR, O_RDWR },
511 { Linux::TGT_O_APPEND, O_APPEND },
512 { Linux::TGT_O_CREAT, O_CREAT },
513 { Linux::TGT_O_TRUNC, O_TRUNC },
514 { Linux::TGT_O_EXCL, O_EXCL },
515 { Linux::TGT_O_NONBLOCK, O_NONBLOCK },
516 { Linux::TGT_O_NOCTTY, O_NOCTTY },
517 #ifdef O_SYNC
518 { Linux::TGT_O_SYNC, O_SYNC },
519 #endif
520 #endif /* _MSC_VER */
521 };
522
523 const int Linux::NUM_OPEN_FLAGS =
524 (sizeof(Linux::openFlagTable)/sizeof(Linux::openFlagTable[0]));
525
526 const char *Linux::hostname = "m5.eecs.umich.edu";
527
528 SyscallDesc Linux::syscallDescs[] = {
529 /* 0 */ SyscallDesc("osf_syscall", unimplementedFunc),
530 /* 1 */ SyscallDesc("exit", exitFunc),
531 /* 2 */ SyscallDesc("fork", unimplementedFunc),
532 /* 3 */ SyscallDesc("read", readFunc),
533 /* 4 */ SyscallDesc("write", writeFunc),
534 /* 5 */ SyscallDesc("osf_old_open", unimplementedFunc),
535 /* 6 */ SyscallDesc("close", closeFunc),
536 /* 7 */ SyscallDesc("osf_wait4", unimplementedFunc),
537 /* 8 */ SyscallDesc("osf_old_creat", unimplementedFunc),
538 /* 9 */ SyscallDesc("link", unimplementedFunc),
539 /* 10 */ SyscallDesc("unlink", unlinkFunc),
540 /* 11 */ SyscallDesc("osf_execve", unimplementedFunc),
541 /* 12 */ SyscallDesc("chdir", unimplementedFunc),
542 /* 13 */ SyscallDesc("fchdir", unimplementedFunc),
543 /* 14 */ SyscallDesc("mknod", unimplementedFunc),
544 /* 15 */ SyscallDesc("chmod", chmodFunc<Linux>),
545 /* 16 */ SyscallDesc("chown", chownFunc),
546 /* 17 */ SyscallDesc("brk", obreakFunc),
547 /* 18 */ SyscallDesc("osf_getfsstat", unimplementedFunc),
548 /* 19 */ SyscallDesc("lseek", lseekFunc),
549 /* 20 */ SyscallDesc("getxpid", getpidFunc),
550 /* 21 */ SyscallDesc("osf_mount", unimplementedFunc),
551 /* 22 */ SyscallDesc("umount", unimplementedFunc),
552 /* 23 */ SyscallDesc("setuid", setuidFunc),
553 /* 24 */ SyscallDesc("getxuid", getuidFunc),
554 /* 25 */ SyscallDesc("exec_with_loader", unimplementedFunc),
555 /* 26 */ SyscallDesc("osf_ptrace", unimplementedFunc),
556 /* 27 */ SyscallDesc("osf_nrecvmsg", unimplementedFunc),
557 /* 28 */ SyscallDesc("osf_nsendmsg", unimplementedFunc),
558 /* 29 */ SyscallDesc("osf_nrecvfrom", unimplementedFunc),
559 /* 30 */ SyscallDesc("osf_naccept", unimplementedFunc),
560 /* 31 */ SyscallDesc("osf_ngetpeername", unimplementedFunc),
561 /* 32 */ SyscallDesc("osf_ngetsockname", unimplementedFunc),
562 /* 33 */ SyscallDesc("access", unimplementedFunc),
563 /* 34 */ SyscallDesc("osf_chflags", unimplementedFunc),
564 /* 35 */ SyscallDesc("osf_fchflags", unimplementedFunc),
565 /* 36 */ SyscallDesc("sync", unimplementedFunc),
566 /* 37 */ SyscallDesc("kill", unimplementedFunc),
567 /* 38 */ SyscallDesc("osf_old_stat", unimplementedFunc),
568 /* 39 */ SyscallDesc("setpgid", unimplementedFunc),
569 /* 40 */ SyscallDesc("osf_old_lstat", unimplementedFunc),
570 /* 41 */ SyscallDesc("dup", unimplementedFunc),
571 /* 42 */ SyscallDesc("pipe", unimplementedFunc),
572 /* 43 */ SyscallDesc("osf_set_program_attributes", unimplementedFunc),
573 /* 44 */ SyscallDesc("osf_profil", unimplementedFunc),
574 /* 45 */ SyscallDesc("open", openFunc<Linux>),
575 /* 46 */ SyscallDesc("osf_old_sigaction", unimplementedFunc),
576 /* 47 */ SyscallDesc("getxgid", getgidFunc),
577 /* 48 */ SyscallDesc("osf_sigprocmask", ignoreFunc),
578 /* 49 */ SyscallDesc("osf_getlogin", unimplementedFunc),
579 /* 50 */ SyscallDesc("osf_setlogin", unimplementedFunc),
580 /* 51 */ SyscallDesc("acct", unimplementedFunc),
581 /* 52 */ SyscallDesc("sigpending", unimplementedFunc),
582 /* 53 */ SyscallDesc("osf_classcntl", unimplementedFunc),
583 /* 54 */ SyscallDesc("ioctl", ioctlFunc<Linux>),
584 /* 55 */ SyscallDesc("osf_reboot", unimplementedFunc),
585 /* 56 */ SyscallDesc("osf_revoke", unimplementedFunc),
586 /* 57 */ SyscallDesc("symlink", unimplementedFunc),
587 /* 58 */ SyscallDesc("readlink", unimplementedFunc),
588 /* 59 */ SyscallDesc("execve", unimplementedFunc),
589 /* 60 */ SyscallDesc("umask", unimplementedFunc),
590 /* 61 */ SyscallDesc("chroot", unimplementedFunc),
591 /* 62 */ SyscallDesc("osf_old_fstat", unimplementedFunc),
592 /* 63 */ SyscallDesc("getpgrp", unimplementedFunc),
593 /* 64 */ SyscallDesc("getpagesize", getpagesizeFunc),
594 /* 65 */ SyscallDesc("osf_mremap", unimplementedFunc),
595 /* 66 */ SyscallDesc("vfork", unimplementedFunc),
596 /* 67 */ SyscallDesc("stat", statFunc<Linux>),
597 /* 68 */ SyscallDesc("lstat", lstatFunc<Linux>),
598 /* 69 */ SyscallDesc("osf_sbrk", unimplementedFunc),
599 /* 70 */ SyscallDesc("osf_sstk", unimplementedFunc),
600 /* 71 */ SyscallDesc("mmap", mmapFunc<Linux>),
601 /* 72 */ SyscallDesc("osf_old_vadvise", unimplementedFunc),
602 /* 73 */ SyscallDesc("munmap", munmapFunc),
603 /* 74 */ SyscallDesc("mprotect", ignoreFunc),
604 /* 75 */ SyscallDesc("madvise", unimplementedFunc),
605 /* 76 */ SyscallDesc("vhangup", unimplementedFunc),
606 /* 77 */ SyscallDesc("osf_kmodcall", unimplementedFunc),
607 /* 78 */ SyscallDesc("osf_mincore", unimplementedFunc),
608 /* 79 */ SyscallDesc("getgroups", unimplementedFunc),
609 /* 80 */ SyscallDesc("setgroups", unimplementedFunc),
610 /* 81 */ SyscallDesc("osf_old_getpgrp", unimplementedFunc),
611 /* 82 */ SyscallDesc("setpgrp", unimplementedFunc),
612 /* 83 */ SyscallDesc("osf_setitimer", unimplementedFunc),
613 /* 84 */ SyscallDesc("osf_old_wait", unimplementedFunc),
614 /* 85 */ SyscallDesc("osf_table", unimplementedFunc),
615 /* 86 */ SyscallDesc("osf_getitimer", unimplementedFunc),
616 /* 87 */ SyscallDesc("gethostname", gethostnameFunc),
617 /* 88 */ SyscallDesc("sethostname", unimplementedFunc),
618 /* 89 */ SyscallDesc("getdtablesize", unimplementedFunc),
619 /* 90 */ SyscallDesc("dup2", unimplementedFunc),
620 /* 91 */ SyscallDesc("fstat", fstatFunc<Linux>),
621 /* 92 */ SyscallDesc("fcntl", fcntlFunc),
622 /* 93 */ SyscallDesc("osf_select", unimplementedFunc),
623 /* 94 */ SyscallDesc("poll", unimplementedFunc),
624 /* 95 */ SyscallDesc("fsync", unimplementedFunc),
625 /* 96 */ SyscallDesc("setpriority", unimplementedFunc),
626 /* 97 */ SyscallDesc("socket", unimplementedFunc),
627 /* 98 */ SyscallDesc("connect", unimplementedFunc),
628 /* 99 */ SyscallDesc("accept", unimplementedFunc),
629 /* 100 */ SyscallDesc("getpriority", unimplementedFunc),
630 /* 101 */ SyscallDesc("send", unimplementedFunc),
631 /* 102 */ SyscallDesc("recv", unimplementedFunc),
632 /* 103 */ SyscallDesc("sigreturn", unimplementedFunc),
633 /* 104 */ SyscallDesc("bind", unimplementedFunc),
634 /* 105 */ SyscallDesc("setsockopt", unimplementedFunc),
635 /* 106 */ SyscallDesc("listen", unimplementedFunc),
636 /* 107 */ SyscallDesc("osf_plock", unimplementedFunc),
637 /* 108 */ SyscallDesc("osf_old_sigvec", unimplementedFunc),
638 /* 109 */ SyscallDesc("osf_old_sigblock", unimplementedFunc),
639 /* 110 */ SyscallDesc("osf_old_sigsetmask", unimplementedFunc),
640 /* 111 */ SyscallDesc("sigsuspend", unimplementedFunc),
641 /* 112 */ SyscallDesc("osf_sigstack", ignoreFunc),
642 /* 113 */ SyscallDesc("recvmsg", unimplementedFunc),
643 /* 114 */ SyscallDesc("sendmsg", unimplementedFunc),
644 /* 115 */ SyscallDesc("osf_old_vtrace", unimplementedFunc),
645 /* 116 */ SyscallDesc("osf_gettimeofday", unimplementedFunc),
646 /* 117 */ SyscallDesc("osf_getrusage", unimplementedFunc),
647 /* 118 */ SyscallDesc("getsockopt", unimplementedFunc),
648 /* 119 */ SyscallDesc("numa_syscalls", unimplementedFunc),
649 /* 120 */ SyscallDesc("readv", unimplementedFunc),
650 /* 121 */ SyscallDesc("writev", writevFunc<Linux>),
651 /* 122 */ SyscallDesc("osf_settimeofday", unimplementedFunc),
652 /* 123 */ SyscallDesc("fchown", fchownFunc),
653 /* 124 */ SyscallDesc("fchmod", fchmodFunc<Linux>),
654 /* 125 */ SyscallDesc("recvfrom", unimplementedFunc),
655 /* 126 */ SyscallDesc("setreuid", unimplementedFunc),
656 /* 127 */ SyscallDesc("setregid", unimplementedFunc),
657 /* 128 */ SyscallDesc("rename", renameFunc),
658 /* 129 */ SyscallDesc("truncate", unimplementedFunc),
659 /* 130 */ SyscallDesc("ftruncate", unimplementedFunc),
660 /* 131 */ SyscallDesc("flock", unimplementedFunc),
661 /* 132 */ SyscallDesc("setgid", unimplementedFunc),
662 /* 133 */ SyscallDesc("sendto", unimplementedFunc),
663 /* 134 */ SyscallDesc("shutdown", unimplementedFunc),
664 /* 135 */ SyscallDesc("socketpair", unimplementedFunc),
665 /* 136 */ SyscallDesc("mkdir", unimplementedFunc),
666 /* 137 */ SyscallDesc("rmdir", unimplementedFunc),
667 /* 138 */ SyscallDesc("osf_utimes", unimplementedFunc),
668 /* 139 */ SyscallDesc("osf_old_sigreturn", unimplementedFunc),
669 /* 140 */ SyscallDesc("osf_adjtime", unimplementedFunc),
670 /* 141 */ SyscallDesc("getpeername", unimplementedFunc),
671 /* 142 */ SyscallDesc("osf_gethostid", unimplementedFunc),
672 /* 143 */ SyscallDesc("osf_sethostid", unimplementedFunc),
673 /* 144 */ SyscallDesc("getrlimit", getrlimitFunc<Linux>),
674 /* 145 */ SyscallDesc("setrlimit", ignoreFunc),
675 /* 146 */ SyscallDesc("osf_old_killpg", unimplementedFunc),
676 /* 147 */ SyscallDesc("setsid", unimplementedFunc),
677 /* 148 */ SyscallDesc("quotactl", unimplementedFunc),
678 /* 149 */ SyscallDesc("osf_oldquota", unimplementedFunc),
679 /* 150 */ SyscallDesc("getsockname", unimplementedFunc),
680 /* 151 */ SyscallDesc("osf_pread", unimplementedFunc),
681 /* 152 */ SyscallDesc("osf_pwrite", unimplementedFunc),
682 /* 153 */ SyscallDesc("osf_pid_block", unimplementedFunc),
683 /* 154 */ SyscallDesc("osf_pid_unblock", unimplementedFunc),
684 /* 155 */ SyscallDesc("osf_signal_urti", unimplementedFunc),
685 /* 156 */ SyscallDesc("sigaction", ignoreFunc),
686 /* 157 */ SyscallDesc("osf_sigwaitprim", unimplementedFunc),
687 /* 158 */ SyscallDesc("osf_nfssvc", unimplementedFunc),
688 /* 159 */ SyscallDesc("osf_getdirentries", unimplementedFunc),
689 /* 160 */ SyscallDesc("osf_statfs", unimplementedFunc),
690 /* 161 */ SyscallDesc("osf_fstatfs", unimplementedFunc),
691 /* 162 */ SyscallDesc("unknown #162", unimplementedFunc),
692 /* 163 */ SyscallDesc("osf_async_daemon", unimplementedFunc),
693 /* 164 */ SyscallDesc("osf_getfh", unimplementedFunc),
694 /* 165 */ SyscallDesc("osf_getdomainname", unimplementedFunc),
695 /* 166 */ SyscallDesc("setdomainname", unimplementedFunc),
696 /* 167 */ SyscallDesc("unknown #167", unimplementedFunc),
697 /* 168 */ SyscallDesc("unknown #168", unimplementedFunc),
698 /* 169 */ SyscallDesc("osf_exportfs", unimplementedFunc),
699 /* 170 */ SyscallDesc("unknown #170", unimplementedFunc),
700 /* 171 */ SyscallDesc("unknown #171", unimplementedFunc),
701 /* 172 */ SyscallDesc("unknown #172", unimplementedFunc),
702 /* 173 */ SyscallDesc("unknown #173", unimplementedFunc),
703 /* 174 */ SyscallDesc("unknown #174", unimplementedFunc),
704 /* 175 */ SyscallDesc("unknown #175", unimplementedFunc),
705 /* 176 */ SyscallDesc("unknown #176", unimplementedFunc),
706 /* 177 */ SyscallDesc("unknown #177", unimplementedFunc),
707 /* 178 */ SyscallDesc("unknown #178", unimplementedFunc),
708 /* 179 */ SyscallDesc("unknown #179", unimplementedFunc),
709 /* 180 */ SyscallDesc("unknown #180", unimplementedFunc),
710 /* 181 */ SyscallDesc("osf_alt_plock", unimplementedFunc),
711 /* 182 */ SyscallDesc("unknown #182", unimplementedFunc),
712 /* 183 */ SyscallDesc("unknown #183", unimplementedFunc),
713 /* 184 */ SyscallDesc("osf_getmnt", unimplementedFunc),
714 /* 185 */ SyscallDesc("unknown #185", unimplementedFunc),
715 /* 186 */ SyscallDesc("unknown #186", unimplementedFunc),
716 /* 187 */ SyscallDesc("osf_alt_sigpending", unimplementedFunc),
717 /* 188 */ SyscallDesc("osf_alt_setsid", unimplementedFunc),
718 /* 189 */ SyscallDesc("unknown #189", unimplementedFunc),
719 /* 190 */ SyscallDesc("unknown #190", unimplementedFunc),
720 /* 191 */ SyscallDesc("unknown #191", unimplementedFunc),
721 /* 192 */ SyscallDesc("unknown #192", unimplementedFunc),
722 /* 193 */ SyscallDesc("unknown #193", unimplementedFunc),
723 /* 194 */ SyscallDesc("unknown #194", unimplementedFunc),
724 /* 195 */ SyscallDesc("unknown #195", unimplementedFunc),
725 /* 196 */ SyscallDesc("unknown #196", unimplementedFunc),
726 /* 197 */ SyscallDesc("unknown #197", unimplementedFunc),
727 /* 198 */ SyscallDesc("unknown #198", unimplementedFunc),
728 /* 199 */ SyscallDesc("osf_swapon", unimplementedFunc),
729 /* 200 */ SyscallDesc("msgctl", unimplementedFunc),
730 /* 201 */ SyscallDesc("msgget", unimplementedFunc),
731 /* 202 */ SyscallDesc("msgrcv", unimplementedFunc),
732 /* 203 */ SyscallDesc("msgsnd", unimplementedFunc),
733 /* 204 */ SyscallDesc("semctl", unimplementedFunc),
734 /* 205 */ SyscallDesc("semget", unimplementedFunc),
735 /* 206 */ SyscallDesc("semop", unimplementedFunc),
736 /* 207 */ SyscallDesc("osf_utsname", unimplementedFunc),
737 /* 208 */ SyscallDesc("lchown", unimplementedFunc),
738 /* 209 */ SyscallDesc("osf_shmat", unimplementedFunc),
739 /* 210 */ SyscallDesc("shmctl", unimplementedFunc),
740 /* 211 */ SyscallDesc("shmdt", unimplementedFunc),
741 /* 212 */ SyscallDesc("shmget", unimplementedFunc),
742 /* 213 */ SyscallDesc("osf_mvalid", unimplementedFunc),
743 /* 214 */ SyscallDesc("osf_getaddressconf", unimplementedFunc),
744 /* 215 */ SyscallDesc("osf_msleep", unimplementedFunc),
745 /* 216 */ SyscallDesc("osf_mwakeup", unimplementedFunc),
746 /* 217 */ SyscallDesc("msync", unimplementedFunc),
747 /* 218 */ SyscallDesc("osf_signal", unimplementedFunc),
748 /* 219 */ SyscallDesc("osf_utc_gettime", unimplementedFunc),
749 /* 220 */ SyscallDesc("osf_utc_adjtime", unimplementedFunc),
750 /* 221 */ SyscallDesc("unknown #221", unimplementedFunc),
751 /* 222 */ SyscallDesc("osf_security", unimplementedFunc),
752 /* 223 */ SyscallDesc("osf_kloadcall", unimplementedFunc),
753 /* 224 */ SyscallDesc("unknown #224", unimplementedFunc),
754 /* 225 */ SyscallDesc("unknown #225", unimplementedFunc),
755 /* 226 */ SyscallDesc("unknown #226", unimplementedFunc),
756 /* 227 */ SyscallDesc("unknown #227", unimplementedFunc),
757 /* 228 */ SyscallDesc("unknown #228", unimplementedFunc),
758 /* 229 */ SyscallDesc("unknown #229", unimplementedFunc),
759 /* 230 */ SyscallDesc("unknown #230", unimplementedFunc),
760 /* 231 */ SyscallDesc("unknown #231", unimplementedFunc),
761 /* 232 */ SyscallDesc("unknown #232", unimplementedFunc),
762 /* 233 */ SyscallDesc("getpgid", unimplementedFunc),
763 /* 234 */ SyscallDesc("getsid", unimplementedFunc),
764 /* 235 */ SyscallDesc("sigaltstack", ignoreFunc),
765 /* 236 */ SyscallDesc("osf_waitid", unimplementedFunc),
766 /* 237 */ SyscallDesc("osf_priocntlset", unimplementedFunc),
767 /* 238 */ SyscallDesc("osf_sigsendset", unimplementedFunc),
768 /* 239 */ SyscallDesc("osf_set_speculative", unimplementedFunc),
769 /* 240 */ SyscallDesc("osf_msfs_syscall", unimplementedFunc),
770 /* 241 */ SyscallDesc("osf_sysinfo", unimplementedFunc),
771 /* 242 */ SyscallDesc("osf_uadmin", unimplementedFunc),
772 /* 243 */ SyscallDesc("osf_fuser", unimplementedFunc),
773 /* 244 */ SyscallDesc("osf_proplist_syscall", unimplementedFunc),
774 /* 245 */ SyscallDesc("osf_ntp_adjtime", unimplementedFunc),
775 /* 246 */ SyscallDesc("osf_ntp_gettime", unimplementedFunc),
776 /* 247 */ SyscallDesc("osf_pathconf", unimplementedFunc),
777 /* 248 */ SyscallDesc("osf_fpathconf", unimplementedFunc),
778 /* 249 */ SyscallDesc("unknown #249", unimplementedFunc),
779 /* 250 */ SyscallDesc("osf_uswitch", unimplementedFunc),
780 /* 251 */ SyscallDesc("osf_usleep_thread", unimplementedFunc),
781 /* 252 */ SyscallDesc("osf_audcntl", unimplementedFunc),
782 /* 253 */ SyscallDesc("osf_audgen", unimplementedFunc),
783 /* 254 */ SyscallDesc("sysfs", unimplementedFunc),
784 /* 255 */ SyscallDesc("osf_subsys_info", unimplementedFunc),
785 /* 256 */ SyscallDesc("osf_getsysinfo", osf_getsysinfoFunc),
786 /* 257 */ SyscallDesc("osf_setsysinfo", osf_setsysinfoFunc),
787 /* 258 */ SyscallDesc("osf_afs_syscall", unimplementedFunc),
788 /* 259 */ SyscallDesc("osf_swapctl", unimplementedFunc),
789 /* 260 */ SyscallDesc("osf_memcntl", unimplementedFunc),
790 /* 261 */ SyscallDesc("osf_fdatasync", unimplementedFunc),
791 /* 262 */ SyscallDesc("unknown #262", unimplementedFunc),
792 /* 263 */ SyscallDesc("unknown #263", unimplementedFunc),
793 /* 264 */ SyscallDesc("unknown #264", unimplementedFunc),
794 /* 265 */ SyscallDesc("unknown #265", unimplementedFunc),
795 /* 266 */ SyscallDesc("unknown #266", unimplementedFunc),
796 /* 267 */ SyscallDesc("unknown #267", unimplementedFunc),
797 /* 268 */ SyscallDesc("unknown #268", unimplementedFunc),
798 /* 269 */ SyscallDesc("unknown #269", unimplementedFunc),
799 /* 270 */ SyscallDesc("unknown #270", unimplementedFunc),
800 /* 271 */ SyscallDesc("unknown #271", unimplementedFunc),
801 /* 272 */ SyscallDesc("unknown #272", unimplementedFunc),
802 /* 273 */ SyscallDesc("unknown #273", unimplementedFunc),
803 /* 274 */ SyscallDesc("unknown #274", unimplementedFunc),
804 /* 275 */ SyscallDesc("unknown #275", unimplementedFunc),
805 /* 276 */ SyscallDesc("unknown #276", unimplementedFunc),
806 /* 277 */ SyscallDesc("unknown #277", unimplementedFunc),
807 /* 278 */ SyscallDesc("unknown #278", unimplementedFunc),
808 /* 279 */ SyscallDesc("unknown #279", unimplementedFunc),
809 /* 280 */ SyscallDesc("unknown #280", unimplementedFunc),
810 /* 281 */ SyscallDesc("unknown #281", unimplementedFunc),
811 /* 282 */ SyscallDesc("unknown #282", unimplementedFunc),
812 /* 283 */ SyscallDesc("unknown #283", unimplementedFunc),
813 /* 284 */ SyscallDesc("unknown #284", unimplementedFunc),
814 /* 285 */ SyscallDesc("unknown #285", unimplementedFunc),
815 /* 286 */ SyscallDesc("unknown #286", unimplementedFunc),
816 /* 287 */ SyscallDesc("unknown #287", unimplementedFunc),
817 /* 288 */ SyscallDesc("unknown #288", unimplementedFunc),
818 /* 289 */ SyscallDesc("unknown #289", unimplementedFunc),
819 /* 290 */ SyscallDesc("unknown #290", unimplementedFunc),
820 /* 291 */ SyscallDesc("unknown #291", unimplementedFunc),
821 /* 292 */ SyscallDesc("unknown #292", unimplementedFunc),
822 /* 293 */ SyscallDesc("unknown #293", unimplementedFunc),
823 /* 294 */ SyscallDesc("unknown #294", unimplementedFunc),
824 /* 295 */ SyscallDesc("unknown #295", unimplementedFunc),
825 /* 296 */ SyscallDesc("unknown #296", unimplementedFunc),
826 /* 297 */ SyscallDesc("unknown #297", unimplementedFunc),
827 /* 298 */ SyscallDesc("unknown #298", unimplementedFunc),
828 /* 299 */ SyscallDesc("unknown #299", unimplementedFunc),
829 /*
830 * Linux-specific system calls begin at 300
831 */
832 /* 300 */ SyscallDesc("bdflush", unimplementedFunc),
833 /* 301 */ SyscallDesc("sethae", unimplementedFunc),
834 /* 302 */ SyscallDesc("mount", unimplementedFunc),
835 /* 303 */ SyscallDesc("old_adjtimex", unimplementedFunc),
836 /* 304 */ SyscallDesc("swapoff", unimplementedFunc),
837 /* 305 */ SyscallDesc("getdents", unimplementedFunc),
838 /* 306 */ SyscallDesc("create_module", unimplementedFunc),
839 /* 307 */ SyscallDesc("init_module", unimplementedFunc),
840 /* 308 */ SyscallDesc("delete_module", unimplementedFunc),
841 /* 309 */ SyscallDesc("get_kernel_syms", unimplementedFunc),
842 /* 310 */ SyscallDesc("syslog", unimplementedFunc),
843 /* 311 */ SyscallDesc("reboot", unimplementedFunc),
844 /* 312 */ SyscallDesc("clone", unimplementedFunc),
845 /* 313 */ SyscallDesc("uselib", unimplementedFunc),
846 /* 314 */ SyscallDesc("mlock", unimplementedFunc),
847 /* 315 */ SyscallDesc("munlock", unimplementedFunc),
848 /* 316 */ SyscallDesc("mlockall", unimplementedFunc),
849 /* 317 */ SyscallDesc("munlockall", unimplementedFunc),
850 /* 318 */ SyscallDesc("sysinfo", unimplementedFunc),
851 /* 319 */ SyscallDesc("_sysctl", unimplementedFunc),
852 /* 320 */ SyscallDesc("was sys_idle", unimplementedFunc),
853 /* 321 */ SyscallDesc("oldumount", unimplementedFunc),
854 /* 322 */ SyscallDesc("swapon", unimplementedFunc),
855 /* 323 */ SyscallDesc("times", ignoreFunc),
856 /* 324 */ SyscallDesc("personality", unimplementedFunc),
857 /* 325 */ SyscallDesc("setfsuid", unimplementedFunc),
858 /* 326 */ SyscallDesc("setfsgid", unimplementedFunc),
859 /* 327 */ SyscallDesc("ustat", unimplementedFunc),
860 /* 328 */ SyscallDesc("statfs", unimplementedFunc),
861 /* 329 */ SyscallDesc("fstatfs", unimplementedFunc),
862 /* 330 */ SyscallDesc("sched_setparam", unimplementedFunc),
863 /* 331 */ SyscallDesc("sched_getparam", unimplementedFunc),
864 /* 332 */ SyscallDesc("sched_setscheduler", unimplementedFunc),
865 /* 333 */ SyscallDesc("sched_getscheduler", unimplementedFunc),
866 /* 334 */ SyscallDesc("sched_yield", unimplementedFunc),
867 /* 335 */ SyscallDesc("sched_get_priority_max", unimplementedFunc),
868 /* 336 */ SyscallDesc("sched_get_priority_min", unimplementedFunc),
869 /* 337 */ SyscallDesc("sched_rr_get_interval", unimplementedFunc),
870 /* 338 */ SyscallDesc("afs_syscall", unimplementedFunc),
871 /* 339 */ SyscallDesc("uname", unameFunc),
872 /* 340 */ SyscallDesc("nanosleep", unimplementedFunc),
873 /* 341 */ SyscallDesc("mremap", unimplementedFunc),
874 /* 342 */ SyscallDesc("nfsservctl", unimplementedFunc),
875 /* 343 */ SyscallDesc("setresuid", unimplementedFunc),
876 /* 344 */ SyscallDesc("getresuid", unimplementedFunc),
877 /* 345 */ SyscallDesc("pciconfig_read", unimplementedFunc),
878 /* 346 */ SyscallDesc("pciconfig_write", unimplementedFunc),
879 /* 347 */ SyscallDesc("query_module", unimplementedFunc),
880 /* 348 */ SyscallDesc("prctl", unimplementedFunc),
881 /* 349 */ SyscallDesc("pread", unimplementedFunc),
882 /* 350 */ SyscallDesc("pwrite", unimplementedFunc),
883 /* 351 */ SyscallDesc("rt_sigreturn", unimplementedFunc),
884 /* 352 */ SyscallDesc("rt_sigaction", ignoreFunc),
885 /* 353 */ SyscallDesc("rt_sigprocmask", unimplementedFunc),
886 /* 354 */ SyscallDesc("rt_sigpending", unimplementedFunc),
887 /* 355 */ SyscallDesc("rt_sigtimedwait", unimplementedFunc),
888 /* 356 */ SyscallDesc("rt_sigqueueinfo", unimplementedFunc),
889 /* 357 */ SyscallDesc("rt_sigsuspend", unimplementedFunc),
890 /* 358 */ SyscallDesc("select", unimplementedFunc),
891 /* 359 */ SyscallDesc("gettimeofday", gettimeofdayFunc<Linux>),
892 /* 360 */ SyscallDesc("settimeofday", unimplementedFunc),
893 /* 361 */ SyscallDesc("getitimer", unimplementedFunc),
894 /* 362 */ SyscallDesc("setitimer", unimplementedFunc),
895 /* 363 */ SyscallDesc("utimes", utimesFunc<Linux>),
896 /* 364 */ SyscallDesc("getrusage", getrusageFunc<Linux>),
897 /* 365 */ SyscallDesc("wait4", unimplementedFunc),
898 /* 366 */ SyscallDesc("adjtimex", unimplementedFunc),
899 /* 367 */ SyscallDesc("getcwd", unimplementedFunc),
900 /* 368 */ SyscallDesc("capget", unimplementedFunc),
901 /* 369 */ SyscallDesc("capset", unimplementedFunc),
902 /* 370 */ SyscallDesc("sendfile", unimplementedFunc),
903 /* 371 */ SyscallDesc("setresgid", unimplementedFunc),
904 /* 372 */ SyscallDesc("getresgid", unimplementedFunc),
905 /* 373 */ SyscallDesc("dipc", unimplementedFunc),
906 /* 374 */ SyscallDesc("pivot_root", unimplementedFunc),
907 /* 375 */ SyscallDesc("mincore", unimplementedFunc),
908 /* 376 */ SyscallDesc("pciconfig_iobase", unimplementedFunc),
909 /* 377 */ SyscallDesc("getdents64", unimplementedFunc),
910 /* 378 */ SyscallDesc("gettid", unimplementedFunc),
911 /* 379 */ SyscallDesc("readahead", unimplementedFunc),
912 /* 380 */ SyscallDesc("security", unimplementedFunc),
913 /* 381 */ SyscallDesc("tkill", unimplementedFunc),
914 /* 382 */ SyscallDesc("setxattr", unimplementedFunc),
915 /* 383 */ SyscallDesc("lsetxattr", unimplementedFunc),
916 /* 384 */ SyscallDesc("fsetxattr", unimplementedFunc),
917 /* 385 */ SyscallDesc("getxattr", unimplementedFunc),
918 /* 386 */ SyscallDesc("lgetxattr", unimplementedFunc),
919 /* 387 */ SyscallDesc("fgetxattr", unimplementedFunc),
920 /* 388 */ SyscallDesc("listxattr", unimplementedFunc),
921 /* 389 */ SyscallDesc("llistxattr", unimplementedFunc),
922 /* 390 */ SyscallDesc("flistxattr", unimplementedFunc),
923 /* 391 */ SyscallDesc("removexattr", unimplementedFunc),
924 /* 392 */ SyscallDesc("lremovexattr", unimplementedFunc),
925 /* 393 */ SyscallDesc("fremovexattr", unimplementedFunc),
926 /* 394 */ SyscallDesc("futex", unimplementedFunc),
927 /* 395 */ SyscallDesc("sched_setaffinity", unimplementedFunc),
928 /* 396 */ SyscallDesc("sched_getaffinity", unimplementedFunc),
929 /* 397 */ SyscallDesc("tuxcall", unimplementedFunc),
930 /* 398 */ SyscallDesc("io_setup", unimplementedFunc),
931 /* 399 */ SyscallDesc("io_destroy", unimplementedFunc),
932 /* 400 */ SyscallDesc("io_getevents", unimplementedFunc),
933 /* 401 */ SyscallDesc("io_submit", unimplementedFunc),
934 /* 402 */ SyscallDesc("io_cancel", unimplementedFunc),
935 /* 403 */ SyscallDesc("unknown #403", unimplementedFunc),
936 /* 404 */ SyscallDesc("unknown #404", unimplementedFunc),
937 /* 405 */ SyscallDesc("exit_group", exitFunc), // exit all threads...
938 /* 406 */ SyscallDesc("lookup_dcookie", unimplementedFunc),
939 /* 407 */ SyscallDesc("sys_epoll_create", unimplementedFunc),
940 /* 408 */ SyscallDesc("sys_epoll_ctl", unimplementedFunc),
941 /* 409 */ SyscallDesc("sys_epoll_wait", unimplementedFunc),
942 /* 410 */ SyscallDesc("remap_file_pages", unimplementedFunc),
943 /* 411 */ SyscallDesc("set_tid_address", unimplementedFunc),
944 /* 412 */ SyscallDesc("restart_syscall", unimplementedFunc),
945 /* 413 */ SyscallDesc("fadvise64", unimplementedFunc),
946 /* 414 */ SyscallDesc("timer_create", unimplementedFunc),
947 /* 415 */ SyscallDesc("timer_settime", unimplementedFunc),
948 /* 416 */ SyscallDesc("timer_gettime", unimplementedFunc),
949 /* 417 */ SyscallDesc("timer_getoverrun", unimplementedFunc),
950 /* 418 */ SyscallDesc("timer_delete", unimplementedFunc),
951 /* 419 */ SyscallDesc("clock_settime", unimplementedFunc),
952 /* 420 */ SyscallDesc("clock_gettime", unimplementedFunc),
953 /* 421 */ SyscallDesc("clock_getres", unimplementedFunc),
954 /* 422 */ SyscallDesc("clock_nanosleep", unimplementedFunc),
955 /* 423 */ SyscallDesc("semtimedop", unimplementedFunc),
956 /* 424 */ SyscallDesc("tgkill", unimplementedFunc),
957 /* 425 */ SyscallDesc("stat64", unimplementedFunc),
958 /* 426 */ SyscallDesc("lstat64", lstat64Func<Linux>),
959 /* 427 */ SyscallDesc("fstat64", fstat64Func<Linux>),
960 /* 428 */ SyscallDesc("vserver", unimplementedFunc),
961 /* 429 */ SyscallDesc("mbind", unimplementedFunc),
962 /* 430 */ SyscallDesc("get_mempolicy", unimplementedFunc),
963 /* 431 */ SyscallDesc("set_mempolicy", unimplementedFunc),
964 /* 432 */ SyscallDesc("mq_open", unimplementedFunc),
965 /* 433 */ SyscallDesc("mq_unlink", unimplementedFunc),
966 /* 434 */ SyscallDesc("mq_timedsend", unimplementedFunc),
967 /* 435 */ SyscallDesc("mq_timedreceive", unimplementedFunc),
968 /* 436 */ SyscallDesc("mq_notify", unimplementedFunc),
969 /* 437 */ SyscallDesc("mq_getsetattr", unimplementedFunc),
970 /* 438 */ SyscallDesc("waitid", unimplementedFunc),
971 /* 439 */ SyscallDesc("add_key", unimplementedFunc),
972 /* 440 */ SyscallDesc("request_key", unimplementedFunc),
973 /* 441 */ SyscallDesc("keyctl", unimplementedFunc)
974 };
975
976 const int Linux::Num_Syscall_Descs =
977 sizeof(Linux::syscallDescs) / sizeof(SyscallDesc);
978
979 const int Linux::Max_Syscall_Desc = Linux::Num_Syscall_Descs - 1;
980
981
982 void
983 AlphaLinuxProcess::syscall(ExecContext *xc)
984 {
985 num_syscalls++;
986
987 int64_t callnum = xc->regs.intRegFile[ReturnValueReg];
988
989 Linux::doSyscall(callnum, this, xc);
990 }
991
992
993 AlphaLinuxProcess::AlphaLinuxProcess(const std::string &name,
994 ObjectFile *objFile,
995 int stdin_fd,
996 int stdout_fd,
997 int stderr_fd,
998 std::vector<std::string> &argv,
999 std::vector<std::string> &envp)
1000 : LiveProcess(name, objFile, stdin_fd, stdout_fd, stderr_fd, argv, envp)
1001 {
1002 init_regs->intRegFile[0] = 0;
1003 }