Merge zizzer:/bk/m5 into isabel.reinhardt.house:/z/stever/bk/m5
[gem5.git] / arch / alpha / alpha_tru64_process.cc
1 /*
2 * Copyright (c) 2003 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 <errno.h>
30 #include <unistd.h>
31 #include <fcntl.h> // for host open() flags
32 #include <sys/types.h>
33 #include <sys/stat.h>
34 #include <string.h> // for memset()
35 #include <dirent.h>
36
37 #include "sim/host.hh"
38 #include "cpu/base_cpu.hh"
39 #include "mem/functional_mem/functional_memory.hh"
40 #include "sim/process.hh"
41 #include "cpu/exec_context.hh"
42 #include "sim/fake_syscall.hh"
43
44 #include "arch/alpha/alpha_common_syscall_emul.hh"
45 #include "arch/alpha/alpha_tru64_process.hh"
46
47 #include "sim/syscall_emul.hh"
48 #include "sim/universe.hh" // for curTick & ticksPerSecond
49
50 #include "base/trace.hh"
51
52 using namespace std;
53
54 class Tru64 {
55
56 public:
57
58 //
59 // basic Tru64 types
60 //
61
62 typedef uint64_t size_t;
63 typedef uint64_t off_t;
64 typedef uint16_t nlink_t;
65 typedef int32_t dev_t;
66 typedef uint32_t uid_t;
67 typedef uint32_t gid_t;
68 typedef uint32_t time_t;
69 typedef uint32_t mode_t;
70 typedef uint32_t ino_t;
71
72 // open(2) flags
73 static const int TGT_O_RDONLY = 00000000;
74 static const int TGT_O_WRONLY = 00000001;
75 static const int TGT_O_RDWR = 00000002;
76 static const int TGT_O_NONBLOCK = 00000004;
77 static const int TGT_O_APPEND = 00000010;
78 static const int TGT_O_CREAT = 00001000;
79 static const int TGT_O_TRUNC = 00002000;
80 static const int TGT_O_EXCL = 00004000;
81 static const int TGT_O_NOCTTY = 00010000;
82 static const int TGT_O_SYNC = 00040000;
83 static const int TGT_O_DRD = 00100000;
84 static const int TGT_O_DIRECTIO = 00200000;
85 static const int TGT_O_CACHE = 00400000;
86 static const int TGT_O_DSYNC = 02000000;
87 static const int TGT_O_RSYNC = 04000000;
88
89 static OpenFlagTransTable openFlagTable[];
90 static const int NUM_OPEN_FLAGS;
91
92 //
93 // Stat buffer. Note that Tru64 v5.0+ use a new "F64" stat structure,
94 // and a new set of syscall numbers for stat calls. Backwards
95 // compatibility with v4.x should be feasible by implementing another
96 // set of stat functions using the old structure definition and
97 // binding them to the old syscall numbers, but we haven't done that
98 // yet.
99 //
100
101 struct F64_stat {
102 dev_t st_dev;
103 int32_t st_retired1;
104 mode_t st_mode;
105 nlink_t st_nlink;
106 uint16_t st_nlink_reserved;
107 uid_t st_uid;
108 gid_t st_gid;
109 dev_t st_rdev;
110 dev_t st_ldev;
111 off_t st_size;
112 time_t st_retired2;
113 int32_t st_uatime;
114 time_t st_retired3;
115 int32_t st_umtime;
116 time_t st_retired4;
117 int32_t st_uctime;
118 int32_t st_retired5;
119 int32_t st_retired6;
120 uint32_t st_flags;
121 uint32_t st_gen;
122 uint64_t st_spare[4];
123 ino_t st_ino;
124 int32_t st_ino_reserved;
125 time_t st_atimeX;
126 int32_t st_atime_reserved;
127 time_t st_mtimeX;
128 int32_t st_mtime_reserved;
129 time_t st_ctimeX;
130 int32_t st_ctime_reserved;
131 uint64_t st_blksize;
132 uint64_t st_blocks;
133 };
134
135
136 //
137 // for getdirentries()
138 //
139
140 struct dirent
141 {
142 ino_t d_ino; /* file number of entry */
143 uint16_t d_reclen; /* length of this record */
144 uint16_t d_namlen; /* length of string in d_name */
145 char d_name[256]; /* dummy name length */
146 };
147
148
149 //
150 // for uname()
151 //
152
153 static const int _SYS_NMLN = 32;
154
155 struct utsname {
156 char sysname[_SYS_NMLN];
157 char nodename[_SYS_NMLN];
158 char release[_SYS_NMLN];
159 char version[_SYS_NMLN];
160 char machine[_SYS_NMLN];
161 };
162
163
164 //
165 // for ioctl()
166 //
167
168 static const unsigned TIOCGETP = 0x40067408;
169 static const unsigned TIOCSETP = 0x80067409;
170 static const unsigned TIOCSETN = 0x8006740a;
171 static const unsigned TIOCSETC = 0x80067411;
172 static const unsigned TIOCGETC = 0x40067412;
173 static const unsigned FIONREAD = 0x4004667f;
174 static const unsigned TIOCISATTY = 0x2000745e;
175
176 //
177 // for getrlimit()
178 //
179
180 enum rlimit_resources {
181 RLIMIT_CPU = 0,
182 RLIMIT_FSIZE = 1,
183 RLIMIT_DATA = 2,
184 RLIMIT_STACK = 3,
185 RLIMIT_CORE = 4,
186 RLIMIT_RSS = 5,
187 RLIMIT_NOFILE = 6,
188 RLIMIT_AS = 7,
189 RLIMIT_VMEM = 7
190 };
191
192 struct rlimit {
193 uint64_t rlim_cur; // soft limit
194 uint64_t rlim_max; // hard limit
195 };
196
197
198 //
199 // for mmap()
200 //
201 static const unsigned TGT_MAP_ANONYMOUS = 0x10;
202
203
204 //
205 // for getsysinfo()
206 //
207
208 static const unsigned GSI_PLATFORM_NAME = 103; // get platform name as string
209 static const unsigned GSI_CPU_INFO = 59; // CPU information
210 static const unsigned GSI_PROC_TYPE = 60; // get proc_type
211 static const unsigned GSI_MAX_CPU = 30; // max # cpu's on this machine
212 static const unsigned GSI_CPUS_IN_BOX = 55; // number of processors in system
213 static const unsigned GSI_PHYSMEM = 19; // Amount of physical memory in KB
214 static const unsigned GSI_CLK_TCK = 42; // clock freq in Hz
215
216 struct cpu_info {
217 uint32_t current_cpu;
218 uint32_t cpus_in_box;
219 uint32_t cpu_type;
220 uint32_t ncpus;
221 uint64_t cpus_present;
222 uint64_t cpus_running;
223 uint64_t cpu_binding;
224 uint64_t cpu_ex_binding;
225 uint32_t mhz;
226 uint32_t unused[3]; // future expansion
227 };
228
229 //
230 // for gettimeofday
231 //
232
233 struct timeval {
234 uint32_t tv_sec;
235 uint32_t tv_usec;
236 };
237
238 //
239 // for getrusage
240 //
241
242
243 static const int RUSAGE_THREAD = 1;
244 static const int RUSAGE_SELF = 0;
245 static const int RUSAGE_CHILDREN = -1;
246
247 struct rusage {
248 struct timeval ru_utime; // user time used
249 struct timeval ru_stime; // system time used
250 uint64_t ru_maxrss;
251 uint64_t ru_ixrss; // integral shared memory size
252 uint64_t ru_idrss; // integral unshared data "
253 uint64_t ru_isrss; // integral unshared stack "
254 uint64_t ru_minflt; // page reclaims - total vmfaults
255 uint64_t ru_majflt; // page faults
256 uint64_t ru_nswap; // swaps
257 uint64_t ru_inblock; // block input operations
258 uint64_t ru_oublock; // block output operations
259 uint64_t ru_msgsnd; // messages sent
260 uint64_t ru_msgrcv; // messages received
261 uint64_t ru_nsignals; // signals received
262 uint64_t ru_nvcsw; // voluntary context switches
263 uint64_t ru_nivcsw; // involuntary "
264 };
265
266 //
267 // for sigreturn
268 //
269
270 struct sigcontext {
271 int64_t sc_onstack; // sigstack state to restore
272 int64_t sc_mask; // signal mask to restore
273 int64_t sc_pc; // pc at time of signal
274 int64_t sc_ps; // psl to retore
275 int64_t sc_regs[32]; // processor regs 0 to 31
276 int64_t sc_ownedfp; // fp has been used
277 int64_t sc_fpregs[32]; // fp regs 0 to 31
278 uint64_t sc_fpcr; // floating point control reg
279 uint64_t sc_fp_control; // software fpcr
280 int64_t sc_reserved1; // reserved for kernel
281 uint32_t sc_kreserved1; // reserved for kernel
282 uint32_t sc_kreserved2; // reserved for kernel
283 size_t sc_ssize; // stack size
284 caddr_t sc_sbase; // stack start
285 uint64_t sc_traparg_a0; // a0 argument to trap on exc
286 uint64_t sc_traparg_a1; // a1 argument to trap on exc
287 uint64_t sc_traparg_a2; // a2 argument to trap on exc
288 uint64_t sc_fp_trap_pc; // imprecise pc
289 uint64_t sc_fp_trigger_sum; // Exception summary at trigg
290 uint64_t sc_fp_trigger_inst; // Instruction at trigger pc
291 };
292
293
294 //
295 // for table
296 //
297 static const int TBL_SYSINFO = 12;
298
299 struct tbl_sysinfo {
300 uint64_t si_user; // User time
301 uint64_t si_nice; // Nice time
302 uint64_t si_sys; // System time
303 uint64_t si_idle; // Idle time
304 uint64_t si_hz;
305 uint64_t si_phz;
306 uint64_t si_boottime; // Boot time in seconds
307 uint64_t wait; // Wait time
308 uint32_t si_max_procs; // rpb->rpb_numprocs
309 uint32_t pad;
310 };
311
312
313 //
314 // for stack_create
315 //
316
317 struct vm_stack {
318 // void *
319 Addr address; // address hint
320 size_t rsize; // red zone size
321 size_t ysize; // yellow zone size
322 size_t gsize; // green zone size
323 size_t swap; // amount of swap to reserve
324 size_t incr; // growth increment
325 uint64_t align; // address alignment
326 uint64_t flags; // MAP_FIXED etc.
327 // struct memalloc_attr *
328 Addr attr; // allocation policy
329 uint64_t reserved;
330 };
331
332 //
333 // return values for nxm calls
334 //
335 enum {
336 KERN_NOT_RECEIVER = 7,
337 KERN_NOT_IN_SET = 12
338 };
339
340 //
341 // for nxm_task_init
342 //
343
344 static const int NXM_TASK_INIT_VP = 2; // initial thread is VP
345
346 struct nxm_task_attr {
347 int64_t nxm_callback;
348 unsigned int nxm_version;
349 unsigned short nxm_uniq_offset;
350 unsigned short flags;
351 int nxm_quantum;
352 int pad1;
353 int64_t pad2;
354 };
355
356 typedef uint64_t sigset_t;
357
358 struct ushared_state {
359 sigset_t sigmask; // thread signal mask
360 sigset_t sig; // thread pending mask
361 // struct nxm_pth_state *
362 Addr pth_id; // out-of-line state
363 int flags; // shared flags
364 #define US_SIGSTACK 0x1 // thread called sigaltstack
365 #define US_ONSTACK 0x2 // thread is running on altstack
366 #define US_PROFILE 0x4 // thread called profil
367 #define US_SYSCALL 0x8 // thread in syscall
368 #define US_TRAP 0x10 // thread has trapped
369 #define US_YELLOW 0x20 // thread has mellowed yellow
370 #define US_YZONE 0x40 // thread has zoned out
371 #define US_FP_OWNED 0x80 // thread used floating point
372
373 int cancel_state; // thread's cancelation state
374 #define US_CANCEL 0x1 // cancel pending
375 #define US_NOCANCEL 0X2 // synch cancel disabled
376 #define US_SYS_NOCANCEL 0x4 // syscall cancel disabled
377 #define US_ASYNC_NOCANCEL 0x8 // asynch cancel disabled
378 #define US_CANCEL_BITS (US_NOCANCEL|US_SYS_NOCANCEL|US_ASYNC_NOCANCEL)
379 #define US_CANCEL_MASK (US_CANCEL|US_NOCANCEL|US_SYS_NOCANCEL| \
380 US_ASYNC_NOCANCEL)
381
382 // These are semi-shared. They are always visible to
383 // the kernel but are never context-switched by the library.
384
385 int nxm_ssig; // scheduler's synchronous signals
386 int reserved1;
387 int64_t nxm_active; // scheduler active
388 int64_t reserved2;
389 };
390
391 struct nxm_sched_state {
392 struct ushared_state nxm_u; // state own by user thread
393 unsigned int nxm_bits; // scheduler state / slot
394 int nxm_quantum; // quantum count-down value
395 int nxm_set_quantum; // quantum reset value
396 int nxm_sysevent; // syscall state
397 // struct nxm_upcall *
398 Addr nxm_uc_ret; // stack ptr of null thread
399 // void *
400 Addr nxm_tid; // scheduler's thread id
401 int64_t nxm_va; // page fault address
402 // struct nxm_pth_state *
403 Addr nxm_pthid; // id of null thread
404 uint64_t nxm_bound_pcs_count; // bound PCS thread count
405 int64_t pad[2];
406 };
407
408 struct nxm_shared {
409 int64_t nxm_callback; // address of upcall routine
410 unsigned int nxm_version; // version number
411 unsigned short nxm_uniq_offset; // correction factor for TEB
412 unsigned short pad1;
413 int64_t space[2]; // future growth
414 struct nxm_sched_state nxm_ss[1]; // array of shared areas
415 };
416
417 enum nxm_slot_state_t {
418 NXM_SLOT_AVAIL,
419 NXM_SLOT_BOUND,
420 NXM_SLOT_UNBOUND,
421 NXM_SLOT_EMPTY
422 };
423
424
425 struct nxm_config_info {
426 int nxm_nslots_per_rad; // max number of VP slots per RAD
427 int nxm_nrads; // max number of RADs
428 // nxm_slot_state_t *
429 Addr nxm_slot_state; // per-VP slot state
430 // struct nxm_shared *
431 Addr nxm_rad[1]; // per-RAD shared areas
432 };
433
434 //
435 // for nxm_thread_create
436 //
437
438 enum nxm_thread_type {
439 NXM_TYPE_SCS = 0,
440 NXM_TYPE_VP = 1,
441 NXM_TYPE_MANAGER = 2
442 };
443
444
445 struct nxm_thread_attr {
446 int version;
447 int type;
448 int cancel_flags;
449 int priority;
450 int policy;
451 int signal_type;
452 // void *
453 Addr pthid;
454 sigset_t sigmask;
455 struct {
456 uint64_t pc;
457 uint64_t sp;
458 uint64_t a0;
459 } registers;
460 uint64_t pad2[2];
461 };
462
463 static
464 void
465 copyOutStatBuf(FunctionalMemory *mem, Addr addr, struct stat *host)
466 {
467 TypedBufferArg<Tru64::F64_stat> tgt(addr);
468
469 tgt->st_dev = host->st_dev;
470 tgt->st_ino = host->st_ino;
471 tgt->st_mode = host->st_mode;
472 tgt->st_nlink = host->st_nlink;
473 tgt->st_uid = host->st_uid;
474 tgt->st_gid = host->st_gid;
475 tgt->st_rdev = host->st_rdev;
476 tgt->st_size = host->st_size;
477 tgt->st_atimeX = host->st_atime;
478 tgt->st_mtimeX = host->st_mtime;
479 tgt->st_ctimeX = host->st_ctime;
480 tgt->st_blksize = host->st_blksize;
481 tgt->st_blocks = host->st_blocks;
482
483 tgt.copyOut(mem);
484 }
485
486 static const char *hostname;
487
488 static
489 int
490 unameFunc(SyscallDesc *desc, int callnum, Process *process,
491 ExecContext *xc)
492 {
493 TypedBufferArg<Tru64::utsname> name(xc->getSyscallArg(0));
494
495 strcpy(name->sysname, "OSF1");
496 strcpy(name->nodename, hostname);
497 strcpy(name->release, "V5.1");
498 strcpy(name->version, "732");
499 strcpy(name->machine, "alpha");
500
501 name.copyOut(xc->mem);
502 return 0;
503 }
504
505
506 static
507 int
508 getsysinfoFunc(SyscallDesc *desc, int callnum, Process *process,
509 ExecContext *xc)
510 {
511 unsigned op = xc->getSyscallArg(0);
512 unsigned nbytes = xc->getSyscallArg(2);
513
514 switch (op) {
515
516 case Tru64::GSI_MAX_CPU: {
517 TypedBufferArg<uint32_t> max_cpu(xc->getSyscallArg(1));
518 *max_cpu = process->numCpus();
519 max_cpu.copyOut(xc->mem);
520 return 1;
521 }
522
523 case Tru64::GSI_CPUS_IN_BOX: {
524 TypedBufferArg<uint32_t> cpus_in_box(xc->getSyscallArg(1));
525 *cpus_in_box = process->numCpus();
526 cpus_in_box.copyOut(xc->mem);
527 return 1;
528 }
529
530 case Tru64::GSI_PHYSMEM: {
531 TypedBufferArg<uint64_t> physmem(xc->getSyscallArg(1));
532 *physmem = 1024 * 1024; // physical memory in KB
533 physmem.copyOut(xc->mem);
534 return 1;
535 }
536
537 case Tru64::GSI_CPU_INFO: {
538 TypedBufferArg<Tru64::cpu_info> infop(xc->getSyscallArg(1));
539
540 infop->current_cpu = 0;
541 infop->cpus_in_box = process->numCpus();
542 infop->cpu_type = 57;
543 infop->ncpus = process->numCpus();
544 int cpumask = (1 << process->numCpus()) - 1;
545 infop->cpus_present = infop->cpus_running = cpumask;
546 infop->cpu_binding = 0;
547 infop->cpu_ex_binding = 0;
548 infop->mhz = 667;
549
550 infop.copyOut(xc->mem);
551 return 1;
552 }
553
554 case Tru64::GSI_PROC_TYPE: {
555 TypedBufferArg<uint64_t> proc_type(xc->getSyscallArg(1));
556 *proc_type = 11;
557 proc_type.copyOut(xc->mem);
558 return 1;
559 }
560
561 case Tru64::GSI_PLATFORM_NAME: {
562 BufferArg bufArg(xc->getSyscallArg(1), nbytes);
563 strncpy((char *)bufArg.bufferPtr(),
564 "COMPAQ Professional Workstation XP1000",
565 nbytes);
566 bufArg.copyOut(xc->mem);
567 return 1;
568 }
569
570 case Tru64::GSI_CLK_TCK: {
571 TypedBufferArg<uint64_t> clk_hz(xc->getSyscallArg(1));
572 *clk_hz = 1024;
573 clk_hz.copyOut(xc->mem);
574 return 1;
575 }
576
577 default:
578 cerr << "getsysinfo: unknown op " << op << endl;
579 abort();
580 break;
581 }
582
583 return 0;
584 }
585
586 static
587 int
588 fcntlFunc(SyscallDesc *desc, int callnum, Process *process,
589 ExecContext *xc)
590 {
591 int fd = xc->getSyscallArg(0);
592
593 if (fd < 0 || process->sim_fd(fd) < 0)
594 return -EBADF;
595
596 int cmd = xc->getSyscallArg(1);
597 switch (cmd) {
598 case 0: // F_DUPFD
599 // if we really wanted to support this, we'd need to do it
600 // in the target fd space.
601 warn("fcntl(%d, F_DUPFD) not supported, error returned\n", fd);
602 return -EMFILE;
603
604 case 1: // F_GETFD (get close-on-exec flag)
605 case 2: // F_SETFD (set close-on-exec flag)
606 return 0;
607
608 case 3: // F_GETFL (get file flags)
609 case 4: // F_SETFL (set file flags)
610 // not sure if this is totally valid, but we'll pass it through
611 // to the underlying OS
612 warn("fcntl(%d, %d) passed through to host\n", fd, cmd);
613 return fcntl(process->sim_fd(fd), cmd);
614 // return 0;
615
616 case 7: // F_GETLK (get lock)
617 case 8: // F_SETLK (set lock)
618 case 9: // F_SETLKW (set lock and wait)
619 // don't mess with file locking... just act like it's OK
620 warn("File lock call (fcntl(%d, %d)) ignored.\n", fd, cmd);
621 return 0;
622
623 default:
624 warn("Unknown fcntl command %d\n", cmd);
625 return 0;
626 }
627 }
628
629
630 static
631 int
632 getdirentriesFunc(SyscallDesc *desc, int callnum, Process *process,
633 ExecContext *xc)
634 {
635 int fd = process->sim_fd(xc->getSyscallArg(0));
636 Addr tgt_buf = xc->getSyscallArg(1);
637 int tgt_nbytes = xc->getSyscallArg(2);
638 Addr tgt_basep = xc->getSyscallArg(3);
639
640 char * const host_buf = new char[tgt_nbytes];
641
642 // just pass basep through uninterpreted.
643 TypedBufferArg<int64_t> basep(tgt_basep);
644 basep.copyIn(xc->mem);
645 ::off_t host_basep = (off_t)*basep;
646 int host_result = getdirentries(fd, host_buf, tgt_nbytes, &host_basep);
647
648 // check for error
649 if (host_result < 0) {
650 delete [] host_buf;
651 return -errno;
652 }
653
654 // no error: copy results back to target space
655 Addr tgt_buf_ptr = tgt_buf;
656 char *host_buf_ptr = host_buf;
657 char *host_buf_end = host_buf + host_result;
658 while (host_buf_ptr < host_buf_end) {
659 struct dirent *host_dp = (struct dirent *)host_buf_ptr;
660 int namelen = strlen(host_dp->d_name);
661
662 // Actual size includes padded string rounded up for alignment.
663 // Subtract 256 for dummy char array in Tru64::dirent definition.
664 // Add 1 to namelen for terminating null char.
665 int tgt_bufsize = sizeof(Tru64::dirent) - 256 + RoundUp(namelen+1, 8);
666 TypedBufferArg<Tru64::dirent> tgt_dp(tgt_buf_ptr, tgt_bufsize);
667 tgt_dp->d_ino = host_dp->d_ino;
668 tgt_dp->d_reclen = tgt_bufsize;
669 tgt_dp->d_namlen = namelen;
670 strcpy(tgt_dp->d_name, host_dp->d_name);
671 tgt_dp.copyOut(xc->mem);
672
673 tgt_buf_ptr += tgt_bufsize;
674 host_buf_ptr += host_dp->d_reclen;
675 }
676
677 delete [] host_buf;
678
679 *basep = host_basep;
680 basep.copyOut(xc->mem);
681
682 return (tgt_buf_ptr - tgt_buf);
683 }
684
685
686 static
687 int
688 sigreturnFunc(SyscallDesc *desc, int callnum, Process *process,
689 ExecContext *xc)
690 {
691 RegFile *regs = &xc->regs;
692 TypedBufferArg<Tru64::sigcontext> sc(xc->getSyscallArg(0));
693
694 sc.copyIn(xc->mem);
695
696 // Restore state from sigcontext structure.
697 // Note that we'll advance PC <- NPC before the end of the cycle,
698 // so we need to restore the desired PC into NPC.
699 // The current regs->pc will get clobbered.
700 regs->npc = sc->sc_pc;
701
702 for (int i = 0; i < 31; ++i) {
703 regs->intRegFile[i] = sc->sc_regs[i];
704 regs->floatRegFile.q[i] = sc->sc_fpregs[i];
705 }
706
707 regs->miscRegs.fpcr = sc->sc_fpcr;
708
709 return 0;
710 }
711
712 static
713 int
714 tableFunc(SyscallDesc *desc, int callnum, Process *process,
715 ExecContext *xc)
716 {
717 int id = xc->getSyscallArg(0); // table ID
718 int index = xc->getSyscallArg(1); // index into table
719 // arg 2 is buffer pointer; type depends on table ID
720 int nel = xc->getSyscallArg(3); // number of elements
721 int lel = xc->getSyscallArg(4); // expected element size
722
723 switch (id) {
724 case Tru64::TBL_SYSINFO: {
725 if (index != 0 || nel != 1 || lel != sizeof(Tru64::tbl_sysinfo))
726 return -EINVAL;
727 TypedBufferArg<Tru64::tbl_sysinfo> elp(xc->getSyscallArg(2));
728
729 const int clk_hz = one_million;
730 elp->si_user = curTick / (ticksPerSecond / clk_hz);
731 elp->si_nice = 0;
732 elp->si_sys = 0;
733 elp->si_idle = 0;
734 elp->wait = 0;
735 elp->si_hz = clk_hz;
736 elp->si_phz = clk_hz;
737 elp->si_boottime = seconds_since_epoch; // seconds since epoch?
738 elp->si_max_procs = process->numCpus();
739 elp.copyOut(xc->mem);
740 return 0;
741 }
742
743 default:
744 cerr << "table(): id " << id << " unknown." << endl;
745 return -EINVAL;
746 }
747 }
748
749 static SyscallDesc syscallDescs[];
750
751 static const int Num_Syscall_Descs;
752 static const int Max_Syscall_Desc;
753
754 //
755 // Mach syscalls -- identified by negated syscall numbers
756 //
757
758 // Create a stack region for a thread.
759 static
760 int
761 stack_createFunc(SyscallDesc *desc, int callnum, Process *process,
762 ExecContext *xc)
763 {
764 TypedBufferArg<Tru64::vm_stack> argp(xc->getSyscallArg(0));
765
766 argp.copyIn(xc->mem);
767
768 // if the user chose an address, just let them have it. Otherwise
769 // pick one for them.
770 if (argp->address == 0) {
771 argp->address = process->next_thread_stack_base;
772 int stack_size = (argp->rsize + argp->ysize + argp->gsize);
773 process->next_thread_stack_base -= stack_size;
774 argp.copyOut(xc->mem);
775 }
776
777 return 0;
778 }
779
780 static
781 const int NXM_LIB_VERSION = 301003;
782
783 //
784 // This call sets up the interface between the user and kernel
785 // schedulers by creating a shared-memory region. The shared memory
786 // region has several structs, some global, some per-RAD, some per-VP.
787 //
788 static
789 int
790 nxm_task_initFunc(SyscallDesc *desc, int callnum, Process *process,
791 ExecContext *xc)
792 {
793 TypedBufferArg<Tru64::nxm_task_attr> attrp(xc->getSyscallArg(0));
794 TypedBufferArg<Addr> configptr_ptr(xc->getSyscallArg(1));
795
796 attrp.copyIn(xc->mem);
797
798 if (attrp->nxm_version != NXM_LIB_VERSION) {
799 cerr << "nxm_task_init: thread library version mismatch! "
800 << "got " << attrp->nxm_version
801 << ", expected " << NXM_LIB_VERSION << endl;
802 abort();
803 }
804
805 if (attrp->flags != Tru64::NXM_TASK_INIT_VP) {
806 cerr << "nxm_task_init: bad flag value " << attrp->flags
807 << " (expected " << Tru64::NXM_TASK_INIT_VP << ")" << endl;
808 abort();
809 }
810
811 const Addr base_addr = 0x12000; // was 0x3f0000000LL;
812 Addr cur_addr = base_addr; // next addresses to use
813 // first comes the config_info struct
814 Addr config_addr = cur_addr;
815 cur_addr += sizeof(Tru64::nxm_config_info);
816 // next comes the per-cpu state vector
817 Addr slot_state_addr = cur_addr;
818 int slot_state_size = process->numCpus() * sizeof(Tru64::nxm_slot_state_t);
819 cur_addr += slot_state_size;
820 // now the per-RAD state struct (we only support one RAD)
821 cur_addr = 0x14000; // bump up addr for alignment
822 Addr rad_state_addr = cur_addr;
823 int rad_state_size =
824 (sizeof(Tru64::nxm_shared)
825 + (process->numCpus()-1) * sizeof(Tru64::nxm_sched_state));
826 cur_addr += rad_state_size;
827
828 // now initialize a config_info struct and copy it out to user space
829 TypedBufferArg<Tru64::nxm_config_info> config(config_addr);
830
831 config->nxm_nslots_per_rad = process->numCpus();
832 config->nxm_nrads = 1; // only one RAD in our system!
833 config->nxm_slot_state = slot_state_addr;
834 config->nxm_rad[0] = rad_state_addr;
835
836 config.copyOut(xc->mem);
837
838 // initialize the slot_state array and copy it out
839 TypedBufferArg<Tru64::nxm_slot_state_t> slot_state(slot_state_addr,
840 slot_state_size);
841 for (int i = 0; i < process->numCpus(); ++i) {
842 // CPU 0 is bound to the calling process; all others are available
843 slot_state[i] = (i == 0) ? Tru64::NXM_SLOT_BOUND : Tru64::NXM_SLOT_AVAIL;
844 }
845
846 slot_state.copyOut(xc->mem);
847
848 // same for the per-RAD "shared" struct. Note that we need to
849 // allocate extra bytes for the per-VP array which is embedded at
850 // the end.
851 TypedBufferArg<Tru64::nxm_shared> rad_state(rad_state_addr,
852 rad_state_size);
853
854 rad_state->nxm_callback = attrp->nxm_callback;
855 rad_state->nxm_version = attrp->nxm_version;
856 rad_state->nxm_uniq_offset = attrp->nxm_uniq_offset;
857 for (int i = 0; i < process->numCpus(); ++i) {
858 Tru64::nxm_sched_state *ssp = &rad_state->nxm_ss[i];
859 ssp->nxm_u.sigmask = 0;
860 ssp->nxm_u.sig = 0;
861 ssp->nxm_u.flags = 0;
862 ssp->nxm_u.cancel_state = 0;
863 ssp->nxm_u.nxm_ssig = 0;
864 ssp->nxm_bits = 0;
865 ssp->nxm_quantum = attrp->nxm_quantum;
866 ssp->nxm_set_quantum = attrp->nxm_quantum;
867 ssp->nxm_sysevent = 0;
868
869 if (i == 0) {
870 uint64_t uniq = xc->regs.miscRegs.uniq;
871 ssp->nxm_u.pth_id = uniq + attrp->nxm_uniq_offset;
872 ssp->nxm_u.nxm_active = uniq | 1;
873 }
874 else {
875 ssp->nxm_u.pth_id = 0;
876 ssp->nxm_u.nxm_active = 0;
877 }
878 }
879
880 rad_state.copyOut(xc->mem);
881
882 //
883 // copy pointer to shared config area out to user
884 //
885 *configptr_ptr = config_addr;
886 configptr_ptr.copyOut(xc->mem);
887
888 return 0;
889 }
890
891
892 static void
893 init_exec_context(ExecContext *ec,
894 Tru64::nxm_thread_attr *attrp, uint64_t uniq_val)
895 {
896 memset(&ec->regs, 0, sizeof(ec->regs));
897
898 ec->regs.intRegFile[ArgumentReg0] = attrp->registers.a0;
899 ec->regs.intRegFile[27/*t12*/] = attrp->registers.pc;
900 ec->regs.intRegFile[StackPointerReg] = attrp->registers.sp;
901 ec->regs.miscRegs.uniq = uniq_val;
902
903 ec->regs.pc = attrp->registers.pc;
904 ec->regs.npc = attrp->registers.pc + sizeof(MachInst);
905
906 ec->setStatus(ExecContext::Active);
907 }
908
909 static
910 int
911 nxm_thread_createFunc(SyscallDesc *desc, int callnum, Process *process,
912 ExecContext *xc)
913 {
914 TypedBufferArg<Tru64::nxm_thread_attr> attrp(xc->getSyscallArg(0));
915 TypedBufferArg<uint64_t> kidp(xc->getSyscallArg(1));
916 int thread_index = xc->getSyscallArg(2);
917
918 // get attribute args
919 attrp.copyIn(xc->mem);
920
921 if (attrp->version != NXM_LIB_VERSION) {
922 cerr << "nxm_thread_create: thread library version mismatch! "
923 << "got " << attrp->version
924 << ", expected " << NXM_LIB_VERSION << endl;
925 abort();
926 }
927
928 if (thread_index < 0 | thread_index > process->numCpus()) {
929 cerr << "nxm_thread_create: bad thread index " << thread_index
930 << endl;
931 abort();
932 }
933
934 // On a real machine, the per-RAD shared structure is in
935 // shared memory, so both the user and kernel can get at it.
936 // We don't have that luxury, so we just copy it in and then
937 // back out again.
938 int rad_state_size =
939 (sizeof(Tru64::nxm_shared) +
940 (process->numCpus()-1) * sizeof(Tru64::nxm_sched_state));
941
942 TypedBufferArg<Tru64::nxm_shared> rad_state(0x14000,
943 rad_state_size);
944 rad_state.copyIn(xc->mem);
945
946 uint64_t uniq_val = attrp->pthid - rad_state->nxm_uniq_offset;
947
948 if (attrp->type == Tru64::NXM_TYPE_MANAGER) {
949 // DEC pthreads seems to always create one of these (in
950 // addition to N application threads), but we don't use it,
951 // so don't bother creating it.
952
953 // This is supposed to be a port number. Make something up.
954 *kidp = 99;
955 kidp.copyOut(xc->mem);
956
957 return 0;
958 } else if (attrp->type == Tru64::NXM_TYPE_VP) {
959 // A real "virtual processor" kernel thread. Need to fork
960 // this thread on another CPU.
961 Tru64::nxm_sched_state *ssp = &rad_state->nxm_ss[thread_index];
962
963 if (ssp->nxm_u.nxm_active != 0)
964 return Tru64::KERN_NOT_RECEIVER;
965
966 ssp->nxm_u.pth_id = attrp->pthid;
967 ssp->nxm_u.nxm_active = uniq_val | 1;
968
969 rad_state.copyOut(xc->mem);
970
971 Addr slot_state_addr = 0x12000 + sizeof(Tru64::nxm_config_info);
972 int slot_state_size = process->numCpus() * sizeof(Tru64::nxm_slot_state_t);
973
974 TypedBufferArg<Tru64::nxm_slot_state_t> slot_state(slot_state_addr,
975 slot_state_size);
976
977 slot_state.copyIn(xc->mem);
978
979 if (slot_state[thread_index] != Tru64::NXM_SLOT_AVAIL) {
980 cerr << "nxm_thread_createFunc: requested VP slot "
981 << thread_index << " not available!" << endl;
982 fatal("");
983 }
984
985 slot_state[thread_index] = Tru64::NXM_SLOT_BOUND;
986
987 slot_state.copyOut(xc->mem);
988
989 // Find a free simulator execution context.
990 for (int i = 0; i < process->numCpus(); ++i) {
991 ExecContext *xc = process->execContexts[i];
992
993 if (xc->status() == ExecContext::Unallocated) {
994 // inactive context... grab it
995 init_exec_context(xc, attrp, uniq_val);
996
997 // This is supposed to be a port number, but we'll try
998 // and get away with just sticking the thread index
999 // here.
1000 *kidp = thread_index;
1001 kidp.copyOut(xc->mem);
1002
1003 return 0;
1004 }
1005 }
1006
1007 // fell out of loop... no available inactive context
1008 cerr << "nxm_thread_create: no idle contexts available." << endl;
1009 abort();
1010 } else {
1011 cerr << "nxm_thread_create: can't handle thread type "
1012 << attrp->type << endl;
1013 abort();
1014 }
1015
1016 return 0;
1017 }
1018
1019
1020 static
1021 int
1022 nxm_idleFunc(SyscallDesc *desc, int callnum, Process *process,
1023 ExecContext *xc)
1024 {
1025 return 0;
1026 }
1027
1028 static
1029 int
1030 nxm_thread_blockFunc(SyscallDesc *desc, int callnum, Process *process,
1031 ExecContext *xc)
1032 {
1033 uint64_t tid = xc->getSyscallArg(0);
1034 uint64_t secs = xc->getSyscallArg(1);
1035 uint64_t flags = xc->getSyscallArg(2);
1036 uint64_t action = xc->getSyscallArg(3);
1037 uint64_t usecs = xc->getSyscallArg(4);
1038
1039 cout << xc->cpu->name() << ": nxm_thread_block " << tid << " " << secs
1040 << " " << flags << " " << action << " " << usecs << endl;
1041
1042 return 0;
1043 }
1044
1045
1046 static
1047 int
1048 nxm_blockFunc(SyscallDesc *desc, int callnum, Process *process,
1049 ExecContext *xc)
1050 {
1051 Addr uaddr = xc->getSyscallArg(0);
1052 uint64_t val = xc->getSyscallArg(1);
1053 uint64_t secs = xc->getSyscallArg(2);
1054 uint64_t usecs = xc->getSyscallArg(3);
1055 uint64_t flags = xc->getSyscallArg(4);
1056
1057 BaseCPU *cpu = xc->cpu;
1058
1059 cout << cpu->name() << ": nxm_block " << hex << uaddr << dec << " " << val
1060 << " " << secs << " " << usecs
1061 << " " << flags << endl;
1062
1063 return 0;
1064 }
1065
1066
1067 static
1068 int
1069 nxm_unblockFunc(SyscallDesc *desc, int callnum, Process *process,
1070 ExecContext *xc)
1071 {
1072 Addr uaddr = xc->getSyscallArg(0);
1073
1074 cout << xc->cpu->name() << ": nxm_unblock "
1075 << hex << uaddr << dec << endl;
1076
1077 return 0;
1078 }
1079
1080
1081 static
1082 int
1083 swtch_priFunc(SyscallDesc *desc, int callnum, Process *process,
1084 ExecContext *xc)
1085 {
1086 // Attempts to switch to another runnable thread (if there is
1087 // one). Returns false if there are no other threads to run
1088 // (i.e., the thread can reasonably spin-wait) or true if there
1089 // are other threads.
1090 //
1091 // Since we assume at most one "kernel" thread per CPU, it's
1092 // always safe to return false here.
1093 return false;
1094 }
1095
1096
1097 // just activate one by default
1098 static int
1099 activate_waiting_context(Addr uaddr, Process *process,
1100 bool activate_all = false)
1101 {
1102 int num_activated = 0;
1103
1104 list<Process::WaitRec>::iterator i = process->waitList.begin();
1105 list<Process::WaitRec>::iterator end = process->waitList.end();
1106
1107 while (i != end && (num_activated == 0 || activate_all)) {
1108 if (i->waitChan == uaddr) {
1109 // found waiting process: make it active
1110 ExecContext *newCtx = i->waitingContext;
1111 assert(newCtx->status() == ExecContext::Suspended);
1112 newCtx->setStatus(ExecContext::Active);
1113
1114 // get rid of this record
1115 i = process->waitList.erase(i);
1116
1117 ++num_activated;
1118 } else {
1119 ++i;
1120 }
1121 }
1122
1123 return num_activated;
1124 }
1125
1126
1127 static void
1128 m5_lock_mutex(Addr uaddr, Process *process, ExecContext *xc)
1129 {
1130 TypedBufferArg<uint64_t> lockp(uaddr);
1131
1132 lockp.copyIn(xc->mem);
1133
1134 if (*lockp == 0) {
1135 // lock is free: grab it
1136 *lockp = 1;
1137 lockp.copyOut(xc->mem);
1138 } else {
1139 // lock is busy: disable until free
1140 process->waitList.push_back(Process::WaitRec(uaddr, xc));
1141 xc->setStatus(ExecContext::Suspended);
1142 }
1143 }
1144
1145 static void
1146 m5_unlock_mutex(Addr uaddr, Process *process, ExecContext *xc)
1147 {
1148 TypedBufferArg<uint64_t> lockp(uaddr);
1149
1150 lockp.copyIn(xc->mem);
1151 assert(*lockp != 0);
1152
1153 // Check for a process waiting on the lock.
1154 int num_waiting = activate_waiting_context(uaddr, process);
1155
1156 // clear lock field if no waiting context is taking over the lock
1157 if (num_waiting == 0) {
1158 *lockp = 0;
1159 lockp.copyOut(xc->mem);
1160 }
1161 }
1162
1163
1164 static
1165 int
1166 m5_mutex_lockFunc(SyscallDesc *desc, int callnum, Process *process,
1167 ExecContext *xc)
1168 {
1169 Addr uaddr = xc->getSyscallArg(0);
1170
1171 m5_lock_mutex(uaddr, process, xc);
1172
1173 // Return 0 since we will always return to the user with the lock
1174 // acquired. We will just keep the context inactive until that is
1175 // true.
1176 return 0;
1177 }
1178
1179
1180 static
1181 int
1182 m5_mutex_trylockFunc(SyscallDesc *desc, int callnum, Process *process,
1183 ExecContext *xc)
1184 {
1185 Addr uaddr = xc->getSyscallArg(0);
1186 TypedBufferArg<uint64_t> lockp(uaddr);
1187
1188 lockp.copyIn(xc->mem);
1189
1190 if (*lockp == 0) {
1191 // lock is free: grab it
1192 *lockp = 1;
1193 lockp.copyOut(xc->mem);
1194 return 0;
1195 } else {
1196 return 1;
1197 }
1198 }
1199
1200
1201 static
1202 int
1203 m5_mutex_unlockFunc(SyscallDesc *desc, int callnum, Process *process,
1204 ExecContext *xc)
1205 {
1206 Addr uaddr = xc->getSyscallArg(0);
1207
1208 m5_unlock_mutex(uaddr, process, xc);
1209
1210 return 0;
1211 }
1212
1213
1214 static
1215 int
1216 m5_cond_signalFunc(SyscallDesc *desc, int callnum, Process *process,
1217 ExecContext *xc)
1218 {
1219 Addr cond_addr = xc->getSyscallArg(0);
1220
1221 // Wqake up one process waiting on the condition variable.
1222 activate_waiting_context(cond_addr, process);
1223
1224 return 0;
1225 }
1226
1227
1228 static
1229 int
1230 m5_cond_broadcastFunc(SyscallDesc *desc, int callnum, Process *process,
1231 ExecContext *xc)
1232 {
1233 Addr cond_addr = xc->getSyscallArg(0);
1234
1235 // Wake up all processes waiting on the condition variable.
1236 activate_waiting_context(cond_addr, process, true);
1237
1238 return 0;
1239 }
1240
1241
1242 static
1243 int
1244 m5_cond_waitFunc(SyscallDesc *desc, int callnum, Process *process,
1245 ExecContext *xc)
1246 {
1247 Addr cond_addr = xc->getSyscallArg(0);
1248 Addr lock_addr = xc->getSyscallArg(1);
1249 TypedBufferArg<uint64_t> condp(cond_addr);
1250 TypedBufferArg<uint64_t> lockp(lock_addr);
1251
1252 // user is supposed to acquire lock before entering
1253 lockp.copyIn(xc->mem);
1254 assert(*lockp != 0);
1255
1256 m5_unlock_mutex(lock_addr, process, xc);
1257
1258 process->waitList.push_back(Process::WaitRec(cond_addr, xc));
1259 xc->setStatus(ExecContext::Suspended);
1260
1261 return 0;
1262 }
1263
1264
1265 static
1266 int
1267 m5_thread_exitFunc(SyscallDesc *desc, int callnum, Process *process,
1268 ExecContext *xc)
1269 {
1270 assert(xc->status() == ExecContext::Active);
1271 xc->setStatus(ExecContext::Unallocated);
1272
1273 return 0;
1274 }
1275
1276
1277 static SyscallDesc machSyscallDescs[];
1278
1279 static const int Num_Mach_Syscall_Descs;
1280 static const int Max_Mach_Syscall_Desc;
1281
1282 // Since negated values are used to identify Mach syscalls, the
1283 // minimum (signed) valid syscall number is the negated max Mach
1284 // syscall number.
1285 static const int Min_Syscall_Desc;
1286
1287 //
1288 // helper function for invoking syscalls
1289 //
1290 static
1291 void
1292 doSyscall(int callnum, Process *process, ExecContext *xc)
1293 {
1294 if (callnum < Min_Syscall_Desc || callnum > Max_Syscall_Desc) {
1295 cerr << "Syscall " << callnum << " out of range" << endl;
1296 abort();
1297 }
1298
1299 SyscallDesc *desc =
1300 (callnum < 0) ? &machSyscallDescs[-callnum] : &syscallDescs[callnum];
1301
1302 desc->doSyscall(callnum, process, xc);
1303 }
1304
1305 //
1306 // Indirect syscall invocation (call #0)
1307 //
1308 static
1309 int
1310 indirectSyscallFunc(SyscallDesc *desc, int callnum, Process *process,
1311 ExecContext *xc)
1312 {
1313 int new_callnum = xc->getSyscallArg(0);
1314
1315 for (int i = 0; i < 5; ++i)
1316 xc->setSyscallArg(i, xc->getSyscallArg(i+1));
1317
1318 doSyscall(new_callnum, process, xc);
1319
1320 return 0;
1321 }
1322
1323
1324 }; // class Tru64
1325
1326
1327 // open(2) flags translation table
1328 OpenFlagTransTable Tru64::openFlagTable[] = {
1329 /* target flag */ /* host flag */
1330 #ifdef _MSC_VER
1331 { Tru64::TGT_O_RDONLY, _O_RDONLY },
1332 { Tru64::TGT_O_WRONLY, _O_WRONLY },
1333 { Tru64::TGT_O_RDWR, _O_RDWR },
1334 { Tru64::TGT_O_APPEND, _O_APPEND },
1335 { Tru64::TGT_O_CREAT, _O_CREAT },
1336 { Tru64::TGT_O_TRUNC, _O_TRUNC },
1337 { Tru64::TGT_O_EXCL, _O_EXCL },
1338 #ifdef _O_NONBLOCK
1339 { Tru64::TGT_O_NONBLOCK, _O_NONBLOCK },
1340 #endif
1341 #ifdef _O_NOCTTY
1342 { Tru64::TGT_O_NOCTTY, _O_NOCTTY },
1343 #endif
1344 #ifdef _O_SYNC
1345 { Tru64::TGT_O_SYNC, _O_SYNC },
1346 #endif
1347 #else /* !_MSC_VER */
1348 { Tru64::TGT_O_RDONLY, O_RDONLY },
1349 { Tru64::TGT_O_WRONLY, O_WRONLY },
1350 { Tru64::TGT_O_RDWR, O_RDWR },
1351 { Tru64::TGT_O_APPEND, O_APPEND },
1352 { Tru64::TGT_O_CREAT, O_CREAT },
1353 { Tru64::TGT_O_TRUNC, O_TRUNC },
1354 { Tru64::TGT_O_EXCL, O_EXCL },
1355 { Tru64::TGT_O_NONBLOCK, O_NONBLOCK },
1356 { Tru64::TGT_O_NOCTTY, O_NOCTTY },
1357 #ifdef O_SYNC
1358 { Tru64::TGT_O_SYNC, O_SYNC },
1359 #endif
1360 #endif /* _MSC_VER */
1361 };
1362
1363 const int Tru64::NUM_OPEN_FLAGS = (sizeof(Tru64::openFlagTable)/sizeof(Tru64::openFlagTable[0]));
1364
1365 const char *Tru64::hostname = "m5.eecs.umich.edu";
1366
1367 SyscallDesc Tru64::syscallDescs[] = {
1368 /* 0 */ SyscallDesc("syscall (#0)", indirectSyscallFunc,
1369 SyscallDesc::SuppressReturnValue),
1370 /* 1 */ SyscallDesc("exit", exitFunc),
1371 /* 2 */ SyscallDesc("fork", unimplementedFunc),
1372 /* 3 */ SyscallDesc("read", readFunc),
1373 /* 4 */ SyscallDesc("write", writeFunc),
1374 /* 5 */ SyscallDesc("old_open", unimplementedFunc),
1375 /* 6 */ SyscallDesc("close", closeFunc),
1376 /* 7 */ SyscallDesc("wait4", unimplementedFunc),
1377 /* 8 */ SyscallDesc("old_creat", unimplementedFunc),
1378 /* 9 */ SyscallDesc("link", unimplementedFunc),
1379 /* 10 */ SyscallDesc("unlink", unimplementedFunc),
1380 /* 11 */ SyscallDesc("execv", unimplementedFunc),
1381 /* 12 */ SyscallDesc("chdir", unimplementedFunc),
1382 /* 13 */ SyscallDesc("fchdir", unimplementedFunc),
1383 /* 14 */ SyscallDesc("mknod", unimplementedFunc),
1384 /* 15 */ SyscallDesc("chmod", unimplementedFunc),
1385 /* 16 */ SyscallDesc("chown", unimplementedFunc),
1386 /* 17 */ SyscallDesc("obreak", obreakFunc),
1387 /* 18 */ SyscallDesc("pre_F64_getfsstat", unimplementedFunc),
1388 /* 19 */ SyscallDesc("lseek", lseekFunc),
1389 /* 20 */ SyscallDesc("getpid", getpidFunc),
1390 /* 21 */ SyscallDesc("mount", unimplementedFunc),
1391 /* 22 */ SyscallDesc("unmount", unimplementedFunc),
1392 /* 23 */ SyscallDesc("setuid", setuidFunc),
1393 /* 24 */ SyscallDesc("getuid", getuidFunc),
1394 /* 25 */ SyscallDesc("exec_with_loader", unimplementedFunc),
1395 /* 26 */ SyscallDesc("ptrace", unimplementedFunc),
1396 /* 27 */ SyscallDesc("recvmsg", unimplementedFunc),
1397 /* 28 */ SyscallDesc("sendmsg", unimplementedFunc),
1398 /* 29 */ SyscallDesc("recvfrom", unimplementedFunc),
1399 /* 30 */ SyscallDesc("accept", unimplementedFunc),
1400 /* 31 */ SyscallDesc("getpeername", unimplementedFunc),
1401 /* 32 */ SyscallDesc("getsockname", unimplementedFunc),
1402 /* 33 */ SyscallDesc("access", unimplementedFunc),
1403 /* 34 */ SyscallDesc("chflags", unimplementedFunc),
1404 /* 35 */ SyscallDesc("fchflags", unimplementedFunc),
1405 /* 36 */ SyscallDesc("sync", unimplementedFunc),
1406 /* 37 */ SyscallDesc("kill", unimplementedFunc),
1407 /* 38 */ SyscallDesc("old_stat", unimplementedFunc),
1408 /* 39 */ SyscallDesc("setpgid", unimplementedFunc),
1409 /* 40 */ SyscallDesc("old_lstat", unimplementedFunc),
1410 /* 41 */ SyscallDesc("dup", unimplementedFunc),
1411 /* 42 */ SyscallDesc("pipe", unimplementedFunc),
1412 /* 43 */ SyscallDesc("set_program_attributes", unimplementedFunc),
1413 /* 44 */ SyscallDesc("profil", unimplementedFunc),
1414 /* 45 */ SyscallDesc("open", openFunc<Tru64>),
1415 /* 46 */ SyscallDesc("obsolete osigaction", unimplementedFunc),
1416 /* 47 */ SyscallDesc("getgid", getgidFunc),
1417 /* 48 */ SyscallDesc("sigprocmask", ignoreFunc),
1418 /* 49 */ SyscallDesc("getlogin", unimplementedFunc),
1419 /* 50 */ SyscallDesc("setlogin", unimplementedFunc),
1420 /* 51 */ SyscallDesc("acct", unimplementedFunc),
1421 /* 52 */ SyscallDesc("sigpending", unimplementedFunc),
1422 /* 53 */ SyscallDesc("classcntl", unimplementedFunc),
1423 /* 54 */ SyscallDesc("ioctl", ioctlFunc<Tru64>),
1424 /* 55 */ SyscallDesc("reboot", unimplementedFunc),
1425 /* 56 */ SyscallDesc("revoke", unimplementedFunc),
1426 /* 57 */ SyscallDesc("symlink", unimplementedFunc),
1427 /* 58 */ SyscallDesc("readlink", unimplementedFunc),
1428 /* 59 */ SyscallDesc("execve", unimplementedFunc),
1429 /* 60 */ SyscallDesc("umask", unimplementedFunc),
1430 /* 61 */ SyscallDesc("chroot", unimplementedFunc),
1431 /* 62 */ SyscallDesc("old_fstat", unimplementedFunc),
1432 /* 63 */ SyscallDesc("getpgrp", unimplementedFunc),
1433 /* 64 */ SyscallDesc("getpagesize", getpagesizeFunc),
1434 /* 65 */ SyscallDesc("mremap", unimplementedFunc),
1435 /* 66 */ SyscallDesc("vfork", unimplementedFunc),
1436 /* 67 */ SyscallDesc("pre_F64_stat", unimplementedFunc),
1437 /* 68 */ SyscallDesc("pre_F64_lstat", unimplementedFunc),
1438 /* 69 */ SyscallDesc("sbrk", unimplementedFunc),
1439 /* 70 */ SyscallDesc("sstk", unimplementedFunc),
1440 /* 71 */ SyscallDesc("mmap", mmapFunc<Tru64>),
1441 /* 72 */ SyscallDesc("ovadvise", unimplementedFunc),
1442 /* 73 */ SyscallDesc("munmap", munmapFunc),
1443 /* 74 */ SyscallDesc("mprotect", ignoreFunc),
1444 /* 75 */ SyscallDesc("madvise", unimplementedFunc),
1445 /* 76 */ SyscallDesc("old_vhangup", unimplementedFunc),
1446 /* 77 */ SyscallDesc("kmodcall", unimplementedFunc),
1447 /* 78 */ SyscallDesc("mincore", unimplementedFunc),
1448 /* 79 */ SyscallDesc("getgroups", unimplementedFunc),
1449 /* 80 */ SyscallDesc("setgroups", unimplementedFunc),
1450 /* 81 */ SyscallDesc("old_getpgrp", unimplementedFunc),
1451 /* 82 */ SyscallDesc("setpgrp", unimplementedFunc),
1452 /* 83 */ SyscallDesc("setitimer", unimplementedFunc),
1453 /* 84 */ SyscallDesc("old_wait", unimplementedFunc),
1454 /* 85 */ SyscallDesc("table", tableFunc),
1455 /* 86 */ SyscallDesc("getitimer", unimplementedFunc),
1456 /* 87 */ SyscallDesc("gethostname", gethostnameFunc),
1457 /* 88 */ SyscallDesc("sethostname", unimplementedFunc),
1458 /* 89 */ SyscallDesc("getdtablesize", unimplementedFunc),
1459 /* 90 */ SyscallDesc("dup2", unimplementedFunc),
1460 /* 91 */ SyscallDesc("pre_F64_fstat", unimplementedFunc),
1461 /* 92 */ SyscallDesc("fcntl", fcntlFunc),
1462 /* 93 */ SyscallDesc("select", unimplementedFunc),
1463 /* 94 */ SyscallDesc("poll", unimplementedFunc),
1464 /* 95 */ SyscallDesc("fsync", unimplementedFunc),
1465 /* 96 */ SyscallDesc("setpriority", unimplementedFunc),
1466 /* 97 */ SyscallDesc("socket", unimplementedFunc),
1467 /* 98 */ SyscallDesc("connect", unimplementedFunc),
1468 /* 99 */ SyscallDesc("old_accept", unimplementedFunc),
1469 /* 100 */ SyscallDesc("getpriority", unimplementedFunc),
1470 /* 101 */ SyscallDesc("old_send", unimplementedFunc),
1471 /* 102 */ SyscallDesc("old_recv", unimplementedFunc),
1472 /* 103 */ SyscallDesc("sigreturn", sigreturnFunc,
1473 SyscallDesc::SuppressReturnValue),
1474 /* 104 */ SyscallDesc("bind", unimplementedFunc),
1475 /* 105 */ SyscallDesc("setsockopt", unimplementedFunc),
1476 /* 106 */ SyscallDesc("listen", unimplementedFunc),
1477 /* 107 */ SyscallDesc("plock", unimplementedFunc),
1478 /* 108 */ SyscallDesc("old_sigvec", unimplementedFunc),
1479 /* 109 */ SyscallDesc("old_sigblock", unimplementedFunc),
1480 /* 110 */ SyscallDesc("old_sigsetmask", unimplementedFunc),
1481 /* 111 */ SyscallDesc("sigsuspend", unimplementedFunc),
1482 /* 112 */ SyscallDesc("sigstack", ignoreFunc),
1483 /* 113 */ SyscallDesc("old_recvmsg", unimplementedFunc),
1484 /* 114 */ SyscallDesc("old_sendmsg", unimplementedFunc),
1485 /* 115 */ SyscallDesc("obsolete vtrace", unimplementedFunc),
1486 /* 116 */ SyscallDesc("gettimeofday", gettimeofdayFunc<Tru64>),
1487 /* 117 */ SyscallDesc("getrusage", getrusageFunc<Tru64>),
1488 /* 118 */ SyscallDesc("getsockopt", unimplementedFunc),
1489 /* 119 */ SyscallDesc("numa_syscalls", unimplementedFunc),
1490 /* 120 */ SyscallDesc("readv", unimplementedFunc),
1491 /* 121 */ SyscallDesc("writev", unimplementedFunc),
1492 /* 122 */ SyscallDesc("settimeofday", unimplementedFunc),
1493 /* 123 */ SyscallDesc("fchown", unimplementedFunc),
1494 /* 124 */ SyscallDesc("fchmod", unimplementedFunc),
1495 /* 125 */ SyscallDesc("old_recvfrom", unimplementedFunc),
1496 /* 126 */ SyscallDesc("setreuid", unimplementedFunc),
1497 /* 127 */ SyscallDesc("setregid", unimplementedFunc),
1498 /* 128 */ SyscallDesc("rename", unimplementedFunc),
1499 /* 129 */ SyscallDesc("truncate", unimplementedFunc),
1500 /* 130 */ SyscallDesc("ftruncate", unimplementedFunc),
1501 /* 131 */ SyscallDesc("flock", unimplementedFunc),
1502 /* 132 */ SyscallDesc("setgid", unimplementedFunc),
1503 /* 133 */ SyscallDesc("sendto", unimplementedFunc),
1504 /* 134 */ SyscallDesc("shutdown", unimplementedFunc),
1505 /* 135 */ SyscallDesc("socketpair", unimplementedFunc),
1506 /* 136 */ SyscallDesc("mkdir", unimplementedFunc),
1507 /* 137 */ SyscallDesc("rmdir", unimplementedFunc),
1508 /* 138 */ SyscallDesc("utimes", unimplementedFunc),
1509 /* 139 */ SyscallDesc("obsolete 4.2 sigreturn", unimplementedFunc),
1510 /* 140 */ SyscallDesc("adjtime", unimplementedFunc),
1511 /* 141 */ SyscallDesc("old_getpeername", unimplementedFunc),
1512 /* 142 */ SyscallDesc("gethostid", unimplementedFunc),
1513 /* 143 */ SyscallDesc("sethostid", unimplementedFunc),
1514 /* 144 */ SyscallDesc("getrlimit", getrlimitFunc<Tru64>),
1515 /* 145 */ SyscallDesc("setrlimit", unimplementedFunc),
1516 /* 146 */ SyscallDesc("old_killpg", unimplementedFunc),
1517 /* 147 */ SyscallDesc("setsid", unimplementedFunc),
1518 /* 148 */ SyscallDesc("quotactl", unimplementedFunc),
1519 /* 149 */ SyscallDesc("oldquota", unimplementedFunc),
1520 /* 150 */ SyscallDesc("old_getsockname", unimplementedFunc),
1521 /* 151 */ SyscallDesc("pread", unimplementedFunc),
1522 /* 152 */ SyscallDesc("pwrite", unimplementedFunc),
1523 /* 153 */ SyscallDesc("pid_block", unimplementedFunc),
1524 /* 154 */ SyscallDesc("pid_unblock", unimplementedFunc),
1525 /* 155 */ SyscallDesc("signal_urti", unimplementedFunc),
1526 /* 156 */ SyscallDesc("sigaction", ignoreFunc),
1527 /* 157 */ SyscallDesc("sigwaitprim", unimplementedFunc),
1528 /* 158 */ SyscallDesc("nfssvc", unimplementedFunc),
1529 /* 159 */ SyscallDesc("getdirentries", getdirentriesFunc),
1530 /* 160 */ SyscallDesc("pre_F64_statfs", unimplementedFunc),
1531 /* 161 */ SyscallDesc("pre_F64_fstatfs", unimplementedFunc),
1532 /* 162 */ SyscallDesc("unknown #162", unimplementedFunc),
1533 /* 163 */ SyscallDesc("async_daemon", unimplementedFunc),
1534 /* 164 */ SyscallDesc("getfh", unimplementedFunc),
1535 /* 165 */ SyscallDesc("getdomainname", unimplementedFunc),
1536 /* 166 */ SyscallDesc("setdomainname", unimplementedFunc),
1537 /* 167 */ SyscallDesc("unknown #167", unimplementedFunc),
1538 /* 168 */ SyscallDesc("unknown #168", unimplementedFunc),
1539 /* 169 */ SyscallDesc("exportfs", unimplementedFunc),
1540 /* 170 */ SyscallDesc("unknown #170", unimplementedFunc),
1541 /* 171 */ SyscallDesc("unknown #171", unimplementedFunc),
1542 /* 172 */ SyscallDesc("unknown #172", unimplementedFunc),
1543 /* 173 */ SyscallDesc("unknown #173", unimplementedFunc),
1544 /* 174 */ SyscallDesc("unknown #174", unimplementedFunc),
1545 /* 175 */ SyscallDesc("unknown #175", unimplementedFunc),
1546 /* 176 */ SyscallDesc("unknown #176", unimplementedFunc),
1547 /* 177 */ SyscallDesc("unknown #177", unimplementedFunc),
1548 /* 178 */ SyscallDesc("unknown #178", unimplementedFunc),
1549 /* 179 */ SyscallDesc("unknown #179", unimplementedFunc),
1550 /* 180 */ SyscallDesc("unknown #180", unimplementedFunc),
1551 /* 181 */ SyscallDesc("alt_plock", unimplementedFunc),
1552 /* 182 */ SyscallDesc("unknown #182", unimplementedFunc),
1553 /* 183 */ SyscallDesc("unknown #183", unimplementedFunc),
1554 /* 184 */ SyscallDesc("getmnt", unimplementedFunc),
1555 /* 185 */ SyscallDesc("unknown #185", unimplementedFunc),
1556 /* 186 */ SyscallDesc("unknown #186", unimplementedFunc),
1557 /* 187 */ SyscallDesc("alt_sigpending", unimplementedFunc),
1558 /* 188 */ SyscallDesc("alt_setsid", unimplementedFunc),
1559 /* 189 */ SyscallDesc("unknown #189", unimplementedFunc),
1560 /* 190 */ SyscallDesc("unknown #190", unimplementedFunc),
1561 /* 191 */ SyscallDesc("unknown #191", unimplementedFunc),
1562 /* 192 */ SyscallDesc("unknown #192", unimplementedFunc),
1563 /* 193 */ SyscallDesc("unknown #193", unimplementedFunc),
1564 /* 194 */ SyscallDesc("unknown #194", unimplementedFunc),
1565 /* 195 */ SyscallDesc("unknown #195", unimplementedFunc),
1566 /* 196 */ SyscallDesc("unknown #196", unimplementedFunc),
1567 /* 197 */ SyscallDesc("unknown #197", unimplementedFunc),
1568 /* 198 */ SyscallDesc("unknown #198", unimplementedFunc),
1569 /* 199 */ SyscallDesc("swapon", unimplementedFunc),
1570 /* 200 */ SyscallDesc("msgctl", unimplementedFunc),
1571 /* 201 */ SyscallDesc("msgget", unimplementedFunc),
1572 /* 202 */ SyscallDesc("msgrcv", unimplementedFunc),
1573 /* 203 */ SyscallDesc("msgsnd", unimplementedFunc),
1574 /* 204 */ SyscallDesc("semctl", unimplementedFunc),
1575 /* 205 */ SyscallDesc("semget", unimplementedFunc),
1576 /* 206 */ SyscallDesc("semop", unimplementedFunc),
1577 /* 207 */ SyscallDesc("uname", unameFunc),
1578 /* 208 */ SyscallDesc("lchown", unimplementedFunc),
1579 /* 209 */ SyscallDesc("shmat", unimplementedFunc),
1580 /* 210 */ SyscallDesc("shmctl", unimplementedFunc),
1581 /* 211 */ SyscallDesc("shmdt", unimplementedFunc),
1582 /* 212 */ SyscallDesc("shmget", unimplementedFunc),
1583 /* 213 */ SyscallDesc("mvalid", unimplementedFunc),
1584 /* 214 */ SyscallDesc("getaddressconf", unimplementedFunc),
1585 /* 215 */ SyscallDesc("msleep", unimplementedFunc),
1586 /* 216 */ SyscallDesc("mwakeup", unimplementedFunc),
1587 /* 217 */ SyscallDesc("msync", unimplementedFunc),
1588 /* 218 */ SyscallDesc("signal", unimplementedFunc),
1589 /* 219 */ SyscallDesc("utc_gettime", unimplementedFunc),
1590 /* 220 */ SyscallDesc("utc_adjtime", unimplementedFunc),
1591 /* 221 */ SyscallDesc("unknown #221", unimplementedFunc),
1592 /* 222 */ SyscallDesc("security", unimplementedFunc),
1593 /* 223 */ SyscallDesc("kloadcall", unimplementedFunc),
1594 /* 224 */ SyscallDesc("stat", statFunc<Tru64>),
1595 /* 225 */ SyscallDesc("lstat", lstatFunc<Tru64>),
1596 /* 226 */ SyscallDesc("fstat", fstatFunc<Tru64>),
1597 /* 227 */ SyscallDesc("statfs", unimplementedFunc),
1598 /* 228 */ SyscallDesc("fstatfs", unimplementedFunc),
1599 /* 229 */ SyscallDesc("getfsstat", unimplementedFunc),
1600 /* 230 */ SyscallDesc("gettimeofday64", unimplementedFunc),
1601 /* 231 */ SyscallDesc("settimeofday64", unimplementedFunc),
1602 /* 232 */ SyscallDesc("unknown #232", unimplementedFunc),
1603 /* 233 */ SyscallDesc("getpgid", unimplementedFunc),
1604 /* 234 */ SyscallDesc("getsid", unimplementedFunc),
1605 /* 235 */ SyscallDesc("sigaltstack", ignoreFunc),
1606 /* 236 */ SyscallDesc("waitid", unimplementedFunc),
1607 /* 237 */ SyscallDesc("priocntlset", unimplementedFunc),
1608 /* 238 */ SyscallDesc("sigsendset", unimplementedFunc),
1609 /* 239 */ SyscallDesc("set_speculative", unimplementedFunc),
1610 /* 240 */ SyscallDesc("msfs_syscall", unimplementedFunc),
1611 /* 241 */ SyscallDesc("sysinfo", unimplementedFunc),
1612 /* 242 */ SyscallDesc("uadmin", unimplementedFunc),
1613 /* 243 */ SyscallDesc("fuser", unimplementedFunc),
1614 /* 244 */ SyscallDesc("proplist_syscall", unimplementedFunc),
1615 /* 245 */ SyscallDesc("ntp_adjtime", unimplementedFunc),
1616 /* 246 */ SyscallDesc("ntp_gettime", unimplementedFunc),
1617 /* 247 */ SyscallDesc("pathconf", unimplementedFunc),
1618 /* 248 */ SyscallDesc("fpathconf", unimplementedFunc),
1619 /* 249 */ SyscallDesc("sync2", unimplementedFunc),
1620 /* 250 */ SyscallDesc("uswitch", unimplementedFunc),
1621 /* 251 */ SyscallDesc("usleep_thread", unimplementedFunc),
1622 /* 252 */ SyscallDesc("audcntl", unimplementedFunc),
1623 /* 253 */ SyscallDesc("audgen", unimplementedFunc),
1624 /* 254 */ SyscallDesc("sysfs", unimplementedFunc),
1625 /* 255 */ SyscallDesc("subsys_info", unimplementedFunc),
1626 /* 256 */ SyscallDesc("getsysinfo", getsysinfoFunc),
1627 /* 257 */ SyscallDesc("setsysinfo", unimplementedFunc),
1628 /* 258 */ SyscallDesc("afs_syscall", unimplementedFunc),
1629 /* 259 */ SyscallDesc("swapctl", unimplementedFunc),
1630 /* 260 */ SyscallDesc("memcntl", unimplementedFunc),
1631 /* 261 */ SyscallDesc("fdatasync", unimplementedFunc),
1632 /* 262 */ SyscallDesc("oflock", unimplementedFunc),
1633 /* 263 */ SyscallDesc("F64_readv", unimplementedFunc),
1634 /* 264 */ SyscallDesc("F64_writev", unimplementedFunc),
1635 /* 265 */ SyscallDesc("cdslxlate", unimplementedFunc),
1636 /* 266 */ SyscallDesc("sendfile", unimplementedFunc),
1637 };
1638
1639 const int Tru64::Num_Syscall_Descs =
1640 sizeof(Tru64::syscallDescs) / sizeof(SyscallDesc);
1641
1642 const int Tru64::Max_Syscall_Desc = Tru64::Num_Syscall_Descs - 1;
1643
1644 SyscallDesc Tru64::machSyscallDescs[] = {
1645 /* 0 */ SyscallDesc("kern_invalid", unimplementedFunc),
1646 /* 1 */ SyscallDesc("m5_mutex_lock", m5_mutex_lockFunc),
1647 /* 2 */ SyscallDesc("m5_mutex_trylock", m5_mutex_trylockFunc),
1648 /* 3 */ SyscallDesc("m5_mutex_unlock", m5_mutex_unlockFunc),
1649 /* 4 */ SyscallDesc("m5_cond_signal", m5_cond_signalFunc),
1650 /* 5 */ SyscallDesc("m5_cond_broadcast", m5_cond_broadcastFunc),
1651 /* 6 */ SyscallDesc("m5_cond_wait", m5_cond_waitFunc),
1652 /* 7 */ SyscallDesc("m5_thread_exit", m5_thread_exitFunc),
1653 /* 8 */ SyscallDesc("kern_invalid", unimplementedFunc),
1654 /* 9 */ SyscallDesc("kern_invalid", unimplementedFunc),
1655 /* 10 */ SyscallDesc("task_self", unimplementedFunc),
1656 /* 11 */ SyscallDesc("thread_reply", unimplementedFunc),
1657 /* 12 */ SyscallDesc("task_notify", unimplementedFunc),
1658 /* 13 */ SyscallDesc("thread_self", unimplementedFunc),
1659 /* 14 */ SyscallDesc("kern_invalid", unimplementedFunc),
1660 /* 15 */ SyscallDesc("kern_invalid", unimplementedFunc),
1661 /* 16 */ SyscallDesc("kern_invalid", unimplementedFunc),
1662 /* 17 */ SyscallDesc("kern_invalid", unimplementedFunc),
1663 /* 18 */ SyscallDesc("kern_invalid", unimplementedFunc),
1664 /* 19 */ SyscallDesc("kern_invalid", unimplementedFunc),
1665 /* 20 */ SyscallDesc("msg_send_trap", unimplementedFunc),
1666 /* 21 */ SyscallDesc("msg_receive_trap", unimplementedFunc),
1667 /* 22 */ SyscallDesc("msg_rpc_trap", unimplementedFunc),
1668 /* 23 */ SyscallDesc("kern_invalid", unimplementedFunc),
1669 /* 24 */ SyscallDesc("nxm_block", nxm_blockFunc),
1670 /* 25 */ SyscallDesc("nxm_unblock", nxm_unblockFunc),
1671 /* 26 */ SyscallDesc("kern_invalid", unimplementedFunc),
1672 /* 27 */ SyscallDesc("kern_invalid", unimplementedFunc),
1673 /* 28 */ SyscallDesc("kern_invalid", unimplementedFunc),
1674 /* 29 */ SyscallDesc("nxm_thread_destroy", unimplementedFunc),
1675 /* 30 */ SyscallDesc("lw_wire", unimplementedFunc),
1676 /* 31 */ SyscallDesc("lw_unwire", unimplementedFunc),
1677 /* 32 */ SyscallDesc("nxm_thread_create", nxm_thread_createFunc),
1678 /* 33 */ SyscallDesc("nxm_task_init", nxm_task_initFunc),
1679 /* 34 */ SyscallDesc("kern_invalid", unimplementedFunc),
1680 /* 35 */ SyscallDesc("nxm_idle", nxm_idleFunc),
1681 /* 36 */ SyscallDesc("nxm_wakeup_idle", unimplementedFunc),
1682 /* 37 */ SyscallDesc("nxm_set_pthid", unimplementedFunc),
1683 /* 38 */ SyscallDesc("nxm_thread_kill", unimplementedFunc),
1684 /* 39 */ SyscallDesc("nxm_thread_block", nxm_thread_blockFunc),
1685 /* 40 */ SyscallDesc("nxm_thread_wakeup", unimplementedFunc),
1686 /* 41 */ SyscallDesc("init_process", unimplementedFunc),
1687 /* 42 */ SyscallDesc("nxm_get_binding", unimplementedFunc),
1688 /* 43 */ SyscallDesc("map_fd", unimplementedFunc),
1689 /* 44 */ SyscallDesc("nxm_resched", unimplementedFunc),
1690 /* 45 */ SyscallDesc("nxm_set_cancel", unimplementedFunc),
1691 /* 46 */ SyscallDesc("nxm_set_binding", unimplementedFunc),
1692 /* 47 */ SyscallDesc("stack_create", stack_createFunc),
1693 /* 48 */ SyscallDesc("nxm_get_state", unimplementedFunc),
1694 /* 49 */ SyscallDesc("nxm_thread_suspend", unimplementedFunc),
1695 /* 50 */ SyscallDesc("nxm_thread_resume", unimplementedFunc),
1696 /* 51 */ SyscallDesc("nxm_signal_check", unimplementedFunc),
1697 /* 52 */ SyscallDesc("htg_unix_syscall", unimplementedFunc),
1698 /* 53 */ SyscallDesc("kern_invalid", unimplementedFunc),
1699 /* 54 */ SyscallDesc("kern_invalid", unimplementedFunc),
1700 /* 55 */ SyscallDesc("host_self", unimplementedFunc),
1701 /* 56 */ SyscallDesc("host_priv_self", unimplementedFunc),
1702 /* 57 */ SyscallDesc("kern_invalid", unimplementedFunc),
1703 /* 58 */ SyscallDesc("kern_invalid", unimplementedFunc),
1704 /* 59 */ SyscallDesc("swtch_pri", swtch_priFunc),
1705 /* 60 */ SyscallDesc("swtch", unimplementedFunc),
1706 /* 61 */ SyscallDesc("thread_switch", unimplementedFunc),
1707 /* 62 */ SyscallDesc("semop_fast", unimplementedFunc),
1708 /* 63 */ SyscallDesc("nxm_pshared_init", unimplementedFunc),
1709 /* 64 */ SyscallDesc("nxm_pshared_block", unimplementedFunc),
1710 /* 65 */ SyscallDesc("nxm_pshared_unblock", unimplementedFunc),
1711 /* 66 */ SyscallDesc("nxm_pshared_destroy", unimplementedFunc),
1712 /* 67 */ SyscallDesc("nxm_swtch_pri", swtch_priFunc),
1713 /* 68 */ SyscallDesc("lw_syscall", unimplementedFunc),
1714 /* 69 */ SyscallDesc("kern_invalid", unimplementedFunc),
1715 /* 70 */ SyscallDesc("mach_sctimes_0", unimplementedFunc),
1716 /* 71 */ SyscallDesc("mach_sctimes_1", unimplementedFunc),
1717 /* 72 */ SyscallDesc("mach_sctimes_2", unimplementedFunc),
1718 /* 73 */ SyscallDesc("mach_sctimes_3", unimplementedFunc),
1719 /* 74 */ SyscallDesc("mach_sctimes_4", unimplementedFunc),
1720 /* 75 */ SyscallDesc("mach_sctimes_5", unimplementedFunc),
1721 /* 76 */ SyscallDesc("mach_sctimes_6", unimplementedFunc),
1722 /* 77 */ SyscallDesc("mach_sctimes_7", unimplementedFunc),
1723 /* 78 */ SyscallDesc("mach_sctimes_8", unimplementedFunc),
1724 /* 79 */ SyscallDesc("mach_sctimes_9", unimplementedFunc),
1725 /* 80 */ SyscallDesc("mach_sctimes_10", unimplementedFunc),
1726 /* 81 */ SyscallDesc("mach_sctimes_11", unimplementedFunc),
1727 /* 82 */ SyscallDesc("mach_sctimes_port_alloc_dealloc", unimplementedFunc)
1728 };
1729
1730 const int Tru64::Num_Mach_Syscall_Descs =
1731 sizeof(Tru64::machSyscallDescs) / sizeof(SyscallDesc);
1732 const int Tru64::Max_Mach_Syscall_Desc = Tru64::Num_Mach_Syscall_Descs - 1;
1733 const int Tru64::Min_Syscall_Desc = -Tru64::Max_Mach_Syscall_Desc;
1734
1735
1736 void
1737 AlphaTru64Process::syscall(ExecContext *xc)
1738 {
1739 num_syscalls++;
1740
1741 int64_t callnum = xc->regs.intRegFile[ReturnValueReg];
1742
1743 Tru64::doSyscall(callnum, this, xc);
1744 }
1745
1746
1747 AlphaTru64Process::AlphaTru64Process(const std::string &name,
1748 ObjectFile *objFile,
1749 int stdin_fd,
1750 int stdout_fd,
1751 int stderr_fd,
1752 std::vector<std::string> &argv,
1753 std::vector<std::string> &envp)
1754 : LiveProcess(name, objFile, stdin_fd, stdout_fd, stderr_fd, argv, envp)
1755 {
1756 }