16ca2c52aSchristos /*  This file is part of the program psim.
26ca2c52aSchristos 
36ca2c52aSchristos     Copyright (C) 1994-1998, Andrew Cagney <cagney@highland.com.au>
46ca2c52aSchristos 
56ca2c52aSchristos     This program is free software; you can redistribute it and/or modify
66ca2c52aSchristos     it under the terms of the GNU General Public License as published by
76ca2c52aSchristos     the Free Software Foundation; either version 3 of the License, or
86ca2c52aSchristos     (at your option) any later version.
96ca2c52aSchristos 
106ca2c52aSchristos     This program is distributed in the hope that it will be useful,
116ca2c52aSchristos     but WITHOUT ANY WARRANTY; without even the implied warranty of
126ca2c52aSchristos     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
136ca2c52aSchristos     GNU General Public License for more details.
146ca2c52aSchristos 
156ca2c52aSchristos     You should have received a copy of the GNU General Public License
166ca2c52aSchristos     along with this program; if not, see <http://www.gnu.org/licenses/>.
176ca2c52aSchristos 
186ca2c52aSchristos     */
196ca2c52aSchristos 
206ca2c52aSchristos 
216ca2c52aSchristos #ifndef _EMUL_NETBSD_C_
226ca2c52aSchristos #define _EMUL_NETBSD_C_
236ca2c52aSchristos 
246ca2c52aSchristos 
256ca2c52aSchristos /* Note: this module is called via a table.  There is no benefit in
266ca2c52aSchristos    making it inline */
276ca2c52aSchristos 
286ca2c52aSchristos #include "emul_generic.h"
296ca2c52aSchristos #include "emul_netbsd.h"
306ca2c52aSchristos 
316ca2c52aSchristos #ifdef HAVE_STRING_H
326ca2c52aSchristos #include <string.h>
336ca2c52aSchristos #else
346ca2c52aSchristos #ifdef HAVE_STRINGS_H
356ca2c52aSchristos #include <strings.h>
366ca2c52aSchristos #endif
376ca2c52aSchristos #endif
386ca2c52aSchristos 
396ca2c52aSchristos #include <sys/types.h>
406ca2c52aSchristos #include <sys/stat.h>
416ca2c52aSchristos #include <stdio.h>
426ca2c52aSchristos #include <signal.h>
436ca2c52aSchristos #include <fcntl.h>
44dc268d07Schristos #include <dirent.h>
456ca2c52aSchristos #include <errno.h>
466ca2c52aSchristos #include <sys/param.h>
476ca2c52aSchristos #include <sys/time.h>
486ca2c52aSchristos 
496ca2c52aSchristos #ifdef HAVE_GETRUSAGE
506ca2c52aSchristos #ifndef HAVE_SYS_RESOURCE_H
516ca2c52aSchristos #undef HAVE_GETRUSAGE
526ca2c52aSchristos #endif
536ca2c52aSchristos #endif
546ca2c52aSchristos 
556ca2c52aSchristos #ifdef HAVE_GETRUSAGE
566ca2c52aSchristos #include <sys/resource.h>
576ca2c52aSchristos int getrusage();
586ca2c52aSchristos #endif
596ca2c52aSchristos 
606ca2c52aSchristos #if HAVE_SYS_IOCTL_H
616ca2c52aSchristos #include <sys/ioctl.h>
626ca2c52aSchristos #endif
636ca2c52aSchristos 
646ca2c52aSchristos #if HAVE_DIRENT_H
656ca2c52aSchristos # include <dirent.h>
666ca2c52aSchristos # define NAMLEN(dirent) strlen((dirent)->d_name)
676ca2c52aSchristos #else
686ca2c52aSchristos # define dirent direct
696ca2c52aSchristos # define NAMLEN(dirent) (dirent)->d_namlen
706ca2c52aSchristos # if HAVE_SYS_NDIR_H
716ca2c52aSchristos #  include <sys/ndir.h>
726ca2c52aSchristos # endif
736ca2c52aSchristos # if HAVE_SYS_DIR_H
746ca2c52aSchristos #  include <sys/dir.h>
756ca2c52aSchristos # endif
766ca2c52aSchristos # if HAVE_NDIR_H
776ca2c52aSchristos #  include <ndir.h>
786ca2c52aSchristos # endif
796ca2c52aSchristos #endif
806ca2c52aSchristos 
816ca2c52aSchristos #ifdef HAVE_UNISTD_H
826ca2c52aSchristos #undef MAXPATHLEN		/* sys/param.h might define this also */
836ca2c52aSchristos #include <unistd.h>
846ca2c52aSchristos #endif
856ca2c52aSchristos 
866ca2c52aSchristos #ifdef HAVE_STDLIB_H
876ca2c52aSchristos #include <stdlib.h>
886ca2c52aSchristos #endif
896ca2c52aSchristos 
906ca2c52aSchristos #define WITH_NetBSD_HOST (NetBSD >= 199306)
916ca2c52aSchristos #if WITH_NetBSD_HOST /* here NetBSD as that is what we're emulating */
926ca2c52aSchristos #include <sys/syscall.h> /* FIXME - should not be including this one */
936ca2c52aSchristos #include <sys/sysctl.h>
946ca2c52aSchristos #include <sys/mount.h>
956ca2c52aSchristos extern int getdirentries(int fd, char *buf, int nbytes, long *basep);
966ca2c52aSchristos 
976ca2c52aSchristos /* NetBSD post 2.0 has the statfs system call (if COMPAT_20), but does
986ca2c52aSchristos    not have struct statfs.  In this case don't implement fstatfs.
996ca2c52aSchristos    FIXME: Should implement fstatvfs.  */
1006ca2c52aSchristos #ifndef HAVE_STRUCT_STATFS
1016ca2c52aSchristos #undef HAVE_FSTATFS
1026ca2c52aSchristos #endif
1036ca2c52aSchristos 
1046ca2c52aSchristos #else
1056ca2c52aSchristos 
1066ca2c52aSchristos /* If this is not netbsd, don't allow fstatfs or getdirentries at this time */
1076ca2c52aSchristos #undef HAVE_FSTATFS
1086ca2c52aSchristos #undef HAVE_GETDIRENTRIES
1096ca2c52aSchristos #endif
1106ca2c52aSchristos 
1116ca2c52aSchristos #if (BSD < 199306) /* here BSD as just a bug */
1126ca2c52aSchristos extern int errno;
1136ca2c52aSchristos #endif
1146ca2c52aSchristos 
1156ca2c52aSchristos #ifndef STATIC_INLINE_EMUL_NETBSD
1166ca2c52aSchristos #define STATIC_INLINE_EMUL_NETBSD STATIC_INLINE
1176ca2c52aSchristos #endif
1186ca2c52aSchristos 
1196ca2c52aSchristos 
1206ca2c52aSchristos #if WITH_NetBSD_HOST
1216ca2c52aSchristos #define SYS(X) ASSERT(call == (SYS_##X))
1226ca2c52aSchristos #else
1236ca2c52aSchristos #define SYS(X)
1246ca2c52aSchristos #endif
1256ca2c52aSchristos 
1266ca2c52aSchristos #if WITH_NetBSD_HOST && (PATH_MAX != 1024)
1276ca2c52aSchristos #error "PATH_MAX not 1024"
1286ca2c52aSchristos #elif !defined(PATH_MAX)
1296ca2c52aSchristos #define PATH_MAX 1024
1306ca2c52aSchristos #endif
1316ca2c52aSchristos 
1326ca2c52aSchristos 
1336ca2c52aSchristos /* EMULATION
1346ca2c52aSchristos 
1356ca2c52aSchristos    NetBSD - Emulation of user programs for NetBSD/PPC
1366ca2c52aSchristos 
1376ca2c52aSchristos    DESCRIPTION
1386ca2c52aSchristos 
1396ca2c52aSchristos    */
1406ca2c52aSchristos 
1416ca2c52aSchristos 
1426ca2c52aSchristos /* NetBSD's idea of what is needed to implement emulations */
1436ca2c52aSchristos 
1446ca2c52aSchristos struct _os_emul_data {
1456ca2c52aSchristos   device *vm;
1466ca2c52aSchristos   emul_syscall *syscalls;
1476ca2c52aSchristos };
1486ca2c52aSchristos 
1496ca2c52aSchristos 
1506ca2c52aSchristos 
1516ca2c52aSchristos STATIC_INLINE_EMUL_NETBSD void
write_stat(unsigned_word addr,struct stat buf,cpu * processor,unsigned_word cia)1526ca2c52aSchristos write_stat(unsigned_word addr,
1536ca2c52aSchristos 	   struct stat buf,
1546ca2c52aSchristos 	   cpu *processor,
1556ca2c52aSchristos 	   unsigned_word cia)
1566ca2c52aSchristos {
1576ca2c52aSchristos   H2T(buf.st_dev);
1586ca2c52aSchristos   H2T(buf.st_ino);
1596ca2c52aSchristos   H2T(buf.st_mode);
1606ca2c52aSchristos   H2T(buf.st_nlink);
1616ca2c52aSchristos   H2T(buf.st_uid);
1626ca2c52aSchristos   H2T(buf.st_gid);
1636ca2c52aSchristos   H2T(buf.st_size);
1646ca2c52aSchristos   H2T(buf.st_atime);
1656ca2c52aSchristos   /* H2T(buf.st_spare1); */
1666ca2c52aSchristos   H2T(buf.st_mtime);
1676ca2c52aSchristos   /* H2T(buf.st_spare2); */
1686ca2c52aSchristos   H2T(buf.st_ctime);
1696ca2c52aSchristos   /* H2T(buf.st_spare3); */
1706ca2c52aSchristos #ifdef AC_STRUCT_ST_RDEV
1716ca2c52aSchristos   H2T(buf.st_rdev);
1726ca2c52aSchristos #endif
1736ca2c52aSchristos #ifdef AC_STRUCT_ST_BLKSIZE
1746ca2c52aSchristos   H2T(buf.st_blksize);
1756ca2c52aSchristos #endif
1766ca2c52aSchristos #ifdef AC_STRUCT_ST_BLOCKS
1776ca2c52aSchristos   H2T(buf.st_blocks);
1786ca2c52aSchristos #endif
1796ca2c52aSchristos #if WITH_NetBSD_HOST
1806ca2c52aSchristos   H2T(buf.st_flags);
1816ca2c52aSchristos   H2T(buf.st_gen);
1826ca2c52aSchristos #endif
1836ca2c52aSchristos   emul_write_buffer(&buf, addr, sizeof(buf), processor, cia);
1846ca2c52aSchristos }
1856ca2c52aSchristos 
1866ca2c52aSchristos 
1876ca2c52aSchristos #ifdef HAVE_FSTATFS
1886ca2c52aSchristos STATIC_INLINE_EMUL_NETBSD void
write_statfs(unsigned_word addr,struct statfs buf,cpu * processor,unsigned_word cia)1896ca2c52aSchristos write_statfs(unsigned_word addr,
1906ca2c52aSchristos 	     struct statfs buf,
1916ca2c52aSchristos 	     cpu *processor,
1926ca2c52aSchristos 	     unsigned_word cia)
1936ca2c52aSchristos {
1946ca2c52aSchristos   H2T(buf.f_type);
1956ca2c52aSchristos   H2T(buf.f_flags);
1966ca2c52aSchristos   H2T(buf.f_bsize);
1976ca2c52aSchristos   H2T(buf.f_iosize);
1986ca2c52aSchristos   H2T(buf.f_blocks);
1996ca2c52aSchristos   H2T(buf.f_bfree);
2006ca2c52aSchristos   H2T(buf.f_bavail);
2016ca2c52aSchristos   H2T(buf.f_files);
2026ca2c52aSchristos   H2T(buf.f_ffree);
2036ca2c52aSchristos   H2T(buf.f_fsid.val[0]);
2046ca2c52aSchristos   H2T(buf.f_fsid.val[1]);
2056ca2c52aSchristos   H2T(buf.f_owner);
2066ca2c52aSchristos   /* f_spare[4]; */
2076ca2c52aSchristos   /* f_fstypename[MFSNAMELEN]; */
2086ca2c52aSchristos   /* f_mntonname[MNAMELEN]; */
2096ca2c52aSchristos   /* f_mntfromname[MNAMELEN]; */
2106ca2c52aSchristos   emul_write_buffer(&buf, addr, sizeof(buf), processor, cia);
2116ca2c52aSchristos }
2126ca2c52aSchristos #endif
2136ca2c52aSchristos 
2146ca2c52aSchristos 
2156ca2c52aSchristos STATIC_INLINE_EMUL_NETBSD void
write_timeval(unsigned_word addr,struct timeval t,cpu * processor,unsigned_word cia)2166ca2c52aSchristos write_timeval(unsigned_word addr,
2176ca2c52aSchristos 	      struct timeval t,
2186ca2c52aSchristos 	      cpu *processor,
2196ca2c52aSchristos 	      unsigned_word cia)
2206ca2c52aSchristos {
2216ca2c52aSchristos   H2T(t.tv_sec);
2226ca2c52aSchristos   H2T(t.tv_usec);
2236ca2c52aSchristos   emul_write_buffer(&t, addr, sizeof(t), processor, cia);
2246ca2c52aSchristos }
2256ca2c52aSchristos 
2266ca2c52aSchristos #ifdef HAVE_GETTIMEOFDAY
2276ca2c52aSchristos STATIC_INLINE_EMUL_NETBSD void
write_timezone(unsigned_word addr,struct timezone tz,cpu * processor,unsigned_word cia)2286ca2c52aSchristos write_timezone(unsigned_word addr,
2296ca2c52aSchristos 	       struct timezone tz,
2306ca2c52aSchristos 	       cpu *processor,
2316ca2c52aSchristos 	       unsigned_word cia)
2326ca2c52aSchristos {
2336ca2c52aSchristos   H2T(tz.tz_minuteswest);
2346ca2c52aSchristos   H2T(tz.tz_dsttime);
2356ca2c52aSchristos   emul_write_buffer(&tz, addr, sizeof(tz), processor, cia);
2366ca2c52aSchristos }
2376ca2c52aSchristos #endif
2386ca2c52aSchristos 
2396ca2c52aSchristos #ifdef HAVE_GETDIRENTRIES
2406ca2c52aSchristos STATIC_INLINE_EMUL_NETBSD void
write_direntries(unsigned_word addr,char * buf,int nbytes,cpu * processor,unsigned_word cia)2416ca2c52aSchristos write_direntries(unsigned_word addr,
2426ca2c52aSchristos 		 char *buf,
2436ca2c52aSchristos 		 int nbytes,
2446ca2c52aSchristos 		 cpu *processor,
2456ca2c52aSchristos 		 unsigned_word cia)
2466ca2c52aSchristos {
2476ca2c52aSchristos   while (nbytes > 0) {
2486ca2c52aSchristos     struct dirent *out;
2496ca2c52aSchristos     struct dirent *in = (struct dirent*)buf;
2506ca2c52aSchristos     ASSERT(in->d_reclen <= nbytes);
2516ca2c52aSchristos     out = (struct dirent*)zalloc(in->d_reclen);
2526ca2c52aSchristos     memcpy(out/*dest*/, in/*src*/, in->d_reclen);
2536ca2c52aSchristos     H2T(out->d_fileno);
2546ca2c52aSchristos     H2T(out->d_reclen);
2556ca2c52aSchristos     H2T(out->d_type);
2566ca2c52aSchristos     H2T(out->d_namlen);
2576ca2c52aSchristos     emul_write_buffer(out, addr, in->d_reclen, processor, cia);
2586ca2c52aSchristos     nbytes -= in->d_reclen;
2596ca2c52aSchristos     addr += in->d_reclen;
2606ca2c52aSchristos     buf += in->d_reclen;
2616ca2c52aSchristos     free(out);
2626ca2c52aSchristos   }
2636ca2c52aSchristos }
2646ca2c52aSchristos #endif
2656ca2c52aSchristos 
2666ca2c52aSchristos 
2676ca2c52aSchristos #ifdef HAVE_GETRUSAGE
2686ca2c52aSchristos STATIC_INLINE_EMUL_NETBSD void
write_rusage(unsigned_word addr,struct rusage rusage,cpu * processor,unsigned_word cia)2696ca2c52aSchristos write_rusage(unsigned_word addr,
2706ca2c52aSchristos 	     struct rusage rusage,
2716ca2c52aSchristos 	     cpu *processor,
2726ca2c52aSchristos 	     unsigned_word cia)
2736ca2c52aSchristos {
2746ca2c52aSchristos   H2T(rusage.ru_utime.tv_sec); /* user time used */
2756ca2c52aSchristos   H2T(rusage.ru_utime.tv_usec);
2766ca2c52aSchristos   H2T(rusage.ru_stime.tv_sec); /* system time used */
2776ca2c52aSchristos   H2T(rusage.ru_stime.tv_usec);
2786ca2c52aSchristos   H2T(rusage.ru_maxrss);          /* integral max resident set size */
2796ca2c52aSchristos   H2T(rusage.ru_ixrss);           /* integral shared text memory size */
2806ca2c52aSchristos   H2T(rusage.ru_idrss);           /* integral unshared data size */
2816ca2c52aSchristos   H2T(rusage.ru_isrss);           /* integral unshared stack size */
2826ca2c52aSchristos   H2T(rusage.ru_minflt);          /* page reclaims */
2836ca2c52aSchristos   H2T(rusage.ru_majflt);          /* page faults */
2846ca2c52aSchristos   H2T(rusage.ru_nswap);           /* swaps */
2856ca2c52aSchristos   H2T(rusage.ru_inblock);         /* block input operations */
2866ca2c52aSchristos   H2T(rusage.ru_oublock);         /* block output operations */
2876ca2c52aSchristos   H2T(rusage.ru_msgsnd);          /* messages sent */
2886ca2c52aSchristos   H2T(rusage.ru_msgrcv);          /* messages received */
2896ca2c52aSchristos   H2T(rusage.ru_nsignals);        /* signals received */
2906ca2c52aSchristos   H2T(rusage.ru_nvcsw);           /* voluntary context switches */
2916ca2c52aSchristos   H2T(rusage.ru_nivcsw);          /* involuntary context switches */
2926ca2c52aSchristos   emul_write_buffer(&rusage, addr, sizeof(rusage), processor, cia);
2936ca2c52aSchristos }
2946ca2c52aSchristos #endif
2956ca2c52aSchristos 
296b2396a7bSchristos 
297b2396a7bSchristos /* File descriptors 0, 1, and 2 should not be closed.  fd_closed[]
298b2396a7bSchristos    tracks whether these descriptors have been closed in do_close()
299b2396a7bSchristos    below.  */
300b2396a7bSchristos 
301b2396a7bSchristos static int fd_closed[3];
302b2396a7bSchristos 
303b2396a7bSchristos /* Check for some occurrences of bad file descriptors.  We only check
304b2396a7bSchristos    whether fd 0, 1, or 2 are "closed".  By "closed" we mean that these
305b2396a7bSchristos    descriptors aren't actually closed, but are considered to be closed
306b2396a7bSchristos    by this layer.
307b2396a7bSchristos 
308b2396a7bSchristos    Other checks are performed by the underlying OS call.  */
309b2396a7bSchristos 
310b2396a7bSchristos static int
fdbad(int fd)311b2396a7bSchristos fdbad (int fd)
312b2396a7bSchristos {
313b2396a7bSchristos   if (fd >=0 && fd <= 2 && fd_closed[fd])
314b2396a7bSchristos     {
315b2396a7bSchristos       errno = EBADF;
316b2396a7bSchristos       return -1;
317b2396a7bSchristos     }
318b2396a7bSchristos   return 0;
319b2396a7bSchristos }
320b2396a7bSchristos 
3216ca2c52aSchristos static void
do_exit(os_emul_data * emul,unsigned call,const int arg0,cpu * processor,unsigned_word cia)3226ca2c52aSchristos do_exit(os_emul_data *emul,
3236ca2c52aSchristos 	unsigned call,
3246ca2c52aSchristos 	const int arg0,
3256ca2c52aSchristos 	cpu *processor,
3266ca2c52aSchristos 	unsigned_word cia)
3276ca2c52aSchristos {
3286ca2c52aSchristos   int status = (int)cpu_registers(processor)->gpr[arg0];
3296ca2c52aSchristos   SYS(exit);
3306ca2c52aSchristos   if (WITH_TRACE && ppc_trace[trace_os_emul])
3316ca2c52aSchristos     printf_filtered ("%d)\n", status);
3326ca2c52aSchristos 
3336ca2c52aSchristos   cpu_halt(processor, cia, was_exited, status);
3346ca2c52aSchristos }
3356ca2c52aSchristos 
3366ca2c52aSchristos 
3376ca2c52aSchristos static void
do_read(os_emul_data * emul,unsigned call,const int arg0,cpu * processor,unsigned_word cia)3386ca2c52aSchristos do_read(os_emul_data *emul,
3396ca2c52aSchristos 	unsigned call,
3406ca2c52aSchristos 	const int arg0,
3416ca2c52aSchristos 	cpu *processor,
3426ca2c52aSchristos 	unsigned_word cia)
3436ca2c52aSchristos {
3446ca2c52aSchristos   void *scratch_buffer;
3456ca2c52aSchristos   int d = (int)cpu_registers(processor)->gpr[arg0];
3466ca2c52aSchristos   unsigned_word buf = cpu_registers(processor)->gpr[arg0+1];
3476ca2c52aSchristos   int nbytes = cpu_registers(processor)->gpr[arg0+2];
3486ca2c52aSchristos   int status;
3496ca2c52aSchristos   SYS(read);
3506ca2c52aSchristos 
3516ca2c52aSchristos   if (WITH_TRACE && ppc_trace[trace_os_emul])
3526ca2c52aSchristos     printf_filtered ("%d, 0x%lx, %d", d, (long)buf, nbytes);
3536ca2c52aSchristos 
3546ca2c52aSchristos   /* get a tempoary bufer */
3556ca2c52aSchristos   scratch_buffer = zalloc(nbytes);
3566ca2c52aSchristos 
3576ca2c52aSchristos   /* check if buffer exists by reading it */
3586ca2c52aSchristos   emul_read_buffer(scratch_buffer, buf, nbytes, processor, cia);
3596ca2c52aSchristos 
3606ca2c52aSchristos   /* read */
3616ca2c52aSchristos #if 0
3626ca2c52aSchristos   if (d == 0) {
3636ca2c52aSchristos     status = fread (scratch_buffer, 1, nbytes, stdin);
3646ca2c52aSchristos     if (status == 0 && ferror (stdin))
3656ca2c52aSchristos       status = -1;
3666ca2c52aSchristos   }
3676ca2c52aSchristos #endif
368b2396a7bSchristos   status = fdbad (d);
369b2396a7bSchristos   if (status == 0)
3706ca2c52aSchristos     status = read (d, scratch_buffer, nbytes);
3716ca2c52aSchristos 
3726ca2c52aSchristos   emul_write_status(processor, status, errno);
3736ca2c52aSchristos   if (status > 0)
3746ca2c52aSchristos     emul_write_buffer(scratch_buffer, buf, status, processor, cia);
3756ca2c52aSchristos 
3766ca2c52aSchristos   free(scratch_buffer);
3776ca2c52aSchristos }
3786ca2c52aSchristos 
3796ca2c52aSchristos 
3806ca2c52aSchristos static void
do_write(os_emul_data * emul,unsigned call,const int arg0,cpu * processor,unsigned_word cia)3816ca2c52aSchristos do_write(os_emul_data *emul,
3826ca2c52aSchristos 	 unsigned call,
3836ca2c52aSchristos 	 const int arg0,
3846ca2c52aSchristos 	 cpu *processor,
3856ca2c52aSchristos 	 unsigned_word cia)
3866ca2c52aSchristos {
3876ca2c52aSchristos   void *scratch_buffer = NULL;
3886ca2c52aSchristos   int d = (int)cpu_registers(processor)->gpr[arg0];
3896ca2c52aSchristos   unsigned_word buf = cpu_registers(processor)->gpr[arg0+1];
3906ca2c52aSchristos   int nbytes = cpu_registers(processor)->gpr[arg0+2];
3916ca2c52aSchristos   int status;
3926ca2c52aSchristos   SYS(write);
3936ca2c52aSchristos 
3946ca2c52aSchristos   if (WITH_TRACE && ppc_trace[trace_os_emul])
3956ca2c52aSchristos     printf_filtered ("%d, 0x%lx, %d", d, (long)buf, nbytes);
3966ca2c52aSchristos 
3976ca2c52aSchristos   /* get a tempoary bufer */
3986ca2c52aSchristos   scratch_buffer = zalloc(nbytes); /* FIXME - nbytes == 0 */
3996ca2c52aSchristos 
4006ca2c52aSchristos   /* copy in */
4016ca2c52aSchristos   emul_read_buffer(scratch_buffer, buf, nbytes,
4026ca2c52aSchristos 		   processor, cia);
4036ca2c52aSchristos 
4046ca2c52aSchristos   /* write */
405b2396a7bSchristos   status = fdbad (d);
406b2396a7bSchristos   if (status == 0)
4076ca2c52aSchristos     status = write(d, scratch_buffer, nbytes);
408b2396a7bSchristos 
4096ca2c52aSchristos   emul_write_status(processor, status, errno);
4106ca2c52aSchristos   free(scratch_buffer);
4116ca2c52aSchristos 
4126ca2c52aSchristos   flush_stdoutput();
4136ca2c52aSchristos }
4146ca2c52aSchristos 
4156ca2c52aSchristos 
4166ca2c52aSchristos static void
do_open(os_emul_data * emul,unsigned call,const int arg0,cpu * processor,unsigned_word cia)4176ca2c52aSchristos do_open(os_emul_data *emul,
4186ca2c52aSchristos 	unsigned call,
4196ca2c52aSchristos 	const int arg0,
4206ca2c52aSchristos 	cpu *processor,
4216ca2c52aSchristos 	unsigned_word cia)
4226ca2c52aSchristos {
4236ca2c52aSchristos   unsigned_word path_addr = cpu_registers(processor)->gpr[arg0];
4246ca2c52aSchristos   char path_buf[PATH_MAX];
4256ca2c52aSchristos   char *path = emul_read_string(path_buf, path_addr, PATH_MAX, processor, cia);
4266ca2c52aSchristos   int flags = (int)cpu_registers(processor)->gpr[arg0+1];
4276ca2c52aSchristos   int mode = (int)cpu_registers(processor)->gpr[arg0+2];
4286ca2c52aSchristos   int hostflags;
4296ca2c52aSchristos   int status;
4306ca2c52aSchristos 
4316ca2c52aSchristos   if (WITH_TRACE && ppc_trace[trace_os_emul])
4326ca2c52aSchristos     printf_filtered ("0x%lx [%s], 0x%x, 0x%x", (long)path_addr, path, flags, mode);
4336ca2c52aSchristos 
4346ca2c52aSchristos   SYS(open);
4356ca2c52aSchristos 
4366ca2c52aSchristos   /* Do some translation on 'flags' to match it to the host's version.  */
4376ca2c52aSchristos   /* These flag values were taken from the NetBSD 1.4 header files.  */
4386ca2c52aSchristos   if ((flags & 3) == 0)
4396ca2c52aSchristos     hostflags = O_RDONLY;
4406ca2c52aSchristos   else if ((flags & 3) == 1)
4416ca2c52aSchristos     hostflags = O_WRONLY;
4426ca2c52aSchristos   else
4436ca2c52aSchristos     hostflags = O_RDWR;
4446ca2c52aSchristos   if (flags & 0x00000008)
4456ca2c52aSchristos     hostflags |= O_APPEND;
4466ca2c52aSchristos   if (flags & 0x00000200)
4476ca2c52aSchristos     hostflags |= O_CREAT;
4486ca2c52aSchristos   if (flags & 0x00000400)
4496ca2c52aSchristos     hostflags |= O_TRUNC;
4506ca2c52aSchristos   if (flags & 0x00000800)
4516ca2c52aSchristos     hostflags |= O_EXCL;
4526ca2c52aSchristos 
4536ca2c52aSchristos   /* Can't combine these statements, cuz open sets errno. */
4546ca2c52aSchristos   status = open(path, hostflags, mode);
4556ca2c52aSchristos   emul_write_status(processor, status, errno);
4566ca2c52aSchristos }
4576ca2c52aSchristos 
4586ca2c52aSchristos 
4596ca2c52aSchristos static void
do_close(os_emul_data * emul,unsigned call,const int arg0,cpu * processor,unsigned_word cia)4606ca2c52aSchristos do_close(os_emul_data *emul,
4616ca2c52aSchristos 	 unsigned call,
4626ca2c52aSchristos 	 const int arg0,
4636ca2c52aSchristos 	 cpu *processor,
4646ca2c52aSchristos 	 unsigned_word cia)
4656ca2c52aSchristos {
4666ca2c52aSchristos   int d = (int)cpu_registers(processor)->gpr[arg0];
4676ca2c52aSchristos   int status;
4686ca2c52aSchristos 
4696ca2c52aSchristos   if (WITH_TRACE && ppc_trace[trace_os_emul])
4706ca2c52aSchristos     printf_filtered ("%d", d);
4716ca2c52aSchristos 
4726ca2c52aSchristos   SYS(close);
4736ca2c52aSchristos 
474b2396a7bSchristos   status = fdbad (d);
475b2396a7bSchristos   if (status == 0)
476b2396a7bSchristos     {
477b2396a7bSchristos       /* Do not close stdin, stdout, or stderr. GDB may still need access to
478b2396a7bSchristos 	 these descriptors.  */
479b2396a7bSchristos       if (d == 0 || d == 1 || d == 2)
480b2396a7bSchristos 	{
481b2396a7bSchristos 	  fd_closed[d] = 1;
482b2396a7bSchristos 	  status = 0;
483b2396a7bSchristos 	}
484b2396a7bSchristos       else
4856ca2c52aSchristos 	status = close(d);
486b2396a7bSchristos     }
487b2396a7bSchristos 
4886ca2c52aSchristos   emul_write_status(processor, status, errno);
4896ca2c52aSchristos }
4906ca2c52aSchristos 
4916ca2c52aSchristos 
4926ca2c52aSchristos static void
do_break(os_emul_data * emul,unsigned call,const int arg0,cpu * processor,unsigned_word cia)4936ca2c52aSchristos do_break(os_emul_data *emul,
4946ca2c52aSchristos 	 unsigned call,
4956ca2c52aSchristos 	 const int arg0,
4966ca2c52aSchristos 	 cpu *processor,
4976ca2c52aSchristos 	 unsigned_word cia)
4986ca2c52aSchristos {
4996ca2c52aSchristos   /* just pass this onto the `vm' device */
5006ca2c52aSchristos   unsigned_word new_break = cpu_registers(processor)->gpr[arg0];
5016ca2c52aSchristos   int status;
5026ca2c52aSchristos 
5036ca2c52aSchristos   if (WITH_TRACE && ppc_trace[trace_os_emul])
5046ca2c52aSchristos     printf_filtered ("0x%lx", (long)cpu_registers(processor)->gpr[arg0]);
5056ca2c52aSchristos 
5066ca2c52aSchristos   SYS(break);
5076ca2c52aSchristos   status = device_ioctl(emul->vm,
5086ca2c52aSchristos 			processor,
5096ca2c52aSchristos 			cia,
5106ca2c52aSchristos 			device_ioctl_break,
5116ca2c52aSchristos 			new_break); /*ioctl-data*/
5126ca2c52aSchristos   emul_write_status(processor, 0, status);
5136ca2c52aSchristos }
5146ca2c52aSchristos 
5156ca2c52aSchristos 
5166ca2c52aSchristos #ifndef HAVE_GETPID
5176ca2c52aSchristos #define do_getpid 0
5186ca2c52aSchristos #else
5196ca2c52aSchristos static void
do_getpid(os_emul_data * emul,unsigned call,const int arg0,cpu * processor,unsigned_word cia)5206ca2c52aSchristos do_getpid(os_emul_data *emul,
5216ca2c52aSchristos 	  unsigned call,
5226ca2c52aSchristos 	  const int arg0,
5236ca2c52aSchristos 	  cpu *processor,
5246ca2c52aSchristos 	  unsigned_word cia)
5256ca2c52aSchristos {
5266ca2c52aSchristos   SYS(getpid);
5276ca2c52aSchristos   emul_write_status(processor, (int)getpid(), 0);
5286ca2c52aSchristos }
5296ca2c52aSchristos #endif
5306ca2c52aSchristos 
5316ca2c52aSchristos #ifndef HAVE_GETUID
5326ca2c52aSchristos #define do_getuid 0
5336ca2c52aSchristos #else
5346ca2c52aSchristos static void
do_getuid(os_emul_data * emul,unsigned call,const int arg0,cpu * processor,unsigned_word cia)5356ca2c52aSchristos do_getuid(os_emul_data *emul,
5366ca2c52aSchristos 	  unsigned call,
5376ca2c52aSchristos 	  const int arg0,
5386ca2c52aSchristos 	  cpu *processor,
5396ca2c52aSchristos 	  unsigned_word cia)
5406ca2c52aSchristos {
5416ca2c52aSchristos   SYS(getuid);
5426ca2c52aSchristos   emul_write_status(processor, (int)getuid(), 0);
5436ca2c52aSchristos }
5446ca2c52aSchristos #endif
5456ca2c52aSchristos 
5466ca2c52aSchristos #ifndef HAVE_GETEUID
5476ca2c52aSchristos #define do_geteuid 0
5486ca2c52aSchristos #else
5496ca2c52aSchristos static void
do_geteuid(os_emul_data * emul,unsigned call,const int arg0,cpu * processor,unsigned_word cia)5506ca2c52aSchristos do_geteuid(os_emul_data *emul,
5516ca2c52aSchristos 	   unsigned call,
5526ca2c52aSchristos 	   const int arg0,
5536ca2c52aSchristos 	   cpu *processor,
5546ca2c52aSchristos 	   unsigned_word cia)
5556ca2c52aSchristos {
5566ca2c52aSchristos   SYS(geteuid);
5576ca2c52aSchristos   emul_write_status(processor, (int)geteuid(), 0);
5586ca2c52aSchristos }
5596ca2c52aSchristos #endif
5606ca2c52aSchristos 
5616ca2c52aSchristos #ifndef HAVE_KILL
5626ca2c52aSchristos #define do_kill 0
5636ca2c52aSchristos #else
5646ca2c52aSchristos static void
do_kill(os_emul_data * emul,unsigned call,const int arg0,cpu * processor,unsigned_word cia)5656ca2c52aSchristos do_kill(os_emul_data *emul,
5666ca2c52aSchristos 	unsigned call,
5676ca2c52aSchristos 	const int arg0,
5686ca2c52aSchristos 	cpu *processor,
5696ca2c52aSchristos 	unsigned_word cia)
5706ca2c52aSchristos {
5716ca2c52aSchristos   pid_t pid = cpu_registers(processor)->gpr[arg0];
5726ca2c52aSchristos   int sig = cpu_registers(processor)->gpr[arg0+1];
5736ca2c52aSchristos 
5746ca2c52aSchristos   if (WITH_TRACE && ppc_trace[trace_os_emul])
5756ca2c52aSchristos     printf_filtered ("%d, %d", (int)pid, sig);
5766ca2c52aSchristos 
5776ca2c52aSchristos   SYS(kill);
5786ca2c52aSchristos   printf_filtered("SYS_kill at 0x%lx - more to this than just being killed\n",
5796ca2c52aSchristos 		  (long)cia);
5806ca2c52aSchristos   cpu_halt(processor, cia, was_signalled, sig);
5816ca2c52aSchristos }
5826ca2c52aSchristos #endif
5836ca2c52aSchristos 
5846ca2c52aSchristos #ifndef HAVE_DUP
5856ca2c52aSchristos #define do_dup 0
5866ca2c52aSchristos #else
5876ca2c52aSchristos static void
do_dup(os_emul_data * emul,unsigned call,const int arg0,cpu * processor,unsigned_word cia)5886ca2c52aSchristos do_dup(os_emul_data *emul,
5896ca2c52aSchristos        unsigned call,
5906ca2c52aSchristos        const int arg0,
5916ca2c52aSchristos        cpu *processor,
5926ca2c52aSchristos        unsigned_word cia)
5936ca2c52aSchristos {
5946ca2c52aSchristos   int oldd = cpu_registers(processor)->gpr[arg0];
595b2396a7bSchristos   int status = (fdbad (oldd) < 0) ? -1 : dup(oldd);
5966ca2c52aSchristos   int err = errno;
5976ca2c52aSchristos 
5986ca2c52aSchristos   if (WITH_TRACE && ppc_trace[trace_os_emul])
5996ca2c52aSchristos     printf_filtered ("%d", oldd);
6006ca2c52aSchristos 
6016ca2c52aSchristos   SYS(dup);
6026ca2c52aSchristos   emul_write_status(processor, status, err);
6036ca2c52aSchristos }
6046ca2c52aSchristos #endif
6056ca2c52aSchristos 
6066ca2c52aSchristos #ifndef HAVE_GETEGID
6076ca2c52aSchristos #define do_getegid 0
6086ca2c52aSchristos #else
6096ca2c52aSchristos static void
do_getegid(os_emul_data * emul,unsigned call,const int arg0,cpu * processor,unsigned_word cia)6106ca2c52aSchristos do_getegid(os_emul_data *emul,
6116ca2c52aSchristos 	   unsigned call,
6126ca2c52aSchristos 	   const int arg0,
6136ca2c52aSchristos 	   cpu *processor,
6146ca2c52aSchristos 	   unsigned_word cia)
6156ca2c52aSchristos {
6166ca2c52aSchristos   SYS(getegid);
6176ca2c52aSchristos   emul_write_status(processor, (int)getegid(), 0);
6186ca2c52aSchristos }
6196ca2c52aSchristos #endif
6206ca2c52aSchristos 
6216ca2c52aSchristos #ifndef HAVE_GETGID
6226ca2c52aSchristos #define do_getgid 0
6236ca2c52aSchristos #else
6246ca2c52aSchristos static void
do_getgid(os_emul_data * emul,unsigned call,const int arg0,cpu * processor,unsigned_word cia)6256ca2c52aSchristos do_getgid(os_emul_data *emul,
6266ca2c52aSchristos 	  unsigned call,
6276ca2c52aSchristos 	  const int arg0,
6286ca2c52aSchristos 	  cpu *processor,
6296ca2c52aSchristos 	  unsigned_word cia)
6306ca2c52aSchristos {
6316ca2c52aSchristos   SYS(getgid);
6326ca2c52aSchristos   emul_write_status(processor, (int)getgid(), 0);
6336ca2c52aSchristos }
6346ca2c52aSchristos #endif
6356ca2c52aSchristos 
6366ca2c52aSchristos #ifndef HAVE_SIGPROCMASK
6376ca2c52aSchristos #define do_sigprocmask 0
6386ca2c52aSchristos #else
6396ca2c52aSchristos static void
do_sigprocmask(os_emul_data * emul,unsigned call,const int arg0,cpu * processor,unsigned_word cia)6406ca2c52aSchristos do_sigprocmask(os_emul_data *emul,
6416ca2c52aSchristos 	       unsigned call,
6426ca2c52aSchristos 	       const int arg0,
6436ca2c52aSchristos 	       cpu *processor,
6446ca2c52aSchristos 	       unsigned_word cia)
6456ca2c52aSchristos {
6466ca2c52aSchristos   natural_word how = cpu_registers(processor)->gpr[arg0];
6476ca2c52aSchristos   unsigned_word set = cpu_registers(processor)->gpr[arg0+1];
6486ca2c52aSchristos   unsigned_word oset = cpu_registers(processor)->gpr[arg0+2];
6496ca2c52aSchristos #ifdef SYS_sigprocmask
6506ca2c52aSchristos   SYS(sigprocmask);
6516ca2c52aSchristos #endif
6526ca2c52aSchristos 
6536ca2c52aSchristos   if (WITH_TRACE && ppc_trace[trace_os_emul])
6546ca2c52aSchristos     printf_filtered ("%ld, 0x%ld, 0x%ld", (long)how, (long)set, (long)oset);
6556ca2c52aSchristos 
6566ca2c52aSchristos   emul_write_status(processor, 0, 0);
6576ca2c52aSchristos   cpu_registers(processor)->gpr[4] = set;
6586ca2c52aSchristos }
6596ca2c52aSchristos #endif
6606ca2c52aSchristos 
6616ca2c52aSchristos #ifndef HAVE_IOCTL
6626ca2c52aSchristos #define do_ioctl 0
6636ca2c52aSchristos #else
6646ca2c52aSchristos static void
do_ioctl(os_emul_data * emul,unsigned call,const int arg0,cpu * processor,unsigned_word cia)6656ca2c52aSchristos do_ioctl(os_emul_data *emul,
6666ca2c52aSchristos 	 unsigned call,
6676ca2c52aSchristos 	 const int arg0,
6686ca2c52aSchristos 	 cpu *processor,
6696ca2c52aSchristos 	 unsigned_word cia)
6706ca2c52aSchristos {
6716ca2c52aSchristos   int d = cpu_registers(processor)->gpr[arg0];
6726ca2c52aSchristos   unsigned request = cpu_registers(processor)->gpr[arg0+1];
6736ca2c52aSchristos   unsigned_word argp_addr = cpu_registers(processor)->gpr[arg0+2];
6746ca2c52aSchristos 
6756ca2c52aSchristos #if !WITH_NetBSD_HOST
6766ca2c52aSchristos   cpu_registers(processor)->gpr[arg0] = 0; /* just succeed */
6776ca2c52aSchristos #else
6786ca2c52aSchristos   unsigned dir = request & IOC_DIRMASK;
6796ca2c52aSchristos   int status;
6806ca2c52aSchristos   SYS(ioctl);
6816ca2c52aSchristos   /* what we haven't done */
6826ca2c52aSchristos   if (dir & IOC_IN /* write into the io device */
6836ca2c52aSchristos       || dir & IOC_OUT
6846ca2c52aSchristos       || !(dir & IOC_VOID))
6856ca2c52aSchristos     error("do_ioctl() read or write of parameter not implemented\n");
686b2396a7bSchristos   status = fdbad (d);
687b2396a7bSchristos   if (status == 0)
6886ca2c52aSchristos     status = ioctl(d, request, NULL);
6896ca2c52aSchristos   emul_write_status(processor, status, errno);
6906ca2c52aSchristos #endif
6916ca2c52aSchristos 
6926ca2c52aSchristos   if (WITH_TRACE && ppc_trace[trace_os_emul])
6936ca2c52aSchristos     printf_filtered ("%d, 0x%x, 0x%lx", d, request, (long)argp_addr);
6946ca2c52aSchristos }
6956ca2c52aSchristos #endif
6966ca2c52aSchristos 
6976ca2c52aSchristos #ifndef HAVE_UMASK
6986ca2c52aSchristos #define do_umask 0
6996ca2c52aSchristos #else
7006ca2c52aSchristos static void
do_umask(os_emul_data * emul,unsigned call,const int arg0,cpu * processor,unsigned_word cia)7016ca2c52aSchristos do_umask(os_emul_data *emul,
7026ca2c52aSchristos 	 unsigned call,
7036ca2c52aSchristos 	 const int arg0,
7046ca2c52aSchristos 	 cpu *processor,
7056ca2c52aSchristos 	 unsigned_word cia)
7066ca2c52aSchristos {
7076ca2c52aSchristos   int mask = cpu_registers(processor)->gpr[arg0];
7086ca2c52aSchristos 
7096ca2c52aSchristos   if (WITH_TRACE && ppc_trace[trace_os_emul])
7106ca2c52aSchristos     printf_filtered ("0%o", mask);
7116ca2c52aSchristos 
7126ca2c52aSchristos   SYS(umask);
7136ca2c52aSchristos   emul_write_status(processor, umask(mask), 0);
7146ca2c52aSchristos }
7156ca2c52aSchristos #endif
7166ca2c52aSchristos 
7176ca2c52aSchristos #ifndef HAVE_DUP2
7186ca2c52aSchristos #define do_dup2 0
7196ca2c52aSchristos #else
7206ca2c52aSchristos static void
do_dup2(os_emul_data * emul,unsigned call,const int arg0,cpu * processor,unsigned_word cia)7216ca2c52aSchristos do_dup2(os_emul_data *emul,
7226ca2c52aSchristos 	unsigned call,
7236ca2c52aSchristos 	const int arg0,
7246ca2c52aSchristos 	cpu *processor,
7256ca2c52aSchristos 	unsigned_word cia)
7266ca2c52aSchristos {
7276ca2c52aSchristos   int oldd = cpu_registers(processor)->gpr[arg0];
7286ca2c52aSchristos   int newd = cpu_registers(processor)->gpr[arg0+1];
729b2396a7bSchristos   int status = (fdbad (oldd) < 0) ? -1 : dup2(oldd, newd);
7306ca2c52aSchristos   int err = errno;
7316ca2c52aSchristos 
7326ca2c52aSchristos   if (WITH_TRACE && ppc_trace[trace_os_emul])
7336ca2c52aSchristos     printf_filtered ("%d, %d", oldd, newd);
7346ca2c52aSchristos 
7356ca2c52aSchristos   SYS(dup2);
7366ca2c52aSchristos   emul_write_status(processor, status, err);
7376ca2c52aSchristos }
7386ca2c52aSchristos #endif
7396ca2c52aSchristos 
7406ca2c52aSchristos #ifndef HAVE_FCNTL
7416ca2c52aSchristos #define do_fcntl 0
7426ca2c52aSchristos #else
7436ca2c52aSchristos static void
do_fcntl(os_emul_data * emul,unsigned call,const int arg0,cpu * processor,unsigned_word cia)7446ca2c52aSchristos do_fcntl(os_emul_data *emul,
7456ca2c52aSchristos 	 unsigned call,
7466ca2c52aSchristos 	 const int arg0,
7476ca2c52aSchristos 	 cpu *processor,
7486ca2c52aSchristos 	 unsigned_word cia)
7496ca2c52aSchristos {
7506ca2c52aSchristos   int fd = cpu_registers(processor)->gpr[arg0];
7516ca2c52aSchristos   int cmd = cpu_registers(processor)->gpr[arg0+1];
7526ca2c52aSchristos   int arg = cpu_registers(processor)->gpr[arg0+2];
7536ca2c52aSchristos   int status;
7546ca2c52aSchristos 
7556ca2c52aSchristos   if (WITH_TRACE && ppc_trace[trace_os_emul])
7566ca2c52aSchristos     printf_filtered ("%d, %d, %d", fd, cmd, arg);
7576ca2c52aSchristos 
7586ca2c52aSchristos   SYS(fcntl);
759b2396a7bSchristos   status = fdbad (fd);
760b2396a7bSchristos   if (status == 0)
7616ca2c52aSchristos     status = fcntl(fd, cmd, arg);
7626ca2c52aSchristos   emul_write_status(processor, status, errno);
7636ca2c52aSchristos }
7646ca2c52aSchristos #endif
7656ca2c52aSchristos 
7666ca2c52aSchristos #ifndef HAVE_GETTIMEOFDAY
7676ca2c52aSchristos #define do_gettimeofday 0
7686ca2c52aSchristos #else
7696ca2c52aSchristos static void
do_gettimeofday(os_emul_data * emul,unsigned call,const int arg0,cpu * processor,unsigned_word cia)7706ca2c52aSchristos do_gettimeofday(os_emul_data *emul,
7716ca2c52aSchristos 		unsigned call,
7726ca2c52aSchristos 		const int arg0,
7736ca2c52aSchristos 		cpu *processor,
7746ca2c52aSchristos 		unsigned_word cia)
7756ca2c52aSchristos {
7766ca2c52aSchristos   unsigned_word t_addr = cpu_registers(processor)->gpr[arg0];
7776ca2c52aSchristos   unsigned_word tz_addr = cpu_registers(processor)->gpr[arg0+1];
7786ca2c52aSchristos   struct timeval t;
7796ca2c52aSchristos   struct timezone tz;
7806ca2c52aSchristos   int status = gettimeofday((t_addr != 0 ? &t : NULL),
7816ca2c52aSchristos 			    (tz_addr != 0 ? &tz : NULL));
7826ca2c52aSchristos   int err = errno;
7836ca2c52aSchristos 
7846ca2c52aSchristos   if (WITH_TRACE && ppc_trace[trace_os_emul])
7856ca2c52aSchristos     printf_filtered ("0x%lx, 0x%lx", (long)t_addr, (long)tz_addr);
7866ca2c52aSchristos 
7876ca2c52aSchristos   SYS(__gettimeofday50);
7886ca2c52aSchristos   emul_write_status(processor, status, err);
7896ca2c52aSchristos   if (status == 0) {
7906ca2c52aSchristos     if (t_addr != 0)
7916ca2c52aSchristos       write_timeval(t_addr, t, processor, cia);
7926ca2c52aSchristos     if (tz_addr != 0)
7936ca2c52aSchristos       write_timezone(tz_addr, tz, processor, cia);
7946ca2c52aSchristos   }
7956ca2c52aSchristos }
7966ca2c52aSchristos #endif
7976ca2c52aSchristos 
7986ca2c52aSchristos #ifndef HAVE_GETRUSAGE
7996ca2c52aSchristos #define do_getrusage 0
8006ca2c52aSchristos #else
8016ca2c52aSchristos static void
do_getrusage(os_emul_data * emul,unsigned call,const int arg0,cpu * processor,unsigned_word cia)8026ca2c52aSchristos do_getrusage(os_emul_data *emul,
8036ca2c52aSchristos 	     unsigned call,
8046ca2c52aSchristos 	     const int arg0,
8056ca2c52aSchristos 	     cpu *processor,
8066ca2c52aSchristos 	     unsigned_word cia)
8076ca2c52aSchristos {
8086ca2c52aSchristos   int who = cpu_registers(processor)->gpr[arg0];
8096ca2c52aSchristos   unsigned_word rusage_addr = cpu_registers(processor)->gpr[arg0+1];
8106ca2c52aSchristos   struct rusage rusage;
8116ca2c52aSchristos   int status = getrusage(who, (rusage_addr != 0 ? &rusage : NULL));
8126ca2c52aSchristos   int err = errno;
8136ca2c52aSchristos 
8146ca2c52aSchristos   if (WITH_TRACE && ppc_trace[trace_os_emul])
8156ca2c52aSchristos     printf_filtered ("%d, 0x%lx", who, (long)rusage_addr);
8166ca2c52aSchristos 
8176ca2c52aSchristos   SYS(__getrusage50);
8186ca2c52aSchristos   emul_write_status(processor, status, err);
8196ca2c52aSchristos   if (status == 0) {
8206ca2c52aSchristos     if (rusage_addr != 0)
8216ca2c52aSchristos       write_rusage(rusage_addr, rusage, processor, cia);
8226ca2c52aSchristos   }
8236ca2c52aSchristos }
8246ca2c52aSchristos #endif
8256ca2c52aSchristos 
8266ca2c52aSchristos 
8276ca2c52aSchristos #ifndef HAVE_FSTATFS
8286ca2c52aSchristos #define do_fstatfs 0
8296ca2c52aSchristos #else
8306ca2c52aSchristos static void
do_fstatfs(os_emul_data * emul,unsigned call,const int arg0,cpu * processor,unsigned_word cia)8316ca2c52aSchristos do_fstatfs(os_emul_data *emul,
8326ca2c52aSchristos 	   unsigned call,
8336ca2c52aSchristos 	   const int arg0,
8346ca2c52aSchristos 	   cpu *processor,
8356ca2c52aSchristos 	   unsigned_word cia)
8366ca2c52aSchristos {
8376ca2c52aSchristos   int fd = cpu_registers(processor)->gpr[arg0];
8386ca2c52aSchristos   unsigned_word buf_addr = cpu_registers(processor)->gpr[arg0+1];
8396ca2c52aSchristos   struct statfs buf;
8406ca2c52aSchristos   int status;
8416ca2c52aSchristos 
8426ca2c52aSchristos   if (WITH_TRACE && ppc_trace[trace_os_emul])
8436ca2c52aSchristos     printf_filtered ("%d, 0x%lx", fd, (long)buf_addr);
8446ca2c52aSchristos 
8456ca2c52aSchristos   SYS(fstatfs);
846b2396a7bSchristos   status = fdbad (fd);
847b2396a7bSchristos   if (status == 0)
8486ca2c52aSchristos     status = fstatfs(fd, (buf_addr == 0 ? NULL : &buf));
8496ca2c52aSchristos   emul_write_status(processor, status, errno);
8506ca2c52aSchristos   if (status == 0) {
8516ca2c52aSchristos     if (buf_addr != 0)
8526ca2c52aSchristos       write_statfs(buf_addr, buf, processor, cia);
8536ca2c52aSchristos   }
8546ca2c52aSchristos }
8556ca2c52aSchristos #endif
8566ca2c52aSchristos 
8576ca2c52aSchristos #ifndef HAVE_STAT
8586ca2c52aSchristos #define do_stat 0
8596ca2c52aSchristos #else
8606ca2c52aSchristos static void
do_stat(os_emul_data * emul,unsigned call,const int arg0,cpu * processor,unsigned_word cia)8616ca2c52aSchristos do_stat(os_emul_data *emul,
8626ca2c52aSchristos 	unsigned call,
8636ca2c52aSchristos 	const int arg0,
8646ca2c52aSchristos 	cpu *processor,
8656ca2c52aSchristos 	unsigned_word cia)
8666ca2c52aSchristos {
8676ca2c52aSchristos   char path_buf[PATH_MAX];
8686ca2c52aSchristos   unsigned_word path_addr = cpu_registers(processor)->gpr[arg0];
8696ca2c52aSchristos   unsigned_word stat_buf_addr = cpu_registers(processor)->gpr[arg0+1];
8706ca2c52aSchristos   char *path = emul_read_string(path_buf, path_addr, PATH_MAX, processor, cia);
8716ca2c52aSchristos   struct stat buf;
8726ca2c52aSchristos   int status;
8736ca2c52aSchristos #ifdef SYS_stat
8746ca2c52aSchristos   SYS(stat);
8756ca2c52aSchristos #endif
8766ca2c52aSchristos   status = stat(path, &buf);
8776ca2c52aSchristos   emul_write_status(processor, status, errno);
8786ca2c52aSchristos   if (status == 0)
8796ca2c52aSchristos     write_stat(stat_buf_addr, buf, processor, cia);
8806ca2c52aSchristos }
8816ca2c52aSchristos #endif
8826ca2c52aSchristos 
8836ca2c52aSchristos #ifndef HAVE_FSTAT
8846ca2c52aSchristos #define do_fstat 0
8856ca2c52aSchristos #else
8866ca2c52aSchristos static void
do_fstat(os_emul_data * emul,unsigned call,const int arg0,cpu * processor,unsigned_word cia)8876ca2c52aSchristos do_fstat(os_emul_data *emul,
8886ca2c52aSchristos 	 unsigned call,
8896ca2c52aSchristos 	 const int arg0,
8906ca2c52aSchristos 	 cpu *processor,
8916ca2c52aSchristos 	 unsigned_word cia)
8926ca2c52aSchristos {
8936ca2c52aSchristos   int fd = cpu_registers(processor)->gpr[arg0];
8946ca2c52aSchristos   unsigned_word stat_buf_addr = cpu_registers(processor)->gpr[arg0+1];
8956ca2c52aSchristos   struct stat buf;
8966ca2c52aSchristos   int status;
8976ca2c52aSchristos #ifdef SYS_fstat
8986ca2c52aSchristos   SYS(fstat);
8996ca2c52aSchristos #endif
9006ca2c52aSchristos   /* Can't combine these statements, cuz fstat sets errno. */
901b2396a7bSchristos   status = fdbad (fd);
902b2396a7bSchristos   if (status == 0)
9036ca2c52aSchristos     status = fstat(fd, &buf);
9046ca2c52aSchristos   emul_write_status(processor, status, errno);
9056ca2c52aSchristos   write_stat(stat_buf_addr, buf, processor, cia);
9066ca2c52aSchristos }
9076ca2c52aSchristos #endif
9086ca2c52aSchristos 
9096ca2c52aSchristos #ifndef HAVE_LSTAT
9106ca2c52aSchristos #define do_lstat 0
9116ca2c52aSchristos #else
9126ca2c52aSchristos static void
do_lstat(os_emul_data * emul,unsigned call,const int arg0,cpu * processor,unsigned_word cia)9136ca2c52aSchristos do_lstat(os_emul_data *emul,
9146ca2c52aSchristos 	 unsigned call,
9156ca2c52aSchristos 	 const int arg0,
9166ca2c52aSchristos 	 cpu *processor,
9176ca2c52aSchristos 	 unsigned_word cia)
9186ca2c52aSchristos {
9196ca2c52aSchristos   char path_buf[PATH_MAX];
9206ca2c52aSchristos   unsigned_word path_addr = cpu_registers(processor)->gpr[arg0];
9216ca2c52aSchristos   char *path = emul_read_string(path_buf, path_addr, PATH_MAX, processor, cia);
9226ca2c52aSchristos   unsigned_word stat_buf_addr = cpu_registers(processor)->gpr[arg0+1];
9236ca2c52aSchristos   struct stat buf;
9246ca2c52aSchristos   int status;
9256ca2c52aSchristos #ifdef SYS_lstat
9266ca2c52aSchristos   SYS(lstat);
9276ca2c52aSchristos #endif
9286ca2c52aSchristos   /* Can't combine these statements, cuz lstat sets errno. */
9296ca2c52aSchristos   status = lstat(path, &buf);
9306ca2c52aSchristos   emul_write_status(processor, status, errno);
9316ca2c52aSchristos   write_stat(stat_buf_addr, buf, processor, cia);
9326ca2c52aSchristos }
9336ca2c52aSchristos #endif
9346ca2c52aSchristos 
9356ca2c52aSchristos #ifndef HAVE_GETDIRENTRIES
9366ca2c52aSchristos #define do_getdirentries 0
9376ca2c52aSchristos #else
9386ca2c52aSchristos static void
do_getdirentries(os_emul_data * emul,unsigned call,const int arg0,cpu * processor,unsigned_word cia)9396ca2c52aSchristos do_getdirentries(os_emul_data *emul,
9406ca2c52aSchristos 		 unsigned call,
9416ca2c52aSchristos 		 const int arg0,
9426ca2c52aSchristos 		 cpu *processor,
9436ca2c52aSchristos 		 unsigned_word cia)
9446ca2c52aSchristos {
9456ca2c52aSchristos   int fd = cpu_registers(processor)->gpr[arg0];
9466ca2c52aSchristos   unsigned_word buf_addr = cpu_registers(processor)->gpr[arg0+1];
9476ca2c52aSchristos   char *buf;
9486ca2c52aSchristos   int nbytes = cpu_registers(processor)->gpr[arg0+2];
9496ca2c52aSchristos   unsigned_word basep_addr = cpu_registers(processor)->gpr[arg0+3];
9506ca2c52aSchristos   long basep;
9516ca2c52aSchristos   int status;
9526ca2c52aSchristos #ifdef SYS_getdirentries
9536ca2c52aSchristos   SYS(getdirentries);
9546ca2c52aSchristos #endif
9556ca2c52aSchristos   if (buf_addr != 0 && nbytes >= 0)
9566ca2c52aSchristos     buf = zalloc(nbytes);
9576ca2c52aSchristos   else
9586ca2c52aSchristos     buf = NULL;
9596ca2c52aSchristos   status = getdirentries(fd,
9606ca2c52aSchristos 			 (buf_addr == 0 ? NULL : buf),
9616ca2c52aSchristos 			 nbytes,
9626ca2c52aSchristos 			 (basep_addr == 0 ? NULL : &basep));
9636ca2c52aSchristos   emul_write_status(processor, status, errno);
9646ca2c52aSchristos   if (basep_addr != 0)
9656ca2c52aSchristos     emul_write_word(basep_addr, basep, processor, cia);
9666ca2c52aSchristos   if (status > 0)
9676ca2c52aSchristos     write_direntries(buf_addr, buf, status, processor, cia);
9686ca2c52aSchristos   if (buf != NULL)
9696ca2c52aSchristos     free(buf);
9706ca2c52aSchristos }
9716ca2c52aSchristos #endif
9726ca2c52aSchristos 
9736ca2c52aSchristos 
9746ca2c52aSchristos static void
do___syscall(os_emul_data * emul,unsigned call,const int arg0,cpu * processor,unsigned_word cia)9756ca2c52aSchristos do___syscall(os_emul_data *emul,
9766ca2c52aSchristos 	     unsigned call,
9776ca2c52aSchristos 	     const int arg0,
9786ca2c52aSchristos 	     cpu *processor,
9796ca2c52aSchristos 	     unsigned_word cia)
9806ca2c52aSchristos {
9816ca2c52aSchristos   SYS(__syscall);
9826ca2c52aSchristos   emul_do_system_call(emul,
9836ca2c52aSchristos 		      emul->syscalls,
9846ca2c52aSchristos 		      cpu_registers(processor)->gpr[arg0],
9856ca2c52aSchristos 		      arg0 + 1,
9866ca2c52aSchristos 		      processor,
9876ca2c52aSchristos 		      cia);
9886ca2c52aSchristos }
9896ca2c52aSchristos 
9906ca2c52aSchristos #ifndef HAVE_LSEEK
9916ca2c52aSchristos #define do_lseek 0
9926ca2c52aSchristos #else
9936ca2c52aSchristos static void
do_lseek(os_emul_data * emul,unsigned call,const int arg0,cpu * processor,unsigned_word cia)9946ca2c52aSchristos do_lseek(os_emul_data *emul,
9956ca2c52aSchristos 	 unsigned call,
9966ca2c52aSchristos 	 const int arg0,
9976ca2c52aSchristos 	 cpu *processor,
9986ca2c52aSchristos 	 unsigned_word cia)
9996ca2c52aSchristos {
10006ca2c52aSchristos   int fildes = cpu_registers(processor)->gpr[arg0];
10016ca2c52aSchristos   off_t offset = emul_read_gpr64(processor, arg0+2);
10026ca2c52aSchristos   int whence = cpu_registers(processor)->gpr[arg0+4];
10036ca2c52aSchristos   off_t status;
10046ca2c52aSchristos   SYS(lseek);
1005b2396a7bSchristos   status = fdbad (fildes);
1006b2396a7bSchristos   if (status == 0)
10076ca2c52aSchristos     status = lseek(fildes, offset, whence);
10086ca2c52aSchristos   if (status == -1)
10096ca2c52aSchristos     emul_write_status(processor, -1, errno);
10106ca2c52aSchristos   else {
10116ca2c52aSchristos     emul_write_status(processor, 0, 0); /* success */
10126ca2c52aSchristos     emul_write_gpr64(processor, 3, status);
10136ca2c52aSchristos   }
10146ca2c52aSchristos }
10156ca2c52aSchristos #endif
10166ca2c52aSchristos 
10176ca2c52aSchristos static void
do___sysctl(os_emul_data * emul,unsigned call,const int arg0,cpu * processor,unsigned_word cia)10186ca2c52aSchristos do___sysctl(os_emul_data *emul,
10196ca2c52aSchristos 	    unsigned call,
10206ca2c52aSchristos 	    const int arg0,
10216ca2c52aSchristos 	    cpu *processor,
10226ca2c52aSchristos 	    unsigned_word cia)
10236ca2c52aSchristos {
10246ca2c52aSchristos   /* call the arguments by their real name */
10256ca2c52aSchristos   unsigned_word name = cpu_registers(processor)->gpr[arg0];
10266ca2c52aSchristos   natural_word namelen = cpu_registers(processor)->gpr[arg0+1];
10276ca2c52aSchristos   unsigned_word oldp = cpu_registers(processor)->gpr[arg0+2];
10286ca2c52aSchristos   unsigned_word oldlenp = cpu_registers(processor)->gpr[arg0+3];
10296ca2c52aSchristos   natural_word oldlen;
10306ca2c52aSchristos   natural_word mib;
10316ca2c52aSchristos   natural_word int_val;
10326ca2c52aSchristos   SYS(__sysctl);
10336ca2c52aSchristos 
10346ca2c52aSchristos   /* pluck out the management information base id */
10356ca2c52aSchristos   if (namelen < 1)
10366ca2c52aSchristos     error("system_call()SYS___sysctl bad name[0]\n");
10376ca2c52aSchristos   mib = vm_data_map_read_word(cpu_data_map(processor),
10386ca2c52aSchristos 			      name,
10396ca2c52aSchristos 			      processor,
10406ca2c52aSchristos 			      cia);
10416ca2c52aSchristos   name += sizeof(mib);
10426ca2c52aSchristos 
10436ca2c52aSchristos   /* see what to do with it ... */
10446ca2c52aSchristos   switch ((int)mib) {
10456ca2c52aSchristos   case 6/*CTL_HW*/:
10466ca2c52aSchristos #if WITH_NetBSD_HOST && (CTL_HW != 6)
10476ca2c52aSchristos #  error "CTL_HW"
10486ca2c52aSchristos #endif
10496ca2c52aSchristos     if (namelen < 2)
10506ca2c52aSchristos       error("system_call()SYS___sysctl - CTL_HW - bad name[1]\n");
10516ca2c52aSchristos     mib = vm_data_map_read_word(cpu_data_map(processor),
10526ca2c52aSchristos 				name,
10536ca2c52aSchristos 				processor,
10546ca2c52aSchristos 				cia);
10556ca2c52aSchristos     name += sizeof(mib);
10566ca2c52aSchristos     switch ((int)mib) {
10576ca2c52aSchristos     case 7/*HW_PAGESIZE*/:
10586ca2c52aSchristos #if WITH_NetBSD_HOST && (HW_PAGESIZE != 7)
10596ca2c52aSchristos #  error "HW_PAGESIZE"
10606ca2c52aSchristos #endif
10616ca2c52aSchristos       oldlen = vm_data_map_read_word(cpu_data_map(processor),
10626ca2c52aSchristos 				     oldlenp,
10636ca2c52aSchristos 				     processor,
10646ca2c52aSchristos 				     cia);
10656ca2c52aSchristos       if (sizeof(natural_word) > oldlen)
10666ca2c52aSchristos 	error("system_call()sysctl - CTL_HW.HW_PAGESIZE - to small\n");
10676ca2c52aSchristos       int_val = 8192;
10686ca2c52aSchristos       oldlen = sizeof(int_val);
10696ca2c52aSchristos       emul_write_word(oldp, int_val, processor, cia);
10706ca2c52aSchristos       emul_write_word(oldlenp, oldlen, processor, cia);
10716ca2c52aSchristos       break;
10726ca2c52aSchristos     default:
10736ca2c52aSchristos       error("sysctl() CTL_HW.%d unknown\n", mib);
10746ca2c52aSchristos       break;
10756ca2c52aSchristos     }
10766ca2c52aSchristos     break;
10776ca2c52aSchristos   default:
10786ca2c52aSchristos     error("sysctl() name[0]=%d unknown\n", (int)mib);
10796ca2c52aSchristos     break;
10806ca2c52aSchristos   }
10816ca2c52aSchristos   emul_write_status(processor, 0, 0); /* always succeed */
10826ca2c52aSchristos }
10836ca2c52aSchristos 
10846ca2c52aSchristos 
10856ca2c52aSchristos 
10866ca2c52aSchristos static emul_syscall_descriptor netbsd_descriptors[] = {
10876ca2c52aSchristos   /* 0 */ { 0, "syscall" },
10886ca2c52aSchristos   /* 1 */ { do_exit, "exit" },
10896ca2c52aSchristos   /* 2 */ { 0, "fork" },
10906ca2c52aSchristos   /* 3 */ { do_read, "read" },
10916ca2c52aSchristos   /* 4 */ { do_write, "write" },
10926ca2c52aSchristos   /* 5 */ { do_open, "open" },
10936ca2c52aSchristos   /* 6 */ { do_close, "close" },
10946ca2c52aSchristos   { 0, }, /* 7 is old wait4 */
10956ca2c52aSchristos   { 0, }, /* 8 is old creat */
10966ca2c52aSchristos   /* 9 */ { 0, "link" },
10976ca2c52aSchristos   /* 10 */ { 0, "unlink" },
10986ca2c52aSchristos   { 0, }, /* 11 is obsolete execv */
10996ca2c52aSchristos   /* 12 */ { 0, "chdir" },
11006ca2c52aSchristos   /* 13 */ { 0, "fchdir" },
11016ca2c52aSchristos   { 0, }, /* 14 is old mknod */
11026ca2c52aSchristos   /* 15 */ { 0, "chmod" },
11036ca2c52aSchristos   /* 16 */ { 0, "chown" },
11046ca2c52aSchristos   /* 17 */ { do_break, "break" },
11056ca2c52aSchristos   { 0, }, /* 18 is old getfsstat */
11066ca2c52aSchristos   { 0, }, /* 19 is old lseek */
11076ca2c52aSchristos   /* 20 */ { do_getpid, "getpid" },
11086ca2c52aSchristos   { 0, }, /* 21 is old mount */
11096ca2c52aSchristos   /* 22 */ { 0, "unmount" },
11106ca2c52aSchristos   /* 23 */ { 0, "setuid" },
11116ca2c52aSchristos   /* 24 */ { do_getuid, "getuid" },
11126ca2c52aSchristos   /* 25 */ { do_geteuid, "geteuid" },
11136ca2c52aSchristos   /* 26 */ { 0, "ptrace" },
11146ca2c52aSchristos   /* 27 */ { 0, "recvmsg" },
11156ca2c52aSchristos   /* 28 */ { 0, "sendmsg" },
11166ca2c52aSchristos   /* 29 */ { 0, "recvfrom" },
11176ca2c52aSchristos   /* 30 */ { 0, "accept" },
11186ca2c52aSchristos   /* 31 */ { 0, "getpeername" },
11196ca2c52aSchristos   /* 32 */ { 0, "getsockname" },
11206ca2c52aSchristos   /* 33 */ { 0, "access" },
11216ca2c52aSchristos   /* 34 */ { 0, "chflags" },
11226ca2c52aSchristos   /* 35 */ { 0, "fchflags" },
11236ca2c52aSchristos   /* 36 */ { 0, "sync" },
11246ca2c52aSchristos   /* 37 */ { do_kill, "kill" },
11256ca2c52aSchristos   { 0, }, /* 38 is old stat */
11266ca2c52aSchristos   /* 39 */ { 0, "getppid" },
11276ca2c52aSchristos   { 0, }, /* 40 is old lstat */
11286ca2c52aSchristos   /* 41 */ { do_dup, "dup" },
11296ca2c52aSchristos   /* 42 */ { 0, "pipe" },
11306ca2c52aSchristos   /* 43 */ { do_getegid, "getegid" },
11316ca2c52aSchristos   /* 44 */ { 0, "profil" },
11326ca2c52aSchristos   /* 45 */ { 0, "ktrace" },
11336ca2c52aSchristos   { 0, }, /* 46 is old sigaction */
11346ca2c52aSchristos   /* 47 */ { do_getgid, "getgid" },
11356ca2c52aSchristos   { 0, }, /* 48 is old sigprocmask */
11366ca2c52aSchristos   /* 49 */ { 0, "getlogin" },
11376ca2c52aSchristos   /* 50 */ { 0, "setlogin" },
11386ca2c52aSchristos   /* 51 */ { 0, "acct" },
11396ca2c52aSchristos   { 0, }, /* 52 is old sigpending */
11406ca2c52aSchristos   { 0, }, /* 53 is old sigaltstack */
11416ca2c52aSchristos   /* 54 */ { do_ioctl, "ioctl" },
11426ca2c52aSchristos   { 0, }, /* 55 is old reboot */
11436ca2c52aSchristos   /* 56 */ { 0, "revoke" },
11446ca2c52aSchristos   /* 57 */ { 0, "symlink" },
11456ca2c52aSchristos   /* 58 */ { 0, "readlink" },
11466ca2c52aSchristos   /* 59 */ { 0, "execve" },
11476ca2c52aSchristos   /* 60 */ { do_umask, "umask" },
11486ca2c52aSchristos   /* 61 */ { 0, "chroot" },
11496ca2c52aSchristos   { 0, }, /* 62 is old fstat */
11506ca2c52aSchristos   { 0, }, /* 63 is old getkerninfo */
11516ca2c52aSchristos   { 0, }, /* 64 is old getpagesize */
11526ca2c52aSchristos   { 0, }, /* 65 is old msync */
11536ca2c52aSchristos   /* 66 */ { 0, "vfork" },
11546ca2c52aSchristos   { 0, }, /* 67 is obsolete vread */
11556ca2c52aSchristos   { 0, }, /* 68 is obsolete vwrite */
11566ca2c52aSchristos   /* 69 */ { 0, "sbrk" },
1157b4de9524Skamil   { 0, }, /* 70 is obsolete sstk */
11586ca2c52aSchristos   { 0, }, /* 71 is old mmap */
1159ebf3c43aSkamil   { 0, }, /* 72 is obsolete vadvise */
11606ca2c52aSchristos   /* 73 */ { 0, "munmap" },
11616ca2c52aSchristos   /* 74 */ { 0, "mprotect" },
11626ca2c52aSchristos   /* 75 */ { 0, "madvise" },
11636ca2c52aSchristos   { 0, }, /* 76 is obsolete vhangup */
11646ca2c52aSchristos   { 0, }, /* 77 is obsolete vlimit */
11656ca2c52aSchristos   /* 78 */ { 0, "mincore" },
11666ca2c52aSchristos   /* 79 */ { 0, "getgroups" },
11676ca2c52aSchristos   /* 80 */ { 0, "setgroups" },
11686ca2c52aSchristos   /* 81 */ { 0, "getpgrp" },
11696ca2c52aSchristos   /* 82 */ { 0, "setpgid" },
11706ca2c52aSchristos   { 0, }, /* 83 is old setitimer */
11716ca2c52aSchristos   { 0, }, /* 84 is old wait */
11726ca2c52aSchristos   { 0, }, /* 85 is old swapon */
11736ca2c52aSchristos   { 0, }, /* 86 is old getitimer */
11746ca2c52aSchristos   { 0, }, /* 87 is old gethostname */
11756ca2c52aSchristos   { 0, }, /* 88 is old sethostname */
11766ca2c52aSchristos   { 0, }, /* 89 is old getdtablesize */
11776ca2c52aSchristos   { do_dup2, "dup2" },
11786ca2c52aSchristos   { 0, }, /* 91 */
11796ca2c52aSchristos   /* 92 */ { do_fcntl, "fcntl" },
11806ca2c52aSchristos   { 0, }, /* 93 is old select */
11816ca2c52aSchristos   { 0, }, /* 94 */
11826ca2c52aSchristos   /* 95 */ { 0, "fsync" },
11836ca2c52aSchristos   /* 96 */ { 0, "setpriority" },
11846ca2c52aSchristos   { 0, }, /* 97 is old socket */
11856ca2c52aSchristos   { 0, }, /* 98 is old connect */
11866ca2c52aSchristos   { 0, }, /* 99 is old accept */
11876ca2c52aSchristos   /* 100 */ { 0, "getpriority" },
11886ca2c52aSchristos   { 0, }, /* 101 is old send */
11896ca2c52aSchristos   { 0, }, /* 102 is old recv */
11906ca2c52aSchristos   { 0, }, /* 103 is old sigreturn */
11916ca2c52aSchristos   /* 104 */ { 0, "bind" },
11926ca2c52aSchristos   /* 105 */ { 0, "setsockopt" },
11936ca2c52aSchristos   /* 106 */ { 0, "listen" },
11946ca2c52aSchristos   { 0, }, /* 107 is obsolete vtimes */
11956ca2c52aSchristos   { 0, }, /* 108 is old sigvec */
11966ca2c52aSchristos   { 0, }, /* 109 is old sigblock */
11976ca2c52aSchristos   { 0, }, /* 110 is old sigsetmask */
11986ca2c52aSchristos   { 0, }, /* 111 is old sigsuspend */
11996ca2c52aSchristos   { 0, }, /* 112 is old sigstack */
12006ca2c52aSchristos   { 0, }, /* 113 is old recvmsg */
12016ca2c52aSchristos   { 0, }, /* 114 is old sendmsg */
12026ca2c52aSchristos   /* - is obsolete vtrace */ { 0, "vtrace	115" },
12036ca2c52aSchristos   { 0, }, /* 116 is old gettimeofday */
12046ca2c52aSchristos   { 0, }, /* 117 is old getrusage */
12056ca2c52aSchristos   /* 118 */ { 0, "getsockopt" },
12066ca2c52aSchristos   /* - is obsolete resuba */ { 0, "resuba	119" },
12076ca2c52aSchristos   /* 120 */ { 0, "readv" },
12086ca2c52aSchristos   /* 121 */ { 0, "writev" },
12096ca2c52aSchristos   { 0, }, /* 122 is old settimeofday */
12106ca2c52aSchristos   /* 123 */ { 0, "fchown" },
12116ca2c52aSchristos   /* 124 */ { 0, "fchmod" },
12126ca2c52aSchristos   { 0, }, /* 125 is old recvfrom */
12136ca2c52aSchristos   { 0, }, /* 126 is old setreuid */
12146ca2c52aSchristos   { 0, }, /* 127 is old setregid */
12156ca2c52aSchristos   /* 126 */ { 0, "setreuid" },
12166ca2c52aSchristos   /* 127 */ { 0, "setregid" },
12176ca2c52aSchristos   /* 128 */ { 0, "rename" },
12186ca2c52aSchristos   { 0, }, /* 129 is old truncate */
12196ca2c52aSchristos   { 0, }, /* 130 is old ftruncate */
12206ca2c52aSchristos   /* 131 */ { 0, "flock" },
12216ca2c52aSchristos   /* 132 */ { 0, "mkfifo" },
12226ca2c52aSchristos   /* 133 */ { 0, "sendto" },
12236ca2c52aSchristos   /* 134 */ { 0, "shutdown" },
12246ca2c52aSchristos   /* 135 */ { 0, "socketpair" },
12256ca2c52aSchristos   /* 136 */ { 0, "mkdir" },
12266ca2c52aSchristos   /* 137 */ { 0, "rmdir" },
12276ca2c52aSchristos   { 0, }, /* 138 is old utimes */
12286ca2c52aSchristos   { 0, }, /* 139 is obsolete 4.2 sigreturn */
12296ca2c52aSchristos   { 0, }, /* 140 is old adjtime */
12306ca2c52aSchristos   { 0, }, /* 141 is old getpeername */
12316ca2c52aSchristos   { 0, }, /* 142 is old gethostid */
12326ca2c52aSchristos   { 0, }, /* 143 is old sethostid */
12336ca2c52aSchristos   { 0, }, /* 144 is old getrlimit */
12346ca2c52aSchristos   { 0, }, /* 145 is old setrlimit */
12356ca2c52aSchristos   { 0, }, /* 146 is old killpg */
12366ca2c52aSchristos   /* 147 */ { 0, "setsid" },
12376ca2c52aSchristos   /* 148 */ { 0, "quotactl" },
12386ca2c52aSchristos   { 0, }, /* 149 is old quota */
12396ca2c52aSchristos   { 0, }, /* 150 is old getsockname */
12406ca2c52aSchristos   { 0, }, /* 151 */
12416ca2c52aSchristos   { 0, }, /* 152 */
12426ca2c52aSchristos   { 0, }, /* 153 */
12436ca2c52aSchristos   { 0, }, /* 154 */
12446ca2c52aSchristos   /* 155 */ { 0, "nfssvc" },
12456ca2c52aSchristos   { 0, }, /* 156 is old getdirentries */
12466ca2c52aSchristos   { 0, }, /* 157 is old statfs */
12476ca2c52aSchristos   { 0, }, /* 158 is old fstatfs */
12486ca2c52aSchristos   { 0, }, /* 159 */
12496ca2c52aSchristos   { 0, }, /* 160 */
12506ca2c52aSchristos   { 0, }, /* 161 is old getfh */
12516ca2c52aSchristos   { 0, }, /* 162 is old getdomainname */
12526ca2c52aSchristos   { 0, }, /* 163 is old setdomainname */
12536ca2c52aSchristos   { 0, }, /* 164 is old uname */
12546ca2c52aSchristos   /* 165 */ { 0, "sysarch" },
12556ca2c52aSchristos   { 0, }, /* 166 */
12566ca2c52aSchristos   { 0, }, /* 167 */
12576ca2c52aSchristos   { 0, }, /* 168 */
12586ca2c52aSchristos   { 0, }, /* 169 is old semsys */
12596ca2c52aSchristos   { 0, }, /* 170 is old msgsys */
12606ca2c52aSchristos   { 0, }, /* 171 is old shmsys */
12616ca2c52aSchristos   { 0, }, /* 172 */
12626ca2c52aSchristos   /* 173 */ { 0, "pread" },
12636ca2c52aSchristos   /* 174 */ { 0, "pwrite" },
12646ca2c52aSchristos   { 0, }, /* 175 is old ntp_gettime */
12656ca2c52aSchristos   /* 176 */ { 0, "ntp_adjtime" },
12666ca2c52aSchristos   { 0, }, /* 177 */
12676ca2c52aSchristos   { 0, }, /* 178 */
12686ca2c52aSchristos   { 0, }, /* 179 */
12696ca2c52aSchristos   { 0, }, /* 180 */
12706ca2c52aSchristos   /* 181 */ { 0, "setgid" },
12716ca2c52aSchristos   /* 182 */ { 0, "setegid" },
12726ca2c52aSchristos   /* 183 */ { 0, "seteuid" },
12736ca2c52aSchristos   /* 184 */ { 0, "lfs_bmapv" },
12746ca2c52aSchristos   /* 185 */ { 0, "lfs_markv" },
12756ca2c52aSchristos   /* 186 */ { 0, "lfs_segclean" },
12766ca2c52aSchristos   /* 187 */ { 0, "lfs_segwait" },
12776ca2c52aSchristos   { 0, }, /* 188 is old stat" */
12786ca2c52aSchristos   { 0, }, /* 189 is old fstat */
12796ca2c52aSchristos   { 0, }, /* 190 is old lstat */
12806ca2c52aSchristos   /* 191 */ { 0, "pathconf" },
12816ca2c52aSchristos   /* 192 */ { 0, "fpathconf" },
12826ca2c52aSchristos   { 0, }, /* 193 */
12836ca2c52aSchristos   /* 194 */ { 0, "getrlimit" },
12846ca2c52aSchristos   /* 195 */ { 0, "setrlimit" },
12856ca2c52aSchristos   { 0, }, /* 196 is old getdirentries */
12866ca2c52aSchristos   /* 197 */ { 0, "mmap" },
12876ca2c52aSchristos   /* 198 */ { do___syscall, "__syscall" },
12886ca2c52aSchristos   /* 199 */ { do_lseek, "lseek" },
12896ca2c52aSchristos   /* 200 */ { 0, "truncate" },
12906ca2c52aSchristos   /* 201 */ { 0, "ftruncate" },
12916ca2c52aSchristos   /* 202 */ { do___sysctl, "__sysctl" },
12926ca2c52aSchristos   /* 203 */ { 0, "mlock" },
12936ca2c52aSchristos   /* 204 */ { 0, "munlock" },
12946ca2c52aSchristos   /* 205 */ { 0, "undelete" },
12956ca2c52aSchristos   { 0, }, /* 206 is old futimes */
12966ca2c52aSchristos   /* 207 */ { 0, "getpgid" },
12976ca2c52aSchristos   /* 208 */ { 0, "reboot" },
12986ca2c52aSchristos   /* 209 */ { 0, "poll" },
12996ca2c52aSchristos   { 0, }, /* 210 */
13006ca2c52aSchristos   { 0, }, /* 211 */
13016ca2c52aSchristos   { 0, }, /* 212 */
13026ca2c52aSchristos   { 0, }, /* 213 */
13036ca2c52aSchristos   { 0, }, /* 214 */
13046ca2c52aSchristos   { 0, }, /* 215 */
13056ca2c52aSchristos   { 0, }, /* 216 */
13066ca2c52aSchristos   { 0, }, /* 217 */
13076ca2c52aSchristos   { 0, }, /* 218 */
13086ca2c52aSchristos   { 0, }, /* 219 */
13096ca2c52aSchristos   { 0, }, /* 220 is old semctl */
13106ca2c52aSchristos   /* 221 */ { 0, "semget" },
13116ca2c52aSchristos   /* 222 */ { 0, "semop" },
13126ca2c52aSchristos   /* 223 */ { 0, "semconfig" },
13136ca2c52aSchristos   { 0, }, /* 224 is old msgctl */
13146ca2c52aSchristos   /* 225 */ { 0, "msgget" },
13156ca2c52aSchristos   /* 226 */ { 0, "msgsnd" },
13166ca2c52aSchristos   /* 227 */ { 0, "msgrcv" },
13176ca2c52aSchristos   /* 228 */ { 0, "shmat" },
13186ca2c52aSchristos   { 0, }, /* 229 is old shmctl */
13196ca2c52aSchristos   /* 230 */ { 0, "shmdt" },
13206ca2c52aSchristos   /* 231 */ { 0, "shmget" },
13216ca2c52aSchristos   { 0, }, /* 232 is old clock_gettime */
13226ca2c52aSchristos   { 0, }, /* 233 is old clock_settime */
13236ca2c52aSchristos   { 0, }, /* 234 is old clock_getres */
13246ca2c52aSchristos   /* 235 */ { 0, "timer_create" },
13256ca2c52aSchristos   /* 236 */ { 0, "timer_delete" },
13266ca2c52aSchristos   { 0, }, /* 237 is old timer_settime */
13276ca2c52aSchristos   { 0, }, /* 238 is old timer_gettime */
13286ca2c52aSchristos   /* 239 */ { 0, "timer_getoverrun" },
13296ca2c52aSchristos   { 0, }, /* 240 is old nanosleep */
13306ca2c52aSchristos   /* 241 */ { 0, "fdatasync" },
13316ca2c52aSchristos   /* 242 */ { 0, "mlockall" },
13326ca2c52aSchristos   /* 243 */ { 0, "munlockall" },
13336ca2c52aSchristos   { 0, }, /* 244 is old sigtimedwait */
13346ca2c52aSchristos   { 0, }, /* 245 */
13356ca2c52aSchristos   /* 246 */ { 0, "modctl" },
13366ca2c52aSchristos   /* 247 */ { 0, "_ksem_init" },
13376ca2c52aSchristos   /* 248 */ { 0, "_ksem_open" },
13386ca2c52aSchristos   /* 249 */ { 0, "_ksem_unlink" },
13396ca2c52aSchristos   /* 250 */ { 0, "_ksem_close" },
13406ca2c52aSchristos   /* 251 */ { 0, "_ksem_post" },
13416ca2c52aSchristos   /* 252 */ { 0, "_ksem_wait" },
13426ca2c52aSchristos   /* 253 */ { 0, "_ksem_trywait" },
13436ca2c52aSchristos   /* 254 */ { 0, "_ksem_getvalue" },
13446ca2c52aSchristos   /* 255 */ { 0, "_ksem_destroy" },
13456ca2c52aSchristos   /* 256 */ { 0, "_ksem_timedwait" },
13466ca2c52aSchristos   /* 257 */ { 0, "mq_open" },
13476ca2c52aSchristos   /* 258 */ { 0, "mq_close" },
13486ca2c52aSchristos   /* 259 */ { 0, "mq_unlink" },
13496ca2c52aSchristos   /* 260 */ { 0, "mq_getattr" },
13506ca2c52aSchristos   /* 261 */ { 0, "mq_setattr" },
13516ca2c52aSchristos   /* 262 */ { 0, "mq_notify" },
13526ca2c52aSchristos   /* 263 */ { 0, "mq_send" },
13536ca2c52aSchristos   /* 264 */ { 0, "mq_receive" },
13546ca2c52aSchristos   { 0, }, /* 265 is old mq_timedsend */
13556ca2c52aSchristos   { 0, }, /* 266 is old mq_timedrecive */
13566ca2c52aSchristos   { 0, }, /* 267 */
13576ca2c52aSchristos   { 0, }, /* 268 */
13586ca2c52aSchristos   { 0, }, /* 269 */
13596ca2c52aSchristos   /* 270 */ { 0, "__posix_rename" },
13606ca2c52aSchristos   /* 271 */ { 0, "swapctl" },
13616ca2c52aSchristos   { 0, }, /* 272 is old getdents */
13626ca2c52aSchristos   /* 273 */ { 0, "minherit" },
13636ca2c52aSchristos   /* 274 */ { 0, "lchmod" },
13646ca2c52aSchristos   /* 275 */ { 0, "lchown" },
13656ca2c52aSchristos   { 0, }, /* 276 is old lutimes */
13666ca2c52aSchristos   /* 277 */ { 0, "__msync13" },
13676ca2c52aSchristos   { 0, }, /* 278 is old stat */
13686ca2c52aSchristos   { 0, }, /* 279 is old fstat */
13696ca2c52aSchristos   { 0, }, /* 280 is old lstat */
13706ca2c52aSchristos   /* 281 */ { 0, "__sigaltstack13" },
13716ca2c52aSchristos   /* 282 */ { 0, "__vfork14" },
13726ca2c52aSchristos   /* 283 */ { 0, "__posix_chown" },
13736ca2c52aSchristos   /* 284 */ { 0, "__posix_fchown" },
13746ca2c52aSchristos   /* 285 */ { 0, "__posix_lchown" },
13756ca2c52aSchristos   /* 286 */ { 0, "getsid" },
13766ca2c52aSchristos   /* 287 */ { 0, "__clone" },
13776ca2c52aSchristos   /* 288 */ { 0, "fktrace" },
13786ca2c52aSchristos   /* 289 */ { 0, "preadv" },
13796ca2c52aSchristos   /* 290 */ { 0, "pwritev" },
13806ca2c52aSchristos   { 0, }, /* 291 is old sigaction */
13816ca2c52aSchristos   /* 292 */ { 0, "__sigpending14" },
13826ca2c52aSchristos   /* 293 */ { do_sigprocmask, "__sigprocmask14" },
13836ca2c52aSchristos   /* 294 */ { 0, "__sigsuspend14" },
13846ca2c52aSchristos   /* 295 */ { 0, "__sigreturn14" },
13856ca2c52aSchristos   /* 296 */ { 0, "__getcwd" },
13866ca2c52aSchristos   /* 297 */ { 0, "fchroot" },
13876ca2c52aSchristos   { 0, }, /* 298 is old fhopen */
13886ca2c52aSchristos   { 0, }, /* 299 is old fhstat */
13896ca2c52aSchristos   { 0, }, /* 300 is old fhstatfs */
13906ca2c52aSchristos   { 0, }, /* 301 is old semctl */
13916ca2c52aSchristos   { 0, }, /* 302 is old msgctl */
13926ca2c52aSchristos   { 0, }, /* 303 is old shmctl */
13936ca2c52aSchristos   /* 304 */ { 0, "lchflags" },
13946ca2c52aSchristos   /* 305 */ { 0, "issetugid" },
13956ca2c52aSchristos   /* 306 */ { 0, "utrace" },
13966ca2c52aSchristos   /* 307 */ { 0, "getcontext" },
13976ca2c52aSchristos   /* 308 */ { 0, "setcontext" },
13986ca2c52aSchristos   /* 309 */ { 0, "_lwp_create" },
13996ca2c52aSchristos   /* 310 */ { 0, "_lwp_exit" },
14006ca2c52aSchristos   /* 311 */ { 0, "_lwp_self" },
14016ca2c52aSchristos   /* 312 */ { 0, "_lwp_wait" },
14026ca2c52aSchristos   /* 313 */ { 0, "_lwp_suspend" },
14036ca2c52aSchristos   /* 314 */ { 0, "_lwp_continue" },
14046ca2c52aSchristos   /* 315 */ { 0, "_lwp_wakeup" },
14056ca2c52aSchristos   /* 316 */ { 0, "_lwp_getprivate" },
14066ca2c52aSchristos   /* 317 */ { 0, "_lwp_setprivate" },
14076ca2c52aSchristos   /* 318 */ { 0, "_lwp_kill" },
14086ca2c52aSchristos   /* 319 */ { 0, "_lwp_detach" },
14096ca2c52aSchristos   { 0, }, /* 320 is old _lwp_park */
14106ca2c52aSchristos   /* 321 */ { 0, "_lwp_unpark" },
14116ca2c52aSchristos   /* 322 */ { 0, "_lwp_unpark_all" },
14126ca2c52aSchristos   /* 323 */ { 0, "_lwp_setname" },
14136ca2c52aSchristos   /* 324 */ { 0, "_lwp_getname" },
14146ca2c52aSchristos   /* 325 */ { 0, "_lwp_ctl" },
14156ca2c52aSchristos   { 0, }, /* 326 */
14166ca2c52aSchristos   { 0, }, /* 327 */
14176ca2c52aSchristos   { 0, }, /* 328 */
14186ca2c52aSchristos   { 0, }, /* 329 */
14196ca2c52aSchristos   /* 330 */ { 0, "sa_register" },
14206ca2c52aSchristos   /* 331 */ { 0, "sa_stacks" },
14216ca2c52aSchristos   /* 332 */ { 0, "sa_enable" },
14226ca2c52aSchristos   /* 333 */ { 0, "sa_setconcurrency" },
14236ca2c52aSchristos   /* 334 */ { 0, "sa_yield" },
14246ca2c52aSchristos   /* 335 */ { 0, "sa_preempt" },
14256ca2c52aSchristos   { 0, }, /* 336 */
14266ca2c52aSchristos   { 0, }, /* 337 */
14276ca2c52aSchristos   { 0, }, /* 338 */
14286ca2c52aSchristos   { 0, }, /* 339 */
14296ca2c52aSchristos   /* 340 */ { 0, "__sigaction_sigtramp" },
14306ca2c52aSchristos   /* 341 */ { 0, "pmc_get_info" },
14316ca2c52aSchristos   /* 342 */ { 0, "pmc_control" },
14326ca2c52aSchristos   /* 343 */ { 0, "rasctl" },
14336ca2c52aSchristos   /* 344 */ { 0, "kqueue" },
14346ca2c52aSchristos   { 0, }, /* 345 is old kevent */
14356ca2c52aSchristos   /* 346 */ { 0, "_sched_setparam" },
14366ca2c52aSchristos   /* 347 */ { 0, "_sched_getparam" },
14376ca2c52aSchristos   /* 348 */ { 0, "_sched_setaffinity" },
14386ca2c52aSchristos   /* 349 */ { 0, "_sched_getaffinity" },
14396ca2c52aSchristos   /* 350 */ { 0, "sched_yield" },
14406ca2c52aSchristos   { 0, }, /* 351 */
14416ca2c52aSchristos   { 0, }, /* 352 */
14426ca2c52aSchristos   { 0, }, /* 353 */
14436ca2c52aSchristos   /* 354 */ { 0, "fsync_range" },
14446ca2c52aSchristos   /* 355 */ { 0, "uuidgen" },
14456ca2c52aSchristos   /* 356 */ { 0, "getvfsstat" },
14466ca2c52aSchristos   /* 357 */ { 0, "statvfs1" },
14476ca2c52aSchristos   /* 358 */ { 0, "fstatvfs1" },
14486ca2c52aSchristos   { 0, }, /* 359 is old fhstatvfs1 */
14496ca2c52aSchristos   /* 360 */ { 0, "extattrctl" },
14506ca2c52aSchristos   /* 361 */ { 0, "extattr_set_file" },
14516ca2c52aSchristos   /* 362 */ { 0, "extattr_get_file" },
14526ca2c52aSchristos   /* 363 */ { 0, "extattr_delete_file" },
14536ca2c52aSchristos   /* 364 */ { 0, "extattr_set_fd" },
14546ca2c52aSchristos   /* 365 */ { 0, "extattr_get_fd" },
14556ca2c52aSchristos   /* 366 */ { 0, "extattr_delete_fd" },
14566ca2c52aSchristos   /* 367 */ { 0, "extattr_set_link" },
14576ca2c52aSchristos   /* 368 */ { 0, "extattr_get_link" },
14586ca2c52aSchristos   /* 369 */ { 0, "extattr_delete_link" },
14596ca2c52aSchristos   /* 370 */ { 0, "extattr_list_fd" },
14606ca2c52aSchristos   /* 371 */ { 0, "extattr_list_file" },
14616ca2c52aSchristos   /* 372 */ { 0, "extattr_list_link" },
14626ca2c52aSchristos   { 0, }, /* 373 is old pselect */
14636ca2c52aSchristos   { 0, }, /* 374 is old pollts */
14646ca2c52aSchristos   /* 375 */ { 0, "setxattr" },
14656ca2c52aSchristos   /* 376 */ { 0, "lsetxattr" },
14666ca2c52aSchristos   /* 377 */ { 0, "fsetxattr" },
14676ca2c52aSchristos   /* 378 */ { 0, "getxattr" },
14686ca2c52aSchristos   /* 379 */ { 0, "lgetxattr" },
14696ca2c52aSchristos   /* 380 */ { 0, "fgetxattr" },
14706ca2c52aSchristos   /* 381 */ { 0, "listxattr" },
14716ca2c52aSchristos   /* 382 */ { 0, "llistxattr" },
14726ca2c52aSchristos   /* 383 */ { 0, "flistxattr" },
14736ca2c52aSchristos   /* 384 */ { 0, "removexattr" },
14746ca2c52aSchristos   /* 385 */ { 0, "lremovexattr" },
14756ca2c52aSchristos   /* 386 */ { 0, "fremovexattr" },
14766ca2c52aSchristos   { 0, }, /* 387 is old stat */
14776ca2c52aSchristos   { 0, }, /* 388 is old fstat */
14786ca2c52aSchristos   { 0, }, /* 389 is old lstat */
14796ca2c52aSchristos   /* 390 */ { do_getdirentries, "__getdents30" },
14806ca2c52aSchristos   { 0, }, /* 391 is old posix_fadvise */
14816ca2c52aSchristos   { 0, }, /* 392 is old fhstat */
14826ca2c52aSchristos   { 0, }, /* 393 is old ntp_gettime */
14836ca2c52aSchristos   /* 394 */ { 0, "__socket30" },
14846ca2c52aSchristos   /* 395 */ { 0, "__getfh30" },
14856ca2c52aSchristos   /* 396 */ { 0, "__fhopen40" },
14866ca2c52aSchristos   /* 397 */ { 0, "__fhstatvfs140" },
14876ca2c52aSchristos   { 0, }, /* 398 is old fhstat */
14886ca2c52aSchristos   /* 399 */ { 0, "aio_cancel" },
14896ca2c52aSchristos   /* 400 */ { 0, "aio_error" },
14906ca2c52aSchristos   /* 401 */ { 0, "aio_fsync" },
14916ca2c52aSchristos   /* 402 */ { 0, "aio_read" },
14926ca2c52aSchristos   /* 403 */ { 0, "aio_return" },
14936ca2c52aSchristos   { 0, }, /* 404 is old aio_suspend */
14946ca2c52aSchristos   /* 405 */ { 0, "aio_write" },
14956ca2c52aSchristos   /* 406 */ { 0, "lio_listio" },
14966ca2c52aSchristos   { 0, }, /* 407 */
14976ca2c52aSchristos   { 0, }, /* 408 */
14986ca2c52aSchristos   { 0, }, /* 409 */
14996ca2c52aSchristos   /* 410 */ { 0, "__mount50" },
15006ca2c52aSchristos   /* 411 */ { 0, "mremap" },
15016ca2c52aSchristos   /* 412 */ { 0, "pset_create" },
15026ca2c52aSchristos   /* 413 */ { 0, "pset_destroy" },
15036ca2c52aSchristos   /* 414 */ { 0, "pset_assign" },
15046ca2c52aSchristos   /* 415 */ { 0, "_pset_bind" },
15056ca2c52aSchristos   /* 416 */ { 0, "__posix_fadvise50" },
15066ca2c52aSchristos   /* 417 */ { 0, "__select50" },
15076ca2c52aSchristos   /* 418 */ { do_gettimeofday, "__gettimeofday50" },
15086ca2c52aSchristos   /* 419 */ { 0, "__settimeofday50" },
15096ca2c52aSchristos   /* 420 */ { 0, "__utimes50" },
15106ca2c52aSchristos   /* 421 */ { 0, "__adjtime50" },
15116ca2c52aSchristos   /* 422 */ { 0, "__lfs_segwait50" },
15126ca2c52aSchristos   /* 423 */ { 0, "__futimes50" },
15136ca2c52aSchristos   /* 424 */ { 0, "__lutimes50" },
15146ca2c52aSchristos   /* 425 */ { 0, "__setitimer50" },
15156ca2c52aSchristos   /* 426 */ { 0, "__getitimer50" },
15166ca2c52aSchristos   /* 427 */ { 0, "__clock_gettime50" },
15176ca2c52aSchristos   /* 428 */ { 0, "__clock_settime50" },
15186ca2c52aSchristos   /* 429 */ { 0, "__clock_getres50" },
15196ca2c52aSchristos   /* 430 */ { 0, "__nanosleep50" },
15206ca2c52aSchristos   /* 431 */ { 0, "____sigtimedwait50" },
15216ca2c52aSchristos   /* 432 */ { 0, "__mq_timedsend50" },
15226ca2c52aSchristos   /* 433 */ { 0, "__mq_timedreceive50" },
15236ca2c52aSchristos   /* 434 */ { 0, "____lwp_park50" },
15246ca2c52aSchristos   /* 435 */ { 0, "__kevent50" },
15256ca2c52aSchristos   /* 436 */ { 0, "__pselect50" },
15266ca2c52aSchristos   /* 437 */ { 0, "__pollts50" },
15276ca2c52aSchristos   /* 438 */ { 0, "__aio_suspend50" },
15286ca2c52aSchristos   /* 439 */ { do_stat, "__stat50" },
15296ca2c52aSchristos   /* 440 */ { do_fstat, "__fstat50" },
15306ca2c52aSchristos   /* 441 */ { do_lstat, "__lstat50" },
15316ca2c52aSchristos   /* 442 */ { 0, "____semctl50" },
15326ca2c52aSchristos   /* 443 */ { 0, "__shmctl50" },
15336ca2c52aSchristos   /* 444 */ { 0, "__msgctl50" },
15346ca2c52aSchristos   /* 445 */ { do_getrusage, "__getrusage50" },
15356ca2c52aSchristos   /* 446 */ { 0, "__timer_settime50" },
15366ca2c52aSchristos   /* 447 */ { 0, "__timer_gettime50" },
15376ca2c52aSchristos   /* 448 */ { 0, "__ntp_gettime50" },
15386ca2c52aSchristos   /* 449 */ { 0, "__wait450" },
15396ca2c52aSchristos   /* 450 */ { 0, "__mknod50" },
15406ca2c52aSchristos   /* 451 */ { 0, "__fhstat50" },
15416ca2c52aSchristos   { 0, }, /* 452 is obsolete 5.99 __quotactl50 */
15426ca2c52aSchristos   /* 453 */ { 0, "pipe2" },
15436ca2c52aSchristos   /* 454 */ { 0, "dup3" },
15446ca2c52aSchristos   /* 455 */ { 0, "kqueue1" },
15456ca2c52aSchristos   /* 456 */ { 0, "paccept" },
15466ca2c52aSchristos   /* 457 */ { 0, "linkat" },
15476ca2c52aSchristos   /* 458 */ { 0, "renameat" },
15486ca2c52aSchristos   /* 459 */ { 0, "mkfifoat" },
15496ca2c52aSchristos   /* 460 */ { 0, "mknodat" },
15506ca2c52aSchristos   /* 461 */ { 0, "mkdirat" },
15516ca2c52aSchristos   /* 462 */ { 0, "faccessat" },
15526ca2c52aSchristos   /* 463 */ { 0, "fchmodat" },
15536ca2c52aSchristos   /* 464 */ { 0, "fchownat" },
15546ca2c52aSchristos   /* 465 */ { 0, "fexecve" },
15556ca2c52aSchristos   /* 466 */ { 0, "fstatat" },
15566ca2c52aSchristos   /* 467 */ { 0, "utimensat" },
15576ca2c52aSchristos   /* 468 */ { 0, "openat" },
15586ca2c52aSchristos   /* 469 */ { 0, "readlinkat" },
15596ca2c52aSchristos   /* 470 */ { 0, "symlinkat" },
15606ca2c52aSchristos   /* 471 */ { 0, "unlinkat" },
15616ca2c52aSchristos   /* 472 */ { 0, "futimens" },
15626ca2c52aSchristos   /* 473 */ { 0, "__quotactl" },
15636ca2c52aSchristos };
15646ca2c52aSchristos 
15656ca2c52aSchristos static char *(netbsd_error_names[]) = {
15666ca2c52aSchristos   /* 0 */ "ESUCCESS",
15676ca2c52aSchristos   /* 1 */ "EPERM",
15686ca2c52aSchristos   /* 2 */ "ENOENT",
15696ca2c52aSchristos   /* 3 */ "ESRCH",
15706ca2c52aSchristos   /* 4 */ "EINTR",
15716ca2c52aSchristos   /* 5 */ "EIO",
15726ca2c52aSchristos   /* 6 */ "ENXIO",
15736ca2c52aSchristos   /* 7 */ "E2BIG",
15746ca2c52aSchristos   /* 8 */ "ENOEXEC",
15756ca2c52aSchristos   /* 9 */ "EBADF",
15766ca2c52aSchristos   /* 10 */ "ECHILD",
15776ca2c52aSchristos   /* 11 */ "EDEADLK",
15786ca2c52aSchristos   /* 12 */ "ENOMEM",
15796ca2c52aSchristos   /* 13 */ "EACCES",
15806ca2c52aSchristos   /* 14 */ "EFAULT",
15816ca2c52aSchristos   /* 15 */ "ENOTBLK",
15826ca2c52aSchristos   /* 16 */ "EBUSY",
15836ca2c52aSchristos   /* 17 */ "EEXIST",
15846ca2c52aSchristos   /* 18 */ "EXDEV",
15856ca2c52aSchristos   /* 19 */ "ENODEV",
15866ca2c52aSchristos   /* 20 */ "ENOTDIR",
15876ca2c52aSchristos   /* 21 */ "EISDIR",
15886ca2c52aSchristos   /* 22 */ "EINVAL",
15896ca2c52aSchristos   /* 23 */ "ENFILE",
15906ca2c52aSchristos   /* 24 */ "EMFILE",
15916ca2c52aSchristos   /* 25 */ "ENOTTY",
15926ca2c52aSchristos   /* 26 */ "ETXTBSY",
15936ca2c52aSchristos   /* 27 */ "EFBIG",
15946ca2c52aSchristos   /* 28 */ "ENOSPC",
15956ca2c52aSchristos   /* 29 */ "ESPIPE",
15966ca2c52aSchristos   /* 30 */ "EROFS",
15976ca2c52aSchristos   /* 31 */ "EMLINK",
15986ca2c52aSchristos   /* 32 */ "EPIPE",
15996ca2c52aSchristos   /* 33 */ "EDOM",
16006ca2c52aSchristos   /* 34 */ "ERANGE",
16016ca2c52aSchristos   /* 35 */ "EAGAIN",
16026ca2c52aSchristos   /* 36 */ "EINPROGRESS",
16036ca2c52aSchristos   /* 37 */ "EALREADY",
16046ca2c52aSchristos   /* 38 */ "ENOTSOCK",
16056ca2c52aSchristos   /* 39 */ "EDESTADDRREQ",
16066ca2c52aSchristos   /* 40 */ "EMSGSIZE",
16076ca2c52aSchristos   /* 41 */ "EPROTOTYPE",
16086ca2c52aSchristos   /* 42 */ "ENOPROTOOPT",
16096ca2c52aSchristos   /* 43 */ "EPROTONOSUPPORT",
16106ca2c52aSchristos   /* 44 */ "ESOCKTNOSUPPORT",
16116ca2c52aSchristos   /* 45 */ "EOPNOTSUPP",
16126ca2c52aSchristos   /* 46 */ "EPFNOSUPPORT",
16136ca2c52aSchristos   /* 47 */ "EAFNOSUPPORT",
16146ca2c52aSchristos   /* 48 */ "EADDRINUSE",
16156ca2c52aSchristos   /* 49 */ "EADDRNOTAVAIL",
16166ca2c52aSchristos   /* 50 */ "ENETDOWN",
16176ca2c52aSchristos   /* 51 */ "ENETUNREACH",
16186ca2c52aSchristos   /* 52 */ "ENETRESET",
16196ca2c52aSchristos   /* 53 */ "ECONNABORTED",
16206ca2c52aSchristos   /* 54 */ "ECONNRESET",
16216ca2c52aSchristos   /* 55 */ "ENOBUFS",
16226ca2c52aSchristos   /* 56 */ "EISCONN",
16236ca2c52aSchristos   /* 57 */ "ENOTCONN",
16246ca2c52aSchristos   /* 58 */ "ESHUTDOWN",
16256ca2c52aSchristos   /* 59 */ "ETOOMANYREFS",
16266ca2c52aSchristos   /* 60 */ "ETIMEDOUT",
16276ca2c52aSchristos   /* 61 */ "ECONNREFUSED",
16286ca2c52aSchristos   /* 62 */ "ELOOP",
16296ca2c52aSchristos   /* 63 */ "ENAMETOOLONG",
16306ca2c52aSchristos   /* 64 */ "EHOSTDOWN",
16316ca2c52aSchristos   /* 65 */ "EHOSTUNREACH",
16326ca2c52aSchristos   /* 66 */ "ENOTEMPTY",
16336ca2c52aSchristos   /* 67 */ "EPROCLIM",
16346ca2c52aSchristos   /* 68 */ "EUSERS",
16356ca2c52aSchristos   /* 69 */ "EDQUOT",
16366ca2c52aSchristos   /* 70 */ "ESTALE",
16376ca2c52aSchristos   /* 71 */ "EREMOTE",
16386ca2c52aSchristos   /* 72 */ "EBADRPC",
16396ca2c52aSchristos   /* 73 */ "ERPCMISMATCH",
16406ca2c52aSchristos   /* 74 */ "EPROGUNAVAIL",
16416ca2c52aSchristos   /* 75 */ "EPROGMISMATCH",
16426ca2c52aSchristos   /* 76 */ "EPROCUNAVAIL",
16436ca2c52aSchristos   /* 77 */ "ENOLCK",
16446ca2c52aSchristos   /* 78 */ "ENOSYS",
16456ca2c52aSchristos   /* 79 */ "EFTYPE",
16466ca2c52aSchristos   /* 80 */ "EAUTH",
16476ca2c52aSchristos   /* 81 */ "ENEEDAUTH",
16486ca2c52aSchristos   /* 82 */ "EIDRM",
16496ca2c52aSchristos   /* 83 */ "ENOMSG",
16506ca2c52aSchristos   /* 84 */ "EOVERFLOW",
16516ca2c52aSchristos   /* 85 */ "EILSEQ",
16526ca2c52aSchristos   /* 86 */ "ENOTSUP",
16536ca2c52aSchristos   /* 87 */ "ECANCELED",
16546ca2c52aSchristos   /* 88 */ "EBADMSG",
16556ca2c52aSchristos   /* 89 */ "ENODATA",
16566ca2c52aSchristos   /* 90 */ "ENOSR",
16576ca2c52aSchristos   /* 91 */ "ENOSTR",
16586ca2c52aSchristos   /* 92 */ "ETIME",
16596ca2c52aSchristos   /* 93 */ "ENOATTR",
16606ca2c52aSchristos   /* 94 */ "EMULTIHOP",
16616ca2c52aSchristos   /* 95 */ "ENOLINK",
16626ca2c52aSchristos   /* 96 */ "EPROTO",
1663*184b2d41Schristos   /* 97 */ "EOWNERDEAD",
1664*184b2d41Schristos   /* 98 */ "ENOTRECOVERABLE",
1665*184b2d41Schristos   /* 98 */ "ELAST",
16666ca2c52aSchristos };
16676ca2c52aSchristos 
16686ca2c52aSchristos static char *(netbsd_signal_names[]) = {
16696ca2c52aSchristos   /* 0 */ 0,
16706ca2c52aSchristos   /* 1 */ "SIGHUP",
16716ca2c52aSchristos   /* 2 */ "SIGINT",
16726ca2c52aSchristos   /* 3 */ "SIGQUIT",
16736ca2c52aSchristos   /* 4 */ "SIGILL",
16746ca2c52aSchristos   /* 5 */ "SIGTRAP",
16756ca2c52aSchristos   /* 6 */ "SIGABRT",
16766ca2c52aSchristos   /* 7 */ "SIGEMT",
16776ca2c52aSchristos   /* 8 */ "SIGFPE",
16786ca2c52aSchristos   /* 9 */ "SIGKILL",
16796ca2c52aSchristos   /* 10 */ "SIGBUS",
16806ca2c52aSchristos   /* 11 */ "SIGSEGV",
16816ca2c52aSchristos   /* 12 */ "SIGSYS",
16826ca2c52aSchristos   /* 13 */ "SIGPIPE",
16836ca2c52aSchristos   /* 14 */ "SIGALRM",
16846ca2c52aSchristos   /* 15 */ "SIGTERM",
16856ca2c52aSchristos   /* 16 */ "SIGURG",
16866ca2c52aSchristos   /* 17 */ "SIGSTOP",
16876ca2c52aSchristos   /* 18 */ "SIGTSTP",
16886ca2c52aSchristos   /* 19 */ "SIGCONT",
16896ca2c52aSchristos   /* 20 */ "SIGCHLD",
16906ca2c52aSchristos   /* 21 */ "SIGTTIN",
16916ca2c52aSchristos   /* 22 */ "SIGTTOU",
16926ca2c52aSchristos   /* 23 */ "SIGIO",
16936ca2c52aSchristos   /* 24 */ "SIGXCPU",
16946ca2c52aSchristos   /* 25 */ "SIGXFSZ",
16956ca2c52aSchristos   /* 26 */ "SIGVTALRM",
16966ca2c52aSchristos   /* 27 */ "SIGPROF",
16976ca2c52aSchristos   /* 28 */ "SIGWINCH",
16986ca2c52aSchristos   /* 29 */ "SIGINFO",
16996ca2c52aSchristos   /* 30 */ "SIGUSR1",
17006ca2c52aSchristos   /* 31 */ "SIGUSR2",
17016ca2c52aSchristos   /* 32 */ "SIGPWR",
1702*184b2d41Schristos   /* 33 */ "SIGRTMIN",
1703*184b2d41Schristos   /* 34 */ "SIGRTMIN+1",
1704*184b2d41Schristos   /* 35 */ "SIGRTMIN+2",
1705*184b2d41Schristos   /* 36 */ "SIGRTMIN+3",
1706*184b2d41Schristos   /* 37 */ "SIGRTMIN+4",
1707*184b2d41Schristos   /* 38 */ "SIGRTMIN+5",
1708*184b2d41Schristos   /* 39 */ "SIGRTMIN+6",
1709*184b2d41Schristos   /* 40 */ "SIGRTMIN+7",
1710*184b2d41Schristos   /* 41 */ "SIGRTMIN+8",
1711*184b2d41Schristos   /* 42 */ "SIGRTMIN+9",
1712*184b2d41Schristos   /* 43 */ "SIGRTMIN+10",
1713*184b2d41Schristos   /* 44 */ "SIGRTMIN+11",
1714*184b2d41Schristos   /* 45 */ "SIGRTMIN+12",
1715*184b2d41Schristos   /* 46 */ "SIGRTMIN+13",
1716*184b2d41Schristos   /* 47 */ "SIGRTMIN+14",
1717*184b2d41Schristos   /* 48 */ "SIGRTMIN+15",
1718*184b2d41Schristos   /* 49 */ "SIGRTMIN+16",
1719*184b2d41Schristos   /* 50 */ "SIGRTMIN+17",
1720*184b2d41Schristos   /* 51 */ "SIGRTMIN+18",
1721*184b2d41Schristos   /* 52 */ "SIGRTMIN+19",
1722*184b2d41Schristos   /* 53 */ "SIGRTMIN+20",
1723*184b2d41Schristos   /* 54 */ "SIGRTMIN+21",
1724*184b2d41Schristos   /* 55 */ "SIGRTMIN+22",
1725*184b2d41Schristos   /* 56 */ "SIGRTMIN+23",
1726*184b2d41Schristos   /* 57 */ "SIGRTMIN+24",
1727*184b2d41Schristos   /* 58 */ "SIGRTMIN+25",
1728*184b2d41Schristos   /* 59 */ "SIGRTMIN+26",
1729*184b2d41Schristos   /* 60 */ "SIGRTMIN+27",
1730*184b2d41Schristos   /* 61 */ "SIGRTMIN+28",
1731*184b2d41Schristos   /* 62 */ "SIGRTMIN+29",
1732*184b2d41Schristos   /* 63 */ "SIGRTMAX",
17336ca2c52aSchristos };
17346ca2c52aSchristos 
17356ca2c52aSchristos static emul_syscall emul_netbsd_syscalls = {
17366ca2c52aSchristos   netbsd_descriptors,
173715d8e94aSchristos   ARRAY_SIZE (netbsd_descriptors),
17386ca2c52aSchristos   netbsd_error_names,
173915d8e94aSchristos   ARRAY_SIZE (netbsd_error_names),
17406ca2c52aSchristos   netbsd_signal_names,
174115d8e94aSchristos   ARRAY_SIZE (netbsd_signal_names),
17426ca2c52aSchristos };
17436ca2c52aSchristos 
17446ca2c52aSchristos 
17456ca2c52aSchristos /* NetBSD's os_emul interface, most are just passed on to the generic
17466ca2c52aSchristos    syscall stuff */
17476ca2c52aSchristos 
17486ca2c52aSchristos static os_emul_data *
emul_netbsd_create(device * root,bfd * image,const char * name)17496ca2c52aSchristos emul_netbsd_create(device *root,
17506ca2c52aSchristos 		   bfd *image,
17516ca2c52aSchristos 		   const char *name)
17526ca2c52aSchristos {
17536ca2c52aSchristos   unsigned_word top_of_stack;
17546ca2c52aSchristos   unsigned stack_size;
17556ca2c52aSchristos   int elf_binary;
17566ca2c52aSchristos   os_emul_data *bsd_data;
17576ca2c52aSchristos   device *vm;
17586ca2c52aSchristos   char *filename;
17596ca2c52aSchristos 
17606ca2c52aSchristos   /* check that this emulation is really for us */
17616ca2c52aSchristos   if (name != NULL && strcmp(name, "netbsd") != 0)
17626ca2c52aSchristos     return NULL;
17636ca2c52aSchristos   if (image == NULL)
17646ca2c52aSchristos     return NULL;
17656ca2c52aSchristos 
17666ca2c52aSchristos 
17676ca2c52aSchristos   /* merge any emulation specific entries into the device tree */
17686ca2c52aSchristos 
17696ca2c52aSchristos   /* establish a few defaults */
17706ca2c52aSchristos   if (image->xvec->flavour == bfd_target_elf_flavour) {
17716ca2c52aSchristos     elf_binary = 1;
17726ca2c52aSchristos     top_of_stack = 0xe0000000;
17736ca2c52aSchristos     stack_size =   0x00100000;
17746ca2c52aSchristos   }
17756ca2c52aSchristos   else {
17766ca2c52aSchristos     elf_binary = 0;
17776ca2c52aSchristos     top_of_stack = 0x20000000;
17786ca2c52aSchristos     stack_size =   0x00100000;
17796ca2c52aSchristos   }
17806ca2c52aSchristos 
17816ca2c52aSchristos   /* options */
17826ca2c52aSchristos   emul_add_tree_options(root, image, "netbsd",
17836ca2c52aSchristos 			(WITH_ENVIRONMENT == USER_ENVIRONMENT
17846ca2c52aSchristos 			 ? "user" : "virtual"),
17856ca2c52aSchristos 			0 /*oea-interrupt-prefix*/);
17866ca2c52aSchristos 
17876ca2c52aSchristos   /* virtual memory - handles growth of stack/heap */
17886ca2c52aSchristos   vm = tree_parse(root, "/openprom/vm");
17896ca2c52aSchristos   tree_parse(vm, "./stack-base 0x%lx",
17906ca2c52aSchristos 	     (unsigned long)(top_of_stack - stack_size));
17916ca2c52aSchristos   tree_parse(vm, "./nr-bytes 0x%x", stack_size);
17926ca2c52aSchristos 
17936ca2c52aSchristos   filename = tree_quote_property (bfd_get_filename(image));
17946ca2c52aSchristos   tree_parse(root, "/openprom/vm/map-binary/file-name %s",
17956ca2c52aSchristos 	     filename);
17966ca2c52aSchristos   free (filename);
17976ca2c52aSchristos 
17986ca2c52aSchristos   /* finish the init */
17996ca2c52aSchristos   tree_parse(root, "/openprom/init/register/pc 0x%lx",
18006ca2c52aSchristos 	     (unsigned long)bfd_get_start_address(image));
18016ca2c52aSchristos   tree_parse(root, "/openprom/init/register/sp 0x%lx",
18026ca2c52aSchristos 	     (unsigned long)top_of_stack);
18036ca2c52aSchristos   tree_parse(root, "/openprom/init/register/msr 0x%x",
18046ca2c52aSchristos 	     ((tree_find_boolean_property(root, "/options/little-endian?")
18056ca2c52aSchristos 	       ? msr_little_endian_mode
18066ca2c52aSchristos 	       : 0)
18076ca2c52aSchristos 	      | (tree_find_boolean_property(root, "/openprom/options/floating-point?")
18086ca2c52aSchristos 		 ? (msr_floating_point_available
18096ca2c52aSchristos 		    | msr_floating_point_exception_mode_0
18106ca2c52aSchristos 		    | msr_floating_point_exception_mode_1)
18116ca2c52aSchristos 		 : 0)));
18126ca2c52aSchristos   tree_parse(root, "/openprom/init/stack/stack-type %s",
18136ca2c52aSchristos 	     (elf_binary ? "ppc-elf" : "ppc-xcoff"));
18146ca2c52aSchristos 
18156ca2c52aSchristos   /* finally our emulation data */
18166ca2c52aSchristos   bsd_data = ZALLOC(os_emul_data);
18176ca2c52aSchristos   bsd_data->vm = vm;
18186ca2c52aSchristos   bsd_data->syscalls = &emul_netbsd_syscalls;
18196ca2c52aSchristos   return bsd_data;
18206ca2c52aSchristos }
18216ca2c52aSchristos 
18226ca2c52aSchristos static void
emul_netbsd_init(os_emul_data * emul_data,int nr_cpus)18236ca2c52aSchristos emul_netbsd_init(os_emul_data *emul_data,
18246ca2c52aSchristos 		 int nr_cpus)
18256ca2c52aSchristos {
1826b2396a7bSchristos   fd_closed[0] = 0;
1827b2396a7bSchristos   fd_closed[1] = 0;
1828b2396a7bSchristos   fd_closed[2] = 0;
18296ca2c52aSchristos }
18306ca2c52aSchristos 
18316ca2c52aSchristos static void
emul_netbsd_system_call(cpu * processor,unsigned_word cia,os_emul_data * emul_data)18326ca2c52aSchristos emul_netbsd_system_call(cpu *processor,
18336ca2c52aSchristos 			unsigned_word cia,
18346ca2c52aSchristos 			os_emul_data *emul_data)
18356ca2c52aSchristos {
18366ca2c52aSchristos   emul_do_system_call(emul_data,
18376ca2c52aSchristos 		      emul_data->syscalls,
18386ca2c52aSchristos 		      cpu_registers(processor)->gpr[0],
18396ca2c52aSchristos 		      3, /*r3 contains arg0*/
18406ca2c52aSchristos 		      processor,
18416ca2c52aSchristos 		      cia);
18426ca2c52aSchristos }
18436ca2c52aSchristos 
18446ca2c52aSchristos const os_emul emul_netbsd = {
18456ca2c52aSchristos   "netbsd",
18466ca2c52aSchristos   emul_netbsd_create,
18476ca2c52aSchristos   emul_netbsd_init,
18486ca2c52aSchristos   emul_netbsd_system_call,
18496ca2c52aSchristos   0, /*instruction_call*/
18506ca2c52aSchristos   0 /*data*/
18516ca2c52aSchristos };
18526ca2c52aSchristos 
18536ca2c52aSchristos #endif	/* _EMUL_NETBSD_C_ */
1854