Home | History | Annotate | Line # | Download | only in netbsd32
netbsd32_netbsd.c revision 1.90
      1  1.90      cube /*	$NetBSD: netbsd32_netbsd.c,v 1.90 2005/07/04 00:26:06 cube Exp $	*/
      2   1.1       mrg 
      3   1.1       mrg /*
      4  1.57       mrg  * Copyright (c) 1998, 2001 Matthew R. Green
      5   1.1       mrg  * All rights reserved.
      6   1.1       mrg  *
      7   1.1       mrg  * Redistribution and use in source and binary forms, with or without
      8   1.1       mrg  * modification, are permitted provided that the following conditions
      9   1.1       mrg  * are met:
     10   1.1       mrg  * 1. Redistributions of source code must retain the above copyright
     11   1.1       mrg  *    notice, this list of conditions and the following disclaimer.
     12   1.1       mrg  * 2. Redistributions in binary form must reproduce the above copyright
     13   1.1       mrg  *    notice, this list of conditions and the following disclaimer in the
     14   1.1       mrg  *    documentation and/or other materials provided with the distribution.
     15   1.1       mrg  * 3. The name of the author may not be used to endorse or promote products
     16   1.1       mrg  *    derived from this software without specific prior written permission.
     17   1.1       mrg  *
     18   1.1       mrg  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
     19   1.1       mrg  * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
     20   1.1       mrg  * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
     21   1.1       mrg  * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
     22   1.1       mrg  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
     23   1.1       mrg  * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
     24   1.1       mrg  * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
     25   1.1       mrg  * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
     26   1.1       mrg  * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
     27   1.1       mrg  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
     28   1.1       mrg  * SUCH DAMAGE.
     29   1.1       mrg  */
     30  1.62     lukem 
     31  1.62     lukem #include <sys/cdefs.h>
     32  1.90      cube __KERNEL_RCSID(0, "$NetBSD: netbsd32_netbsd.c,v 1.90 2005/07/04 00:26:06 cube Exp $");
     33   1.1       mrg 
     34  1.58       mrg #if defined(_KERNEL_OPT)
     35  1.28       eeh #include "opt_ddb.h"
     36   1.4       eeh #include "opt_ktrace.h"
     37   1.6       eeh #include "opt_ntp.h"
     38  1.20       eeh #include "opt_compat_netbsd.h"
     39   1.7  drochner #include "opt_compat_43.h"
     40  1.20       eeh #include "opt_sysv.h"
     41  1.71    martin #include "opt_nfsserver.h"
     42  1.71    martin #include "opt_syscall_debug.h"
     43   1.7  drochner 
     44   1.6       eeh #include "fs_lfs.h"
     45   1.6       eeh #include "fs_nfs.h"
     46  1.42  jdolecek #endif
     47  1.42  jdolecek 
     48  1.42  jdolecek /*
     49  1.42  jdolecek  * Though COMPAT_OLDSOCK is needed only for COMPAT_43, SunOS, Linux,
     50  1.42  jdolecek  * HP-UX, FreeBSD, Ultrix, OSF1, we define it unconditionally so that
     51  1.42  jdolecek  * this would be LKM-safe.
     52  1.42  jdolecek  */
     53  1.42  jdolecek #define COMPAT_OLDSOCK /* used by <sys/socket.h> */
     54   1.4       eeh 
     55   1.1       mrg #include <sys/param.h>
     56   1.1       mrg #include <sys/systm.h>
     57   1.6       eeh #include <sys/kernel.h>
     58  1.57       mrg //#define msg __msg /* Don't ask me! */
     59   1.1       mrg #include <sys/malloc.h>
     60   1.1       mrg #include <sys/mount.h>
     61   1.1       mrg #include <sys/socket.h>
     62   1.1       mrg #include <sys/sockio.h>
     63   1.6       eeh #include <sys/socketvar.h>
     64   1.6       eeh #include <sys/mbuf.h>
     65   1.1       mrg #include <sys/stat.h>
     66   1.1       mrg #include <sys/time.h>
     67   1.4       eeh #include <sys/signalvar.h>
     68   1.6       eeh #include <sys/ptrace.h>
     69   1.6       eeh #include <sys/ktrace.h>
     70   1.6       eeh #include <sys/trace.h>
     71   1.6       eeh #include <sys/resourcevar.h>
     72   1.6       eeh #include <sys/pool.h>
     73   1.6       eeh #include <sys/vnode.h>
     74   1.6       eeh #include <sys/file.h>
     75   1.6       eeh #include <sys/filedesc.h>
     76   1.6       eeh #include <sys/namei.h>
     77  1.29       mrg 
     78  1.29       mrg #include <uvm/uvm_extern.h>
     79  1.29       mrg 
     80  1.70   thorpej #include <sys/sa.h>
     81   1.1       mrg #include <sys/syscallargs.h>
     82   1.6       eeh #include <sys/proc.h>
     83  1.20       eeh #include <sys/acct.h>
     84  1.20       eeh #include <sys/exec.h>
     85   1.1       mrg 
     86   1.1       mrg #include <net/if.h>
     87   1.1       mrg 
     88  1.10       mrg #include <compat/netbsd32/netbsd32.h>
     89  1.75  christos #include <compat/netbsd32/netbsd32_exec.h>
     90  1.42  jdolecek #include <compat/netbsd32/netbsd32_syscall.h>
     91  1.10       mrg #include <compat/netbsd32/netbsd32_syscallargs.h>
     92  1.56       mrg #include <compat/netbsd32/netbsd32_conv.h>
     93   1.1       mrg 
     94   1.4       eeh #include <machine/frame.h>
     95  1.28       eeh 
     96  1.28       eeh #if defined(DDB)
     97  1.28       eeh #include <ddb/ddbvar.h>
     98  1.28       eeh #endif
     99   1.4       eeh 
    100  1.42  jdolecek extern struct sysent netbsd32_sysent[];
    101  1.42  jdolecek #ifdef SYSCALL_DEBUG
    102  1.42  jdolecek extern const char * const netbsd32_syscallnames[];
    103  1.42  jdolecek #endif
    104  1.46   mycroft #ifdef __HAVE_SYSCALL_INTERN
    105  1.60      fvdl void netbsd32_syscall_intern __P((struct proc *));
    106  1.46   mycroft #else
    107  1.45  jdolecek void syscall __P((void));
    108  1.46   mycroft #endif
    109  1.42  jdolecek 
    110  1.82  drochner #ifdef COMPAT_16
    111  1.82  drochner extern char netbsd32_sigcode[], netbsd32_esigcode[];
    112  1.74       chs struct uvm_object *emul_netbsd32_object;
    113  1.82  drochner #endif
    114  1.82  drochner 
    115  1.77    atatat extern struct sysctlnode netbsd32_sysctl_root;
    116  1.74       chs 
    117  1.42  jdolecek const struct emul emul_netbsd32 = {
    118  1.42  jdolecek 	"netbsd32",
    119  1.42  jdolecek 	"/emul/netbsd32",
    120  1.46   mycroft #ifndef __HAVE_MINIMAL_EMUL
    121  1.46   mycroft 	0,
    122  1.42  jdolecek 	NULL,
    123  1.42  jdolecek 	netbsd32_SYS_syscall,
    124  1.67  jdolecek 	netbsd32_SYS_NSYSENT,
    125  1.46   mycroft #endif
    126  1.42  jdolecek 	netbsd32_sysent,
    127  1.42  jdolecek #ifdef SYSCALL_DEBUG
    128  1.42  jdolecek 	netbsd32_syscallnames,
    129  1.42  jdolecek #else
    130  1.42  jdolecek 	NULL,
    131  1.42  jdolecek #endif
    132  1.46   mycroft 	netbsd32_sendsig,
    133  1.59  christos 	trapsignal,
    134  1.80      fvdl 	NULL,
    135  1.82  drochner #ifdef COMPAT_16
    136  1.42  jdolecek 	netbsd32_sigcode,
    137  1.42  jdolecek 	netbsd32_esigcode,
    138  1.74       chs 	&emul_netbsd32_object,
    139  1.82  drochner #else
    140  1.82  drochner 	NULL,
    141  1.82  drochner 	NULL,
    142  1.82  drochner 	NULL,
    143  1.82  drochner #endif
    144  1.61  jdolecek 	netbsd32_setregs,
    145  1.45  jdolecek 	NULL,
    146  1.45  jdolecek 	NULL,
    147  1.45  jdolecek 	NULL,
    148  1.79      manu 	NULL,
    149  1.79      manu 	NULL,
    150  1.46   mycroft #ifdef __HAVE_SYSCALL_INTERN
    151  1.60      fvdl 	netbsd32_syscall_intern,
    152  1.46   mycroft #else
    153  1.46   mycroft 	syscall,
    154  1.46   mycroft #endif
    155  1.77    atatat 	&netbsd32_sysctl_root,
    156  1.65      manu 	NULL,
    157  1.88      fvdl 
    158  1.88      fvdl 	netbsd32_vm_default_addr,
    159  1.42  jdolecek };
    160  1.42  jdolecek 
    161   1.1       mrg /*
    162   1.1       mrg  * below are all the standard NetBSD system calls, in the 32bit
    163  1.32       mrg  * environment, with the necessary conversions to 64bit before
    164  1.57       mrg  * calling the real syscall.  anything that needs special
    165  1.57       mrg  * attention is handled elsewhere.
    166   1.1       mrg  */
    167   1.1       mrg 
    168   1.6       eeh int
    169  1.70   thorpej netbsd32_exit(l, v, retval)
    170  1.70   thorpej 	struct lwp *l;
    171   1.6       eeh 	void *v;
    172   1.6       eeh 	register_t *retval;
    173   1.6       eeh {
    174  1.19       eeh 	struct netbsd32_exit_args /* {
    175   1.6       eeh 		syscallarg(int) rval;
    176   1.6       eeh 	} */ *uap = v;
    177   1.6       eeh 	struct sys_exit_args ua;
    178   1.6       eeh 
    179  1.11       mrg 	NETBSD32TO64_UAP(rval);
    180  1.70   thorpej 	return sys_exit(l, &ua, retval);
    181   1.6       eeh }
    182   1.6       eeh 
    183   1.1       mrg int
    184  1.70   thorpej netbsd32_read(l, v, retval)
    185  1.70   thorpej 	struct lwp *l;
    186   1.1       mrg 	void *v;
    187   1.1       mrg 	register_t *retval;
    188   1.1       mrg {
    189  1.19       eeh 	struct netbsd32_read_args /* {
    190   1.1       mrg 		syscallarg(int) fd;
    191  1.10       mrg 		syscallarg(netbsd32_voidp) buf;
    192  1.10       mrg 		syscallarg(netbsd32_size_t) nbyte;
    193   1.1       mrg 	} */ *uap = v;
    194   1.1       mrg 	struct sys_read_args ua;
    195   1.1       mrg 
    196  1.11       mrg 	NETBSD32TO64_UAP(fd);
    197  1.11       mrg 	NETBSD32TOP_UAP(buf, void *);
    198  1.11       mrg 	NETBSD32TOX_UAP(nbyte, size_t);
    199  1.70   thorpej 	return sys_read(l, &ua, retval);
    200   1.1       mrg }
    201   1.1       mrg 
    202   1.1       mrg int
    203  1.70   thorpej netbsd32_write(l, v, retval)
    204  1.70   thorpej 	struct lwp *l;
    205   1.1       mrg 	void *v;
    206   1.1       mrg 	register_t *retval;
    207   1.1       mrg {
    208  1.19       eeh 	struct netbsd32_write_args /* {
    209   1.1       mrg 		syscallarg(int) fd;
    210  1.10       mrg 		syscallarg(const netbsd32_voidp) buf;
    211  1.10       mrg 		syscallarg(netbsd32_size_t) nbyte;
    212   1.1       mrg 	} */ *uap = v;
    213   1.1       mrg 	struct sys_write_args ua;
    214   1.1       mrg 
    215  1.11       mrg 	NETBSD32TO64_UAP(fd);
    216  1.11       mrg 	NETBSD32TOP_UAP(buf, void *);
    217  1.11       mrg 	NETBSD32TOX_UAP(nbyte, size_t);
    218  1.70   thorpej 	return sys_write(l, &ua, retval);
    219   1.6       eeh }
    220   1.6       eeh 
    221   1.6       eeh int
    222  1.70   thorpej netbsd32_close(l, v, retval)
    223  1.70   thorpej 	struct lwp *l;
    224   1.6       eeh 	void *v;
    225   1.6       eeh 	register_t *retval;
    226   1.6       eeh {
    227  1.19       eeh 	struct netbsd32_close_args /* {
    228   1.6       eeh 		syscallarg(int) fd;
    229   1.6       eeh 	} */ *uap = v;
    230   1.6       eeh 	struct sys_close_args ua;
    231   1.1       mrg 
    232  1.11       mrg 	NETBSD32TO64_UAP(fd);
    233  1.70   thorpej 	return sys_close(l, &ua, retval);
    234   1.1       mrg }
    235   1.1       mrg 
    236   1.1       mrg int
    237  1.70   thorpej netbsd32_open(l, v, retval)
    238  1.70   thorpej 	struct lwp *l;
    239   1.1       mrg 	void *v;
    240   1.1       mrg 	register_t *retval;
    241   1.1       mrg {
    242  1.19       eeh 	struct netbsd32_open_args /* {
    243  1.10       mrg 		syscallarg(const netbsd32_charp) path;
    244   1.1       mrg 		syscallarg(int) flags;
    245   1.1       mrg 		syscallarg(mode_t) mode;
    246   1.1       mrg 	} */ *uap = v;
    247   1.1       mrg 	struct sys_open_args ua;
    248   1.1       mrg 	caddr_t sg;
    249   1.1       mrg 
    250  1.11       mrg 	NETBSD32TOP_UAP(path, const char);
    251  1.11       mrg 	NETBSD32TO64_UAP(flags);
    252  1.11       mrg 	NETBSD32TO64_UAP(mode);
    253  1.70   thorpej 	sg = stackgap_init(l->l_proc, 0);
    254  1.73      fvdl 	CHECK_ALT_EXIST(l->l_proc, &sg, SCARG(&ua, path));
    255   1.1       mrg 
    256  1.70   thorpej 	return (sys_open(l, &ua, retval));
    257   1.1       mrg }
    258   1.1       mrg 
    259   1.1       mrg int
    260  1.70   thorpej netbsd32_link(l, v, retval)
    261  1.70   thorpej 	struct lwp *l;
    262   1.1       mrg 	void *v;
    263   1.1       mrg 	register_t *retval;
    264   1.1       mrg {
    265  1.19       eeh 	struct netbsd32_link_args /* {
    266  1.10       mrg 		syscallarg(const netbsd32_charp) path;
    267  1.10       mrg 		syscallarg(const netbsd32_charp) link;
    268   1.1       mrg 	} */ *uap = v;
    269   1.1       mrg 	struct sys_link_args ua;
    270   1.1       mrg 
    271  1.11       mrg 	NETBSD32TOP_UAP(path, const char);
    272  1.11       mrg 	NETBSD32TOP_UAP(link, const char);
    273  1.70   thorpej 	return (sys_link(l, &ua, retval));
    274   1.1       mrg }
    275   1.1       mrg 
    276   1.1       mrg int
    277  1.70   thorpej netbsd32_unlink(l, v, retval)
    278  1.70   thorpej 	struct lwp *l;
    279   1.1       mrg 	void *v;
    280   1.1       mrg 	register_t *retval;
    281   1.1       mrg {
    282  1.19       eeh 	struct netbsd32_unlink_args /* {
    283  1.10       mrg 		syscallarg(const netbsd32_charp) path;
    284   1.1       mrg 	} */ *uap = v;
    285   1.1       mrg 	struct sys_unlink_args ua;
    286   1.1       mrg 
    287  1.11       mrg 	NETBSD32TOP_UAP(path, const char);
    288   1.1       mrg 
    289  1.70   thorpej 	return (sys_unlink(l, &ua, retval));
    290   1.1       mrg }
    291   1.1       mrg 
    292   1.1       mrg int
    293  1.70   thorpej netbsd32_chdir(l, v, retval)
    294  1.70   thorpej 	struct lwp *l;
    295   1.1       mrg 	void *v;
    296   1.1       mrg 	register_t *retval;
    297   1.1       mrg {
    298  1.19       eeh 	struct netbsd32_chdir_args /* {
    299  1.10       mrg 		syscallarg(const netbsd32_charp) path;
    300   1.1       mrg 	} */ *uap = v;
    301   1.1       mrg 	struct sys_chdir_args ua;
    302   1.1       mrg 
    303  1.11       mrg 	NETBSD32TOP_UAP(path, const char);
    304   1.1       mrg 
    305  1.70   thorpej 	return (sys_chdir(l, &ua, retval));
    306   1.1       mrg }
    307   1.1       mrg 
    308   1.1       mrg int
    309  1.70   thorpej netbsd32_fchdir(l, v, retval)
    310  1.70   thorpej 	struct lwp *l;
    311   1.6       eeh 	void *v;
    312   1.6       eeh 	register_t *retval;
    313   1.6       eeh {
    314  1.19       eeh 	struct netbsd32_fchdir_args /* {
    315   1.6       eeh 		syscallarg(int) fd;
    316   1.6       eeh 	} */ *uap = v;
    317   1.6       eeh 	struct sys_fchdir_args ua;
    318   1.6       eeh 
    319  1.11       mrg 	NETBSD32TO64_UAP(fd);
    320   1.6       eeh 
    321  1.70   thorpej 	return (sys_fchdir(l, &ua, retval));
    322   1.6       eeh }
    323   1.6       eeh 
    324   1.6       eeh int
    325  1.70   thorpej netbsd32_mknod(l, v, retval)
    326  1.70   thorpej 	struct lwp *l;
    327   1.1       mrg 	void *v;
    328   1.1       mrg 	register_t *retval;
    329   1.1       mrg {
    330  1.19       eeh 	struct netbsd32_mknod_args /* {
    331  1.10       mrg 		syscallarg(const netbsd32_charp) path;
    332   1.1       mrg 		syscallarg(mode_t) mode;
    333   1.1       mrg 		syscallarg(dev_t) dev;
    334   1.1       mrg 	} */ *uap = v;
    335   1.1       mrg 	struct sys_mknod_args ua;
    336   1.1       mrg 
    337  1.11       mrg 	NETBSD32TOP_UAP(path, const char);
    338  1.11       mrg 	NETBSD32TO64_UAP(dev);
    339  1.11       mrg 	NETBSD32TO64_UAP(mode);
    340   1.1       mrg 
    341  1.70   thorpej 	return (sys_mknod(l, &ua, retval));
    342   1.1       mrg }
    343   1.1       mrg 
    344   1.1       mrg int
    345  1.70   thorpej netbsd32_chmod(l, v, retval)
    346  1.70   thorpej 	struct lwp *l;
    347   1.1       mrg 	void *v;
    348   1.1       mrg 	register_t *retval;
    349   1.1       mrg {
    350  1.19       eeh 	struct netbsd32_chmod_args /* {
    351  1.10       mrg 		syscallarg(const netbsd32_charp) path;
    352   1.1       mrg 		syscallarg(mode_t) mode;
    353   1.1       mrg 	} */ *uap = v;
    354   1.1       mrg 	struct sys_chmod_args ua;
    355   1.1       mrg 
    356  1.11       mrg 	NETBSD32TOP_UAP(path, const char);
    357  1.11       mrg 	NETBSD32TO64_UAP(mode);
    358   1.1       mrg 
    359  1.70   thorpej 	return (sys_chmod(l, &ua, retval));
    360   1.1       mrg }
    361   1.1       mrg 
    362   1.1       mrg int
    363  1.70   thorpej netbsd32_chown(l, v, retval)
    364  1.70   thorpej 	struct lwp *l;
    365   1.1       mrg 	void *v;
    366   1.1       mrg 	register_t *retval;
    367   1.1       mrg {
    368  1.19       eeh 	struct netbsd32_chown_args /* {
    369  1.10       mrg 		syscallarg(const netbsd32_charp) path;
    370   1.1       mrg 		syscallarg(uid_t) uid;
    371   1.1       mrg 		syscallarg(gid_t) gid;
    372   1.1       mrg 	} */ *uap = v;
    373   1.1       mrg 	struct sys_chown_args ua;
    374   1.1       mrg 
    375  1.11       mrg 	NETBSD32TOP_UAP(path, const char);
    376  1.11       mrg 	NETBSD32TO64_UAP(uid);
    377  1.11       mrg 	NETBSD32TO64_UAP(gid);
    378   1.1       mrg 
    379  1.70   thorpej 	return (sys_chown(l, &ua, retval));
    380   1.1       mrg }
    381   1.1       mrg 
    382   1.1       mrg int
    383  1.70   thorpej netbsd32_break(l, v, retval)
    384  1.70   thorpej 	struct lwp *l;
    385   1.1       mrg 	void *v;
    386   1.1       mrg 	register_t *retval;
    387   1.1       mrg {
    388  1.19       eeh 	struct netbsd32_break_args /* {
    389  1.10       mrg 		syscallarg(netbsd32_charp) nsize;
    390   1.1       mrg 	} */ *uap = v;
    391   1.1       mrg 	struct sys_obreak_args ua;
    392   1.1       mrg 
    393  1.66       scw 	SCARG(&ua, nsize) = (char *)NETBSD32PTR64(SCARG(uap, nsize));
    394  1.11       mrg 	NETBSD32TOP_UAP(nsize, char);
    395  1.70   thorpej 	return (sys_obreak(l, &ua, retval));
    396   1.1       mrg }
    397   1.1       mrg 
    398   1.1       mrg int
    399  1.70   thorpej netbsd32_mount(l, v, retval)
    400  1.70   thorpej 	struct lwp *l;
    401   1.1       mrg 	void *v;
    402   1.1       mrg 	register_t *retval;
    403   1.1       mrg {
    404  1.19       eeh 	struct netbsd32_mount_args /* {
    405  1.10       mrg 		syscallarg(const netbsd32_charp) type;
    406  1.10       mrg 		syscallarg(const netbsd32_charp) path;
    407   1.1       mrg 		syscallarg(int) flags;
    408  1.10       mrg 		syscallarg(netbsd32_voidp) data;
    409   1.1       mrg 	} */ *uap = v;
    410   1.1       mrg 	struct sys_mount_args ua;
    411   1.1       mrg 
    412  1.11       mrg 	NETBSD32TOP_UAP(type, const char);
    413  1.11       mrg 	NETBSD32TOP_UAP(path, const char);
    414  1.11       mrg 	NETBSD32TO64_UAP(flags);
    415  1.11       mrg 	NETBSD32TOP_UAP(data, void);
    416  1.70   thorpej 	return (sys_mount(l, &ua, retval));
    417   1.1       mrg }
    418   1.1       mrg 
    419   1.1       mrg int
    420  1.70   thorpej netbsd32_unmount(l, v, retval)
    421  1.70   thorpej 	struct lwp *l;
    422   1.1       mrg 	void *v;
    423   1.1       mrg 	register_t *retval;
    424   1.1       mrg {
    425  1.19       eeh 	struct netbsd32_unmount_args /* {
    426  1.10       mrg 		syscallarg(const netbsd32_charp) path;
    427   1.1       mrg 		syscallarg(int) flags;
    428   1.1       mrg 	} */ *uap = v;
    429   1.1       mrg 	struct sys_unmount_args ua;
    430   1.1       mrg 
    431  1.11       mrg 	NETBSD32TOP_UAP(path, const char);
    432  1.11       mrg 	NETBSD32TO64_UAP(flags);
    433  1.70   thorpej 	return (sys_unmount(l, &ua, retval));
    434   1.1       mrg }
    435   1.1       mrg 
    436   1.1       mrg int
    437  1.70   thorpej netbsd32_setuid(l, v, retval)
    438  1.70   thorpej 	struct lwp *l;
    439   1.6       eeh 	void *v;
    440   1.6       eeh 	register_t *retval;
    441   1.6       eeh {
    442  1.19       eeh 	struct netbsd32_setuid_args /* {
    443   1.6       eeh 		syscallarg(uid_t) uid;
    444   1.6       eeh 	} */ *uap = v;
    445   1.6       eeh 	struct sys_setuid_args ua;
    446   1.6       eeh 
    447  1.11       mrg 	NETBSD32TO64_UAP(uid);
    448  1.70   thorpej 	return (sys_setuid(l, &ua, retval));
    449   1.6       eeh }
    450   1.6       eeh 
    451   1.6       eeh int
    452  1.70   thorpej netbsd32_ptrace(l, v, retval)
    453  1.70   thorpej 	struct lwp *l;
    454   1.1       mrg 	void *v;
    455   1.1       mrg 	register_t *retval;
    456   1.1       mrg {
    457  1.19       eeh 	struct netbsd32_ptrace_args /* {
    458   1.1       mrg 		syscallarg(int) req;
    459   1.1       mrg 		syscallarg(pid_t) pid;
    460  1.10       mrg 		syscallarg(netbsd32_caddr_t) addr;
    461   1.1       mrg 		syscallarg(int) data;
    462   1.1       mrg 	} */ *uap = v;
    463   1.1       mrg 	struct sys_ptrace_args ua;
    464   1.1       mrg 
    465  1.11       mrg 	NETBSD32TO64_UAP(req);
    466  1.11       mrg 	NETBSD32TO64_UAP(pid);
    467  1.11       mrg 	NETBSD32TOX64_UAP(addr, caddr_t);
    468  1.11       mrg 	NETBSD32TO64_UAP(data);
    469  1.70   thorpej 	return (sys_ptrace(l, &ua, retval));
    470   1.1       mrg }
    471   1.1       mrg 
    472   1.1       mrg int
    473  1.70   thorpej netbsd32_accept(l, v, retval)
    474  1.70   thorpej 	struct lwp *l;
    475   1.1       mrg 	void *v;
    476   1.1       mrg 	register_t *retval;
    477   1.1       mrg {
    478  1.19       eeh 	struct netbsd32_accept_args /* {
    479   1.1       mrg 		syscallarg(int) s;
    480  1.10       mrg 		syscallarg(netbsd32_sockaddrp_t) name;
    481  1.10       mrg 		syscallarg(netbsd32_intp) anamelen;
    482   1.1       mrg 	} */ *uap = v;
    483   1.1       mrg 	struct sys_accept_args ua;
    484   1.1       mrg 
    485  1.11       mrg 	NETBSD32TO64_UAP(s);
    486  1.11       mrg 	NETBSD32TOP_UAP(name, struct sockaddr);
    487  1.11       mrg 	NETBSD32TOP_UAP(anamelen, int);
    488  1.70   thorpej 	return (sys_accept(l, &ua, retval));
    489   1.1       mrg }
    490   1.1       mrg 
    491   1.1       mrg int
    492  1.70   thorpej netbsd32_getpeername(l, v, retval)
    493  1.70   thorpej 	struct lwp *l;
    494   1.1       mrg 	void *v;
    495   1.1       mrg 	register_t *retval;
    496   1.1       mrg {
    497  1.19       eeh 	struct netbsd32_getpeername_args /* {
    498   1.1       mrg 		syscallarg(int) fdes;
    499  1.10       mrg 		syscallarg(netbsd32_sockaddrp_t) asa;
    500  1.10       mrg 		syscallarg(netbsd32_intp) alen;
    501   1.1       mrg 	} */ *uap = v;
    502   1.1       mrg 	struct sys_getpeername_args ua;
    503   1.1       mrg 
    504  1.11       mrg 	NETBSD32TO64_UAP(fdes);
    505  1.11       mrg 	NETBSD32TOP_UAP(asa, struct sockaddr);
    506  1.11       mrg 	NETBSD32TOP_UAP(alen, int);
    507   1.6       eeh /* NB: do the protocol specific sockaddrs need to be converted? */
    508  1.70   thorpej 	return (sys_getpeername(l, &ua, retval));
    509   1.1       mrg }
    510   1.1       mrg 
    511   1.1       mrg int
    512  1.70   thorpej netbsd32_getsockname(l, v, retval)
    513  1.70   thorpej 	struct lwp *l;
    514   1.1       mrg 	void *v;
    515   1.1       mrg 	register_t *retval;
    516   1.1       mrg {
    517  1.19       eeh 	struct netbsd32_getsockname_args /* {
    518   1.1       mrg 		syscallarg(int) fdes;
    519  1.10       mrg 		syscallarg(netbsd32_sockaddrp_t) asa;
    520  1.10       mrg 		syscallarg(netbsd32_intp) alen;
    521   1.1       mrg 	} */ *uap = v;
    522   1.1       mrg 	struct sys_getsockname_args ua;
    523   1.1       mrg 
    524  1.11       mrg 	NETBSD32TO64_UAP(fdes);
    525  1.11       mrg 	NETBSD32TOP_UAP(asa, struct sockaddr);
    526  1.11       mrg 	NETBSD32TOP_UAP(alen, int);
    527  1.70   thorpej 	return (sys_getsockname(l, &ua, retval));
    528   1.1       mrg }
    529   1.1       mrg 
    530   1.1       mrg int
    531  1.70   thorpej netbsd32_access(l, v, retval)
    532  1.70   thorpej 	struct lwp *l;
    533   1.1       mrg 	void *v;
    534   1.1       mrg 	register_t *retval;
    535   1.1       mrg {
    536  1.19       eeh 	struct netbsd32_access_args /* {
    537  1.10       mrg 		syscallarg(const netbsd32_charp) path;
    538   1.1       mrg 		syscallarg(int) flags;
    539   1.1       mrg 	} */ *uap = v;
    540   1.1       mrg 	struct sys_access_args ua;
    541   1.1       mrg 	caddr_t sg;
    542   1.1       mrg 
    543  1.11       mrg 	NETBSD32TOP_UAP(path, const char);
    544  1.11       mrg 	NETBSD32TO64_UAP(flags);
    545  1.70   thorpej 	sg = stackgap_init(l->l_proc, 0);
    546  1.73      fvdl 	CHECK_ALT_EXIST(l->l_proc, &sg, SCARG(&ua, path));
    547   1.1       mrg 
    548  1.70   thorpej 	return (sys_access(l, &ua, retval));
    549   1.1       mrg }
    550   1.1       mrg 
    551   1.1       mrg int
    552  1.70   thorpej netbsd32_chflags(l, v, retval)
    553  1.70   thorpej 	struct lwp *l;
    554   1.1       mrg 	void *v;
    555   1.1       mrg 	register_t *retval;
    556   1.1       mrg {
    557  1.19       eeh 	struct netbsd32_chflags_args /* {
    558  1.10       mrg 		syscallarg(const netbsd32_charp) path;
    559  1.10       mrg 		syscallarg(netbsd32_u_long) flags;
    560   1.1       mrg 	} */ *uap = v;
    561   1.1       mrg 	struct sys_chflags_args ua;
    562   1.1       mrg 
    563  1.11       mrg 	NETBSD32TOP_UAP(path, const char);
    564  1.11       mrg 	NETBSD32TO64_UAP(flags);
    565   1.1       mrg 
    566  1.70   thorpej 	return (sys_chflags(l, &ua, retval));
    567   1.1       mrg }
    568   1.1       mrg 
    569   1.1       mrg int
    570  1.70   thorpej netbsd32_fchflags(l, v, retval)
    571  1.70   thorpej 	struct lwp *l;
    572   1.1       mrg 	void *v;
    573   1.1       mrg 	register_t *retval;
    574   1.1       mrg {
    575  1.19       eeh 	struct netbsd32_fchflags_args /* {
    576   1.1       mrg 		syscallarg(int) fd;
    577  1.10       mrg 		syscallarg(netbsd32_u_long) flags;
    578   1.1       mrg 	} */ *uap = v;
    579   1.1       mrg 	struct sys_fchflags_args ua;
    580   1.1       mrg 
    581  1.11       mrg 	NETBSD32TO64_UAP(fd);
    582  1.11       mrg 	NETBSD32TO64_UAP(flags);
    583   1.1       mrg 
    584  1.70   thorpej 	return (sys_fchflags(l, &ua, retval));
    585   1.1       mrg }
    586   1.1       mrg 
    587   1.1       mrg int
    588  1.70   thorpej netbsd32_lchflags(l, v, retval)
    589  1.70   thorpej 	struct lwp *l;
    590  1.50       mrg 	void *v;
    591  1.50       mrg 	register_t *retval;
    592  1.50       mrg {
    593  1.50       mrg 	struct netbsd32_lchflags_args /* {
    594  1.81       mrg 		syscallarg(const char *) path;
    595  1.50       mrg 		syscallarg(netbsd32_u_long) flags;
    596  1.50       mrg 	} */ *uap = v;
    597  1.50       mrg 	struct sys_lchflags_args ua;
    598  1.50       mrg 
    599  1.50       mrg 	NETBSD32TOP_UAP(path, const char);
    600  1.50       mrg 	NETBSD32TO64_UAP(flags);
    601  1.50       mrg 
    602  1.70   thorpej 	return (sys_lchflags(l, &ua, retval));
    603  1.50       mrg }
    604  1.50       mrg 
    605  1.50       mrg int
    606  1.70   thorpej netbsd32_kill(l, v, retval)
    607  1.70   thorpej 	struct lwp *l;
    608   1.6       eeh 	void *v;
    609   1.6       eeh 	register_t *retval;
    610   1.6       eeh {
    611  1.19       eeh 	struct netbsd32_kill_args /* {
    612   1.6       eeh 		syscallarg(int) pid;
    613   1.6       eeh 		syscallarg(int) signum;
    614   1.6       eeh 	} */ *uap = v;
    615   1.6       eeh 	struct sys_kill_args ua;
    616   1.6       eeh 
    617  1.11       mrg 	NETBSD32TO64_UAP(pid);
    618  1.11       mrg 	NETBSD32TO64_UAP(signum);
    619   1.6       eeh 
    620  1.70   thorpej 	return (sys_kill(l, &ua, retval));
    621   1.6       eeh }
    622   1.6       eeh 
    623   1.6       eeh int
    624  1.70   thorpej netbsd32_dup(l, v, retval)
    625  1.70   thorpej 	struct lwp *l;
    626   1.6       eeh 	void *v;
    627   1.6       eeh 	register_t *retval;
    628   1.6       eeh {
    629  1.19       eeh 	struct netbsd32_dup_args /* {
    630   1.6       eeh 		syscallarg(int) fd;
    631   1.6       eeh 	} */ *uap = v;
    632   1.6       eeh 	struct sys_dup_args ua;
    633   1.6       eeh 
    634  1.11       mrg 	NETBSD32TO64_UAP(fd);
    635   1.6       eeh 
    636  1.70   thorpej 	return (sys_dup(l, &ua, retval));
    637   1.6       eeh }
    638   1.6       eeh 
    639   1.6       eeh int
    640  1.70   thorpej netbsd32_profil(l, v, retval)
    641  1.70   thorpej 	struct lwp *l;
    642   1.1       mrg 	void *v;
    643   1.1       mrg 	register_t *retval;
    644   1.1       mrg {
    645  1.19       eeh 	struct netbsd32_profil_args /* {
    646  1.10       mrg 		syscallarg(netbsd32_caddr_t) samples;
    647  1.10       mrg 		syscallarg(netbsd32_size_t) size;
    648  1.10       mrg 		syscallarg(netbsd32_u_long) offset;
    649   1.1       mrg 		syscallarg(u_int) scale;
    650   1.1       mrg 	} */ *uap = v;
    651   1.1       mrg 	struct sys_profil_args ua;
    652   1.1       mrg 
    653  1.11       mrg 	NETBSD32TOX64_UAP(samples, caddr_t);
    654  1.11       mrg 	NETBSD32TOX_UAP(size, size_t);
    655  1.11       mrg 	NETBSD32TOX_UAP(offset, u_long);
    656  1.11       mrg 	NETBSD32TO64_UAP(scale);
    657  1.70   thorpej 	return (sys_profil(l, &ua, retval));
    658   1.1       mrg }
    659   1.1       mrg 
    660  1.42  jdolecek #ifdef KTRACE
    661   1.1       mrg int
    662  1.70   thorpej netbsd32_ktrace(l, v, retval)
    663  1.70   thorpej 	struct lwp *l;
    664   1.1       mrg 	void *v;
    665   1.1       mrg 	register_t *retval;
    666   1.1       mrg {
    667  1.19       eeh 	struct netbsd32_ktrace_args /* {
    668  1.10       mrg 		syscallarg(const netbsd32_charp) fname;
    669   1.1       mrg 		syscallarg(int) ops;
    670   1.1       mrg 		syscallarg(int) facs;
    671   1.1       mrg 		syscallarg(int) pid;
    672   1.1       mrg 	} */ *uap = v;
    673   1.1       mrg 	struct sys_ktrace_args ua;
    674   1.1       mrg 
    675  1.11       mrg 	NETBSD32TOP_UAP(fname, const char);
    676  1.11       mrg 	NETBSD32TO64_UAP(ops);
    677  1.11       mrg 	NETBSD32TO64_UAP(facs);
    678  1.11       mrg 	NETBSD32TO64_UAP(pid);
    679  1.70   thorpej 	return (sys_ktrace(l, &ua, retval));
    680   1.1       mrg }
    681  1.42  jdolecek #endif /* KTRACE */
    682  1.50       mrg 
    683  1.50       mrg int
    684  1.70   thorpej netbsd32_utrace(l, v, retval)
    685  1.70   thorpej 	struct lwp *l;
    686  1.50       mrg 	void *v;
    687  1.50       mrg 	register_t *retval;
    688  1.50       mrg {
    689  1.50       mrg 	struct netbsd32_utrace_args /* {
    690  1.50       mrg 		syscallarg(const netbsd32_charp) label;
    691  1.50       mrg 		syscallarg(netbsd32_voidp) addr;
    692  1.50       mrg 		syscallarg(netbsd32_size_t) len;
    693  1.50       mrg 	} */ *uap = v;
    694  1.50       mrg 	struct sys_utrace_args ua;
    695  1.50       mrg 
    696  1.50       mrg 	NETBSD32TOP_UAP(label, const char);
    697  1.50       mrg 	NETBSD32TOP_UAP(addr, void);
    698  1.50       mrg 	NETBSD32TO64_UAP(len);
    699  1.70   thorpej 	return (sys_utrace(l, &ua, retval));
    700  1.50       mrg }
    701   1.1       mrg 
    702   1.1       mrg int
    703  1.70   thorpej netbsd32___getlogin(l, v, retval)
    704  1.70   thorpej 	struct lwp *l;
    705   1.1       mrg 	void *v;
    706   1.1       mrg 	register_t *retval;
    707   1.1       mrg {
    708  1.19       eeh 	struct netbsd32___getlogin_args /* {
    709  1.10       mrg 		syscallarg(netbsd32_charp) namebuf;
    710   1.1       mrg 		syscallarg(u_int) namelen;
    711   1.1       mrg 	} */ *uap = v;
    712   1.1       mrg 	struct sys___getlogin_args ua;
    713   1.1       mrg 
    714  1.11       mrg 	NETBSD32TOP_UAP(namebuf, char);
    715  1.11       mrg 	NETBSD32TO64_UAP(namelen);
    716  1.70   thorpej 	return (sys___getlogin(l, &ua, retval));
    717   1.1       mrg }
    718   1.1       mrg 
    719   1.1       mrg int
    720  1.70   thorpej netbsd32_setlogin(l, v, retval)
    721  1.70   thorpej 	struct lwp *l;
    722   1.1       mrg 	void *v;
    723   1.1       mrg 	register_t *retval;
    724   1.1       mrg {
    725  1.19       eeh 	struct netbsd32_setlogin_args /* {
    726  1.10       mrg 		syscallarg(const netbsd32_charp) namebuf;
    727   1.1       mrg 	} */ *uap = v;
    728  1.70   thorpej 	struct sys___setlogin_args ua;
    729   1.1       mrg 
    730  1.11       mrg 	NETBSD32TOP_UAP(namebuf, char);
    731  1.70   thorpej 	return (sys___setlogin(l, &ua, retval));
    732   1.1       mrg }
    733   1.1       mrg 
    734   1.1       mrg int
    735  1.70   thorpej netbsd32_acct(l, v, retval)
    736  1.70   thorpej 	struct lwp *l;
    737   1.1       mrg 	void *v;
    738   1.1       mrg 	register_t *retval;
    739   1.1       mrg {
    740  1.19       eeh 	struct netbsd32_acct_args /* {
    741  1.10       mrg 		syscallarg(const netbsd32_charp) path;
    742   1.1       mrg 	} */ *uap = v;
    743   1.1       mrg 	struct sys_acct_args ua;
    744   1.1       mrg 
    745  1.11       mrg 	NETBSD32TOP_UAP(path, const char);
    746  1.70   thorpej 	return (sys_acct(l, &ua, retval));
    747   1.1       mrg }
    748   1.1       mrg 
    749   1.1       mrg int
    750  1.70   thorpej netbsd32_revoke(l, v, retval)
    751  1.70   thorpej 	struct lwp *l;
    752   1.1       mrg 	void *v;
    753   1.1       mrg 	register_t *retval;
    754   1.1       mrg {
    755  1.19       eeh 	struct netbsd32_revoke_args /* {
    756  1.10       mrg 		syscallarg(const netbsd32_charp) path;
    757   1.1       mrg 	} */ *uap = v;
    758   1.1       mrg 	struct sys_revoke_args ua;
    759   1.1       mrg 	caddr_t sg;
    760   1.1       mrg 
    761  1.11       mrg 	NETBSD32TOP_UAP(path, const char);
    762  1.70   thorpej 	sg = stackgap_init(l->l_proc, 0);
    763  1.73      fvdl 	CHECK_ALT_EXIST(l->l_proc, &sg, SCARG(&ua, path));
    764   1.1       mrg 
    765  1.70   thorpej 	return (sys_revoke(l, &ua, retval));
    766   1.1       mrg }
    767   1.1       mrg 
    768   1.1       mrg int
    769  1.70   thorpej netbsd32_symlink(l, v, retval)
    770  1.70   thorpej 	struct lwp *l;
    771   1.1       mrg 	void *v;
    772   1.1       mrg 	register_t *retval;
    773   1.1       mrg {
    774  1.19       eeh 	struct netbsd32_symlink_args /* {
    775  1.10       mrg 		syscallarg(const netbsd32_charp) path;
    776  1.10       mrg 		syscallarg(const netbsd32_charp) link;
    777   1.1       mrg 	} */ *uap = v;
    778   1.1       mrg 	struct sys_symlink_args ua;
    779   1.1       mrg 
    780  1.11       mrg 	NETBSD32TOP_UAP(path, const char);
    781  1.11       mrg 	NETBSD32TOP_UAP(link, const char);
    782   1.1       mrg 
    783  1.70   thorpej 	return (sys_symlink(l, &ua, retval));
    784   1.1       mrg }
    785   1.1       mrg 
    786   1.1       mrg int
    787  1.70   thorpej netbsd32_readlink(l, v, retval)
    788  1.70   thorpej 	struct lwp *l;
    789   1.1       mrg 	void *v;
    790   1.1       mrg 	register_t *retval;
    791   1.1       mrg {
    792  1.19       eeh 	struct netbsd32_readlink_args /* {
    793  1.10       mrg 		syscallarg(const netbsd32_charp) path;
    794  1.10       mrg 		syscallarg(netbsd32_charp) buf;
    795  1.10       mrg 		syscallarg(netbsd32_size_t) count;
    796   1.1       mrg 	} */ *uap = v;
    797   1.1       mrg 	struct sys_readlink_args ua;
    798   1.1       mrg 	caddr_t sg;
    799   1.1       mrg 
    800  1.11       mrg 	NETBSD32TOP_UAP(path, const char);
    801  1.11       mrg 	NETBSD32TOP_UAP(buf, char);
    802  1.11       mrg 	NETBSD32TOX_UAP(count, size_t);
    803  1.70   thorpej 	sg = stackgap_init(l->l_proc, 0);
    804  1.73      fvdl 	CHECK_ALT_SYMLINK(l->l_proc, &sg, SCARG(&ua, path));
    805   1.1       mrg 
    806  1.70   thorpej 	return (sys_readlink(l, &ua, retval));
    807   1.1       mrg }
    808   1.1       mrg 
    809   1.1       mrg int
    810  1.70   thorpej netbsd32_umask(l, v, retval)
    811  1.70   thorpej 	struct lwp *l;
    812   1.6       eeh 	void *v;
    813   1.6       eeh 	register_t *retval;
    814   1.6       eeh {
    815  1.19       eeh 	struct netbsd32_umask_args /* {
    816   1.6       eeh 		syscallarg(mode_t) newmask;
    817   1.6       eeh 	} */ *uap = v;
    818   1.6       eeh 	struct sys_umask_args ua;
    819   1.6       eeh 
    820  1.11       mrg 	NETBSD32TO64_UAP(newmask);
    821  1.70   thorpej 	return (sys_umask(l, &ua, retval));
    822   1.6       eeh }
    823   1.6       eeh 
    824   1.6       eeh int
    825  1.70   thorpej netbsd32_chroot(l, v, retval)
    826  1.70   thorpej 	struct lwp *l;
    827   1.1       mrg 	void *v;
    828   1.1       mrg 	register_t *retval;
    829   1.1       mrg {
    830  1.19       eeh 	struct netbsd32_chroot_args /* {
    831  1.10       mrg 		syscallarg(const netbsd32_charp) path;
    832   1.1       mrg 	} */ *uap = v;
    833   1.1       mrg 	struct sys_chroot_args ua;
    834   1.1       mrg 
    835  1.11       mrg 	NETBSD32TOP_UAP(path, const char);
    836  1.70   thorpej 	return (sys_chroot(l, &ua, retval));
    837   1.1       mrg }
    838   1.1       mrg 
    839   1.1       mrg int
    840  1.70   thorpej netbsd32_sbrk(l, v, retval)
    841  1.70   thorpej 	struct lwp *l;
    842   1.6       eeh 	void *v;
    843   1.6       eeh 	register_t *retval;
    844   1.6       eeh {
    845  1.19       eeh 	struct netbsd32_sbrk_args /* {
    846   1.6       eeh 		syscallarg(int) incr;
    847   1.6       eeh 	} */ *uap = v;
    848   1.6       eeh 	struct sys_sbrk_args ua;
    849   1.6       eeh 
    850  1.11       mrg 	NETBSD32TO64_UAP(incr);
    851  1.70   thorpej 	return (sys_sbrk(l, &ua, retval));
    852   1.6       eeh }
    853   1.6       eeh 
    854   1.6       eeh int
    855  1.70   thorpej netbsd32_sstk(l, v, retval)
    856  1.70   thorpej 	struct lwp *l;
    857   1.6       eeh 	void *v;
    858   1.6       eeh 	register_t *retval;
    859   1.6       eeh {
    860  1.19       eeh 	struct netbsd32_sstk_args /* {
    861   1.6       eeh 		syscallarg(int) incr;
    862   1.6       eeh 	} */ *uap = v;
    863   1.6       eeh 	struct sys_sstk_args ua;
    864   1.6       eeh 
    865  1.11       mrg 	NETBSD32TO64_UAP(incr);
    866  1.70   thorpej 	return (sys_sstk(l, &ua, retval));
    867   1.6       eeh }
    868   1.6       eeh 
    869   1.6       eeh int
    870  1.70   thorpej netbsd32_munmap(l, v, retval)
    871  1.70   thorpej 	struct lwp *l;
    872   1.1       mrg 	void *v;
    873   1.1       mrg 	register_t *retval;
    874   1.1       mrg {
    875  1.19       eeh 	struct netbsd32_munmap_args /* {
    876  1.10       mrg 		syscallarg(netbsd32_voidp) addr;
    877  1.10       mrg 		syscallarg(netbsd32_size_t) len;
    878   1.1       mrg 	} */ *uap = v;
    879   1.1       mrg 	struct sys_munmap_args ua;
    880   1.1       mrg 
    881  1.11       mrg 	NETBSD32TOP_UAP(addr, void);
    882  1.11       mrg 	NETBSD32TOX_UAP(len, size_t);
    883  1.70   thorpej 	return (sys_munmap(l, &ua, retval));
    884   1.1       mrg }
    885   1.1       mrg 
    886   1.1       mrg int
    887  1.70   thorpej netbsd32_mprotect(l, v, retval)
    888  1.70   thorpej 	struct lwp *l;
    889   1.1       mrg 	void *v;
    890   1.1       mrg 	register_t *retval;
    891   1.1       mrg {
    892  1.19       eeh 	struct netbsd32_mprotect_args /* {
    893  1.10       mrg 		syscallarg(netbsd32_voidp) addr;
    894  1.10       mrg 		syscallarg(netbsd32_size_t) len;
    895   1.1       mrg 		syscallarg(int) prot;
    896   1.1       mrg 	} */ *uap = v;
    897   1.1       mrg 	struct sys_mprotect_args ua;
    898   1.1       mrg 
    899  1.11       mrg 	NETBSD32TOP_UAP(addr, void);
    900  1.11       mrg 	NETBSD32TOX_UAP(len, size_t);
    901  1.11       mrg 	NETBSD32TO64_UAP(prot);
    902  1.70   thorpej 	return (sys_mprotect(l, &ua, retval));
    903   1.1       mrg }
    904   1.1       mrg 
    905   1.1       mrg int
    906  1.70   thorpej netbsd32_madvise(l, v, retval)
    907  1.70   thorpej 	struct lwp *l;
    908   1.1       mrg 	void *v;
    909   1.1       mrg 	register_t *retval;
    910   1.1       mrg {
    911  1.19       eeh 	struct netbsd32_madvise_args /* {
    912  1.10       mrg 		syscallarg(netbsd32_voidp) addr;
    913  1.10       mrg 		syscallarg(netbsd32_size_t) len;
    914   1.1       mrg 		syscallarg(int) behav;
    915   1.1       mrg 	} */ *uap = v;
    916   1.1       mrg 	struct sys_madvise_args ua;
    917   1.1       mrg 
    918  1.11       mrg 	NETBSD32TOP_UAP(addr, void);
    919  1.11       mrg 	NETBSD32TOX_UAP(len, size_t);
    920  1.11       mrg 	NETBSD32TO64_UAP(behav);
    921  1.70   thorpej 	return (sys_madvise(l, &ua, retval));
    922   1.1       mrg }
    923   1.1       mrg 
    924   1.1       mrg int
    925  1.70   thorpej netbsd32_mincore(l, v, retval)
    926  1.70   thorpej 	struct lwp *l;
    927   1.1       mrg 	void *v;
    928   1.1       mrg 	register_t *retval;
    929   1.1       mrg {
    930  1.19       eeh 	struct netbsd32_mincore_args /* {
    931  1.10       mrg 		syscallarg(netbsd32_caddr_t) addr;
    932  1.10       mrg 		syscallarg(netbsd32_size_t) len;
    933  1.10       mrg 		syscallarg(netbsd32_charp) vec;
    934   1.1       mrg 	} */ *uap = v;
    935   1.1       mrg 	struct sys_mincore_args ua;
    936   1.1       mrg 
    937  1.11       mrg 	NETBSD32TOX64_UAP(addr, caddr_t);
    938  1.11       mrg 	NETBSD32TOX_UAP(len, size_t);
    939  1.11       mrg 	NETBSD32TOP_UAP(vec, char);
    940  1.70   thorpej 	return (sys_mincore(l, &ua, retval));
    941   1.1       mrg }
    942   1.1       mrg 
    943  1.57       mrg /* XXX MOVE ME XXX ? */
    944   1.1       mrg int
    945  1.70   thorpej netbsd32_getgroups(l, v, retval)
    946  1.70   thorpej 	struct lwp *l;
    947   1.1       mrg 	void *v;
    948   1.1       mrg 	register_t *retval;
    949   1.1       mrg {
    950  1.19       eeh 	struct netbsd32_getgroups_args /* {
    951   1.1       mrg 		syscallarg(int) gidsetsize;
    952  1.10       mrg 		syscallarg(netbsd32_gid_tp) gidset;
    953   1.1       mrg 	} */ *uap = v;
    954  1.70   thorpej 	struct pcred *pc = l->l_proc->p_cred;
    955  1.25  augustss 	int ngrp;
    956   1.6       eeh 	int error;
    957   1.1       mrg 
    958   1.6       eeh 	ngrp = SCARG(uap, gidsetsize);
    959   1.6       eeh 	if (ngrp == 0) {
    960   1.6       eeh 		*retval = pc->pc_ucred->cr_ngroups;
    961   1.6       eeh 		return (0);
    962   1.6       eeh 	}
    963   1.6       eeh 	if (ngrp < pc->pc_ucred->cr_ngroups)
    964   1.6       eeh 		return (EINVAL);
    965   1.6       eeh 	ngrp = pc->pc_ucred->cr_ngroups;
    966  1.10       mrg 	/* Should convert gid_t to netbsd32_gid_t, but they're the same */
    967   1.6       eeh 	error = copyout((caddr_t)pc->pc_ucred->cr_groups,
    968  1.66       scw 	    (caddr_t)NETBSD32PTR64(SCARG(uap, gidset)), ngrp * sizeof(gid_t));
    969   1.6       eeh 	if (error)
    970   1.6       eeh 		return (error);
    971   1.6       eeh 	*retval = ngrp;
    972   1.6       eeh 	return (0);
    973   1.1       mrg }
    974   1.1       mrg 
    975   1.1       mrg int
    976  1.70   thorpej netbsd32_setgroups(l, v, retval)
    977  1.70   thorpej 	struct lwp *l;
    978   1.1       mrg 	void *v;
    979   1.1       mrg 	register_t *retval;
    980   1.1       mrg {
    981  1.19       eeh 	struct netbsd32_setgroups_args /* {
    982   1.1       mrg 		syscallarg(int) gidsetsize;
    983  1.10       mrg 		syscallarg(const netbsd32_gid_tp) gidset;
    984   1.1       mrg 	} */ *uap = v;
    985   1.1       mrg 	struct sys_setgroups_args ua;
    986   1.1       mrg 
    987  1.11       mrg 	NETBSD32TO64_UAP(gidsetsize);
    988  1.11       mrg 	NETBSD32TOP_UAP(gidset, gid_t);
    989  1.70   thorpej 	return (sys_setgroups(l, &ua, retval));
    990   1.1       mrg }
    991   1.1       mrg 
    992   1.1       mrg int
    993  1.70   thorpej netbsd32_setpgid(l, v, retval)
    994  1.70   thorpej 	struct lwp *l;
    995   1.6       eeh 	void *v;
    996   1.6       eeh 	register_t *retval;
    997   1.6       eeh {
    998  1.19       eeh 	struct netbsd32_setpgid_args /* {
    999   1.6       eeh 		syscallarg(int) pid;
   1000   1.6       eeh 		syscallarg(int) pgid;
   1001   1.6       eeh 	} */ *uap = v;
   1002   1.6       eeh 	struct sys_setpgid_args ua;
   1003   1.6       eeh 
   1004  1.11       mrg 	NETBSD32TO64_UAP(pid);
   1005  1.11       mrg 	NETBSD32TO64_UAP(pgid);
   1006  1.70   thorpej 	return (sys_setpgid(l, &ua, retval));
   1007   1.6       eeh }
   1008   1.6       eeh 
   1009   1.1       mrg int
   1010  1.70   thorpej netbsd32_fcntl(l, v, retval)
   1011  1.70   thorpej 	struct lwp *l;
   1012   1.1       mrg 	void *v;
   1013   1.1       mrg 	register_t *retval;
   1014   1.1       mrg {
   1015  1.19       eeh 	struct netbsd32_fcntl_args /* {
   1016   1.1       mrg 		syscallarg(int) fd;
   1017   1.1       mrg 		syscallarg(int) cmd;
   1018  1.10       mrg 		syscallarg(netbsd32_voidp) arg;
   1019   1.1       mrg 	} */ *uap = v;
   1020   1.1       mrg 	struct sys_fcntl_args ua;
   1021   1.1       mrg 
   1022  1.11       mrg 	NETBSD32TO64_UAP(fd);
   1023  1.11       mrg 	NETBSD32TO64_UAP(cmd);
   1024  1.11       mrg 	NETBSD32TOP_UAP(arg, void);
   1025  1.54       mrg 	/* we can do this because `struct flock' doesn't change */
   1026  1.70   thorpej 	return (sys_fcntl(l, &ua, retval));
   1027   1.1       mrg }
   1028   1.1       mrg 
   1029   1.1       mrg int
   1030  1.70   thorpej netbsd32_dup2(l, v, retval)
   1031  1.70   thorpej 	struct lwp *l;
   1032   1.6       eeh 	void *v;
   1033   1.6       eeh 	register_t *retval;
   1034   1.6       eeh {
   1035  1.19       eeh 	struct netbsd32_dup2_args /* {
   1036   1.6       eeh 		syscallarg(int) from;
   1037   1.6       eeh 		syscallarg(int) to;
   1038   1.6       eeh 	} */ *uap = v;
   1039   1.6       eeh 	struct sys_dup2_args ua;
   1040   1.6       eeh 
   1041  1.11       mrg 	NETBSD32TO64_UAP(from);
   1042  1.11       mrg 	NETBSD32TO64_UAP(to);
   1043  1.70   thorpej 	return (sys_dup2(l, &ua, retval));
   1044   1.6       eeh }
   1045   1.6       eeh 
   1046   1.6       eeh int
   1047  1.70   thorpej netbsd32_fsync(l, v, retval)
   1048  1.70   thorpej 	struct lwp *l;
   1049   1.6       eeh 	void *v;
   1050   1.6       eeh 	register_t *retval;
   1051   1.6       eeh {
   1052  1.19       eeh 	struct netbsd32_fsync_args /* {
   1053   1.6       eeh 		syscallarg(int) fd;
   1054   1.6       eeh 	} */ *uap = v;
   1055   1.6       eeh 	struct sys_fsync_args ua;
   1056   1.1       mrg 
   1057  1.11       mrg 	NETBSD32TO64_UAP(fd);
   1058  1.70   thorpej 	return (sys_fsync(l, &ua, retval));
   1059   1.6       eeh }
   1060   1.6       eeh 
   1061   1.6       eeh int
   1062  1.70   thorpej netbsd32_setpriority(l, v, retval)
   1063  1.70   thorpej 	struct lwp *l;
   1064   1.6       eeh 	void *v;
   1065   1.6       eeh 	register_t *retval;
   1066   1.6       eeh {
   1067  1.19       eeh 	struct netbsd32_setpriority_args /* {
   1068   1.6       eeh 		syscallarg(int) which;
   1069   1.6       eeh 		syscallarg(int) who;
   1070   1.6       eeh 		syscallarg(int) prio;
   1071   1.6       eeh 	} */ *uap = v;
   1072   1.6       eeh 	struct sys_setpriority_args ua;
   1073   1.6       eeh 
   1074  1.11       mrg 	NETBSD32TO64_UAP(which);
   1075  1.11       mrg 	NETBSD32TO64_UAP(who);
   1076  1.11       mrg 	NETBSD32TO64_UAP(prio);
   1077  1.70   thorpej 	return (sys_setpriority(l, &ua, retval));
   1078   1.6       eeh }
   1079   1.6       eeh 
   1080   1.6       eeh int
   1081  1.70   thorpej netbsd32_socket(l, v, retval)
   1082  1.70   thorpej 	struct lwp *l;
   1083   1.6       eeh 	void *v;
   1084   1.6       eeh 	register_t *retval;
   1085   1.6       eeh {
   1086  1.19       eeh 	struct netbsd32_socket_args /* {
   1087   1.6       eeh 		syscallarg(int) domain;
   1088   1.6       eeh 		syscallarg(int) type;
   1089   1.6       eeh 		syscallarg(int) protocol;
   1090   1.6       eeh 	} */ *uap = v;
   1091   1.6       eeh 	struct sys_socket_args ua;
   1092   1.6       eeh 
   1093  1.11       mrg 	NETBSD32TO64_UAP(domain);
   1094  1.11       mrg 	NETBSD32TO64_UAP(type);
   1095  1.11       mrg 	NETBSD32TO64_UAP(protocol);
   1096  1.70   thorpej 	return (sys_socket(l, &ua, retval));
   1097   1.1       mrg }
   1098   1.1       mrg 
   1099   1.1       mrg int
   1100  1.70   thorpej netbsd32_connect(l, v, retval)
   1101  1.70   thorpej 	struct lwp *l;
   1102   1.1       mrg 	void *v;
   1103   1.1       mrg 	register_t *retval;
   1104   1.1       mrg {
   1105  1.19       eeh 	struct netbsd32_connect_args /* {
   1106   1.1       mrg 		syscallarg(int) s;
   1107  1.10       mrg 		syscallarg(const netbsd32_sockaddrp_t) name;
   1108   1.1       mrg 		syscallarg(int) namelen;
   1109   1.1       mrg 	} */ *uap = v;
   1110   1.1       mrg 	struct sys_connect_args ua;
   1111   1.1       mrg 
   1112  1.11       mrg 	NETBSD32TO64_UAP(s);
   1113  1.11       mrg 	NETBSD32TOP_UAP(name, struct sockaddr);
   1114  1.11       mrg 	NETBSD32TO64_UAP(namelen);
   1115  1.70   thorpej 	return (sys_connect(l, &ua, retval));
   1116   1.1       mrg }
   1117   1.1       mrg 
   1118   1.6       eeh int
   1119  1.70   thorpej netbsd32_getpriority(l, v, retval)
   1120  1.70   thorpej 	struct lwp *l;
   1121   1.6       eeh 	void *v;
   1122   1.6       eeh 	register_t *retval;
   1123   1.6       eeh {
   1124  1.19       eeh 	struct netbsd32_getpriority_args /* {
   1125   1.6       eeh 		syscallarg(int) which;
   1126   1.6       eeh 		syscallarg(int) who;
   1127   1.6       eeh 	} */ *uap = v;
   1128   1.6       eeh 	struct sys_getpriority_args ua;
   1129   1.6       eeh 
   1130  1.11       mrg 	NETBSD32TO64_UAP(which);
   1131  1.11       mrg 	NETBSD32TO64_UAP(who);
   1132  1.70   thorpej 	return (sys_getpriority(l, &ua, retval));
   1133   1.6       eeh }
   1134   1.6       eeh 
   1135   1.1       mrg int
   1136  1.70   thorpej netbsd32_bind(l, v, retval)
   1137  1.70   thorpej 	struct lwp *l;
   1138   1.1       mrg 	void *v;
   1139   1.1       mrg 	register_t *retval;
   1140   1.1       mrg {
   1141  1.19       eeh 	struct netbsd32_bind_args /* {
   1142   1.1       mrg 		syscallarg(int) s;
   1143  1.10       mrg 		syscallarg(const netbsd32_sockaddrp_t) name;
   1144   1.1       mrg 		syscallarg(int) namelen;
   1145   1.1       mrg 	} */ *uap = v;
   1146   1.6       eeh 	struct sys_bind_args ua;
   1147   1.1       mrg 
   1148  1.11       mrg 	NETBSD32TO64_UAP(s);
   1149  1.11       mrg 	NETBSD32TOP_UAP(name, struct sockaddr);
   1150  1.11       mrg 	NETBSD32TO64_UAP(namelen);
   1151  1.70   thorpej 	return (sys_bind(l, &ua, retval));
   1152   1.1       mrg }
   1153   1.1       mrg 
   1154   1.1       mrg int
   1155  1.70   thorpej netbsd32_setsockopt(l, v, retval)
   1156  1.70   thorpej 	struct lwp *l;
   1157   1.1       mrg 	void *v;
   1158   1.1       mrg 	register_t *retval;
   1159   1.1       mrg {
   1160  1.19       eeh 	struct netbsd32_setsockopt_args /* {
   1161   1.1       mrg 		syscallarg(int) s;
   1162   1.1       mrg 		syscallarg(int) level;
   1163   1.1       mrg 		syscallarg(int) name;
   1164  1.10       mrg 		syscallarg(const netbsd32_voidp) val;
   1165   1.1       mrg 		syscallarg(int) valsize;
   1166   1.1       mrg 	} */ *uap = v;
   1167   1.1       mrg 	struct sys_setsockopt_args ua;
   1168   1.1       mrg 
   1169  1.11       mrg 	NETBSD32TO64_UAP(s);
   1170  1.11       mrg 	NETBSD32TO64_UAP(level);
   1171  1.11       mrg 	NETBSD32TO64_UAP(name);
   1172  1.11       mrg 	NETBSD32TOP_UAP(val, void);
   1173  1.11       mrg 	NETBSD32TO64_UAP(valsize);
   1174   1.6       eeh 	/* may be more efficient to do this inline. */
   1175  1.70   thorpej 	return (sys_setsockopt(l, &ua, retval));
   1176   1.1       mrg }
   1177   1.1       mrg 
   1178   1.1       mrg int
   1179  1.70   thorpej netbsd32_listen(l, v, retval)
   1180  1.70   thorpej 	struct lwp *l;
   1181   1.6       eeh 	void *v;
   1182   1.6       eeh 	register_t *retval;
   1183   1.6       eeh {
   1184  1.19       eeh 	struct netbsd32_listen_args /* {
   1185   1.6       eeh 		syscallarg(int) s;
   1186   1.6       eeh 		syscallarg(int) backlog;
   1187   1.6       eeh 	} */ *uap = v;
   1188   1.6       eeh 	struct sys_listen_args ua;
   1189   1.6       eeh 
   1190  1.11       mrg 	NETBSD32TO64_UAP(s);
   1191  1.11       mrg 	NETBSD32TO64_UAP(backlog);
   1192  1.70   thorpej 	return (sys_listen(l, &ua, retval));
   1193   1.6       eeh }
   1194   1.6       eeh 
   1195   1.6       eeh int
   1196  1.70   thorpej netbsd32_fchown(l, v, retval)
   1197  1.70   thorpej 	struct lwp *l;
   1198   1.1       mrg 	void *v;
   1199   1.1       mrg 	register_t *retval;
   1200   1.1       mrg {
   1201  1.57       mrg 	struct netbsd32_fchown_args /* {
   1202  1.57       mrg 		syscallarg(int) fd;
   1203  1.57       mrg 		syscallarg(uid_t) uid;
   1204  1.57       mrg 		syscallarg(gid_t) gid;
   1205   1.1       mrg 	} */ *uap = v;
   1206  1.57       mrg 	struct sys_fchown_args ua;
   1207   1.6       eeh 
   1208  1.11       mrg 	NETBSD32TO64_UAP(fd);
   1209  1.11       mrg 	NETBSD32TO64_UAP(uid);
   1210  1.11       mrg 	NETBSD32TO64_UAP(gid);
   1211  1.70   thorpej 	return (sys_fchown(l, &ua, retval));
   1212   1.6       eeh }
   1213   1.6       eeh 
   1214   1.6       eeh int
   1215  1.70   thorpej netbsd32_fchmod(l, v, retval)
   1216  1.70   thorpej 	struct lwp *l;
   1217   1.6       eeh 	void *v;
   1218   1.6       eeh 	register_t *retval;
   1219   1.6       eeh {
   1220  1.19       eeh 	struct netbsd32_fchmod_args /* {
   1221   1.6       eeh 		syscallarg(int) fd;
   1222   1.6       eeh 		syscallarg(mode_t) mode;
   1223   1.6       eeh 	} */ *uap = v;
   1224   1.6       eeh 	struct sys_fchmod_args ua;
   1225   1.6       eeh 
   1226  1.11       mrg 	NETBSD32TO64_UAP(fd);
   1227  1.11       mrg 	NETBSD32TO64_UAP(mode);
   1228  1.70   thorpej 	return (sys_fchmod(l, &ua, retval));
   1229   1.6       eeh }
   1230   1.6       eeh 
   1231   1.6       eeh int
   1232  1.70   thorpej netbsd32_setreuid(l, v, retval)
   1233  1.70   thorpej 	struct lwp *l;
   1234   1.6       eeh 	void *v;
   1235   1.6       eeh 	register_t *retval;
   1236   1.6       eeh {
   1237  1.19       eeh 	struct netbsd32_setreuid_args /* {
   1238   1.6       eeh 		syscallarg(uid_t) ruid;
   1239   1.6       eeh 		syscallarg(uid_t) euid;
   1240   1.6       eeh 	} */ *uap = v;
   1241   1.6       eeh 	struct sys_setreuid_args ua;
   1242   1.6       eeh 
   1243  1.11       mrg 	NETBSD32TO64_UAP(ruid);
   1244  1.11       mrg 	NETBSD32TO64_UAP(euid);
   1245  1.70   thorpej 	return (sys_setreuid(l, &ua, retval));
   1246   1.6       eeh }
   1247   1.1       mrg 
   1248   1.6       eeh int
   1249  1.70   thorpej netbsd32_setregid(l, v, retval)
   1250  1.70   thorpej 	struct lwp *l;
   1251   1.6       eeh 	void *v;
   1252   1.6       eeh 	register_t *retval;
   1253   1.6       eeh {
   1254  1.19       eeh 	struct netbsd32_setregid_args /* {
   1255   1.6       eeh 		syscallarg(gid_t) rgid;
   1256   1.6       eeh 		syscallarg(gid_t) egid;
   1257   1.6       eeh 	} */ *uap = v;
   1258   1.6       eeh 	struct sys_setregid_args ua;
   1259   1.6       eeh 
   1260  1.11       mrg 	NETBSD32TO64_UAP(rgid);
   1261  1.11       mrg 	NETBSD32TO64_UAP(egid);
   1262  1.70   thorpej 	return (sys_setregid(l, &ua, retval));
   1263   1.1       mrg }
   1264   1.1       mrg 
   1265   1.1       mrg int
   1266  1.70   thorpej netbsd32_getsockopt(l, v, retval)
   1267  1.70   thorpej 	struct lwp *l;
   1268   1.1       mrg 	void *v;
   1269   1.1       mrg 	register_t *retval;
   1270   1.1       mrg {
   1271  1.19       eeh 	struct netbsd32_getsockopt_args /* {
   1272   1.1       mrg 		syscallarg(int) s;
   1273   1.1       mrg 		syscallarg(int) level;
   1274   1.1       mrg 		syscallarg(int) name;
   1275  1.10       mrg 		syscallarg(netbsd32_voidp) val;
   1276  1.10       mrg 		syscallarg(netbsd32_intp) avalsize;
   1277   1.1       mrg 	} */ *uap = v;
   1278   1.1       mrg 	struct sys_getsockopt_args ua;
   1279   1.1       mrg 
   1280  1.11       mrg 	NETBSD32TO64_UAP(s);
   1281  1.11       mrg 	NETBSD32TO64_UAP(level);
   1282  1.11       mrg 	NETBSD32TO64_UAP(name);
   1283  1.11       mrg 	NETBSD32TOP_UAP(val, void);
   1284  1.11       mrg 	NETBSD32TOP_UAP(avalsize, int);
   1285  1.70   thorpej 	return (sys_getsockopt(l, &ua, retval));
   1286   1.1       mrg }
   1287   1.1       mrg 
   1288   1.1       mrg int
   1289  1.70   thorpej netbsd32_rename(l, v, retval)
   1290  1.70   thorpej 	struct lwp *l;
   1291   1.1       mrg 	void *v;
   1292   1.1       mrg 	register_t *retval;
   1293   1.1       mrg {
   1294  1.19       eeh 	struct netbsd32_rename_args /* {
   1295  1.10       mrg 		syscallarg(const netbsd32_charp) from;
   1296  1.10       mrg 		syscallarg(const netbsd32_charp) to;
   1297   1.1       mrg 	} */ *uap = v;
   1298   1.1       mrg 	struct sys_rename_args ua;
   1299   1.1       mrg 
   1300  1.20       eeh 	NETBSD32TOP_UAP(from, const char);
   1301  1.20       eeh 	NETBSD32TOP_UAP(to, const char)
   1302   1.6       eeh 
   1303  1.70   thorpej 	return (sys_rename(l, &ua, retval));
   1304   1.1       mrg }
   1305   1.1       mrg 
   1306   1.1       mrg int
   1307  1.70   thorpej netbsd32_flock(l, v, retval)
   1308  1.70   thorpej 	struct lwp *l;
   1309   1.6       eeh 	void *v;
   1310   1.6       eeh 	register_t *retval;
   1311   1.6       eeh {
   1312  1.19       eeh 	struct netbsd32_flock_args /* {
   1313   1.6       eeh 		syscallarg(int) fd;
   1314   1.6       eeh 		syscallarg(int) how;
   1315   1.6       eeh 	} */ *uap = v;
   1316   1.6       eeh 	struct sys_flock_args ua;
   1317   1.6       eeh 
   1318  1.11       mrg 	NETBSD32TO64_UAP(fd);
   1319  1.11       mrg 	NETBSD32TO64_UAP(how)
   1320   1.6       eeh 
   1321  1.70   thorpej 	return (sys_flock(l, &ua, retval));
   1322   1.6       eeh }
   1323   1.6       eeh 
   1324   1.6       eeh int
   1325  1.70   thorpej netbsd32_mkfifo(l, v, retval)
   1326  1.70   thorpej 	struct lwp *l;
   1327   1.1       mrg 	void *v;
   1328   1.1       mrg 	register_t *retval;
   1329   1.1       mrg {
   1330  1.19       eeh 	struct netbsd32_mkfifo_args /* {
   1331  1.10       mrg 		syscallarg(const netbsd32_charp) path;
   1332   1.1       mrg 		syscallarg(mode_t) mode;
   1333   1.1       mrg 	} */ *uap = v;
   1334   1.1       mrg 	struct sys_mkfifo_args ua;
   1335   1.1       mrg 
   1336  1.11       mrg 	NETBSD32TOP_UAP(path, const char)
   1337  1.11       mrg 	NETBSD32TO64_UAP(mode);
   1338  1.70   thorpej 	return (sys_mkfifo(l, &ua, retval));
   1339   1.1       mrg }
   1340   1.1       mrg 
   1341   1.1       mrg int
   1342  1.70   thorpej netbsd32_shutdown(l, v, retval)
   1343  1.70   thorpej 	struct lwp *l;
   1344   1.6       eeh 	void *v;
   1345   1.6       eeh 	register_t *retval;
   1346   1.6       eeh {
   1347  1.19       eeh 	struct netbsd32_shutdown_args /* {
   1348   1.6       eeh 		syscallarg(int) s;
   1349   1.6       eeh 		syscallarg(int) how;
   1350   1.6       eeh 	} */ *uap = v;
   1351   1.6       eeh 	struct sys_shutdown_args ua;
   1352   1.6       eeh 
   1353  1.11       mrg 	NETBSD32TO64_UAP(s)
   1354  1.11       mrg 	NETBSD32TO64_UAP(how);
   1355  1.70   thorpej 	return (sys_shutdown(l, &ua, retval));
   1356   1.6       eeh }
   1357   1.6       eeh 
   1358   1.6       eeh int
   1359  1.70   thorpej netbsd32_socketpair(l, v, retval)
   1360  1.70   thorpej 	struct lwp *l;
   1361   1.6       eeh 	void *v;
   1362   1.6       eeh 	register_t *retval;
   1363   1.6       eeh {
   1364  1.19       eeh 	struct netbsd32_socketpair_args /* {
   1365   1.6       eeh 		syscallarg(int) domain;
   1366   1.6       eeh 		syscallarg(int) type;
   1367   1.6       eeh 		syscallarg(int) protocol;
   1368  1.10       mrg 		syscallarg(netbsd32_intp) rsv;
   1369   1.6       eeh 	} */ *uap = v;
   1370   1.6       eeh 	struct sys_socketpair_args ua;
   1371   1.6       eeh 
   1372  1.11       mrg 	NETBSD32TO64_UAP(domain);
   1373  1.11       mrg 	NETBSD32TO64_UAP(type);
   1374  1.11       mrg 	NETBSD32TO64_UAP(protocol);
   1375  1.11       mrg 	NETBSD32TOP_UAP(rsv, int);
   1376   1.6       eeh 	/* Since we're just copying out two `int's we can do this */
   1377  1.70   thorpej 	return (sys_socketpair(l, &ua, retval));
   1378   1.6       eeh }
   1379   1.6       eeh 
   1380   1.6       eeh int
   1381  1.70   thorpej netbsd32_mkdir(l, v, retval)
   1382  1.70   thorpej 	struct lwp *l;
   1383   1.1       mrg 	void *v;
   1384   1.1       mrg 	register_t *retval;
   1385   1.1       mrg {
   1386  1.19       eeh 	struct netbsd32_mkdir_args /* {
   1387  1.10       mrg 		syscallarg(const netbsd32_charp) path;
   1388   1.1       mrg 		syscallarg(mode_t) mode;
   1389   1.1       mrg 	} */ *uap = v;
   1390   1.1       mrg 	struct sys_mkdir_args ua;
   1391   1.1       mrg 
   1392  1.11       mrg 	NETBSD32TOP_UAP(path, const char)
   1393  1.11       mrg 	NETBSD32TO64_UAP(mode);
   1394  1.70   thorpej 	return (sys_mkdir(l, &ua, retval));
   1395   1.1       mrg }
   1396   1.1       mrg 
   1397   1.1       mrg int
   1398  1.70   thorpej netbsd32_rmdir(l, v, retval)
   1399  1.70   thorpej 	struct lwp *l;
   1400   1.1       mrg 	void *v;
   1401   1.1       mrg 	register_t *retval;
   1402   1.1       mrg {
   1403  1.19       eeh 	struct netbsd32_rmdir_args /* {
   1404  1.10       mrg 		syscallarg(const netbsd32_charp) path;
   1405   1.1       mrg 	} */ *uap = v;
   1406   1.1       mrg 	struct sys_rmdir_args ua;
   1407   1.1       mrg 
   1408  1.11       mrg 	NETBSD32TOP_UAP(path, const char);
   1409  1.70   thorpej 	return (sys_rmdir(l, &ua, retval));
   1410   1.1       mrg }
   1411   1.1       mrg 
   1412   1.1       mrg int
   1413  1.70   thorpej netbsd32_quotactl(l, v, retval)
   1414  1.70   thorpej 	struct lwp *l;
   1415   1.1       mrg 	void *v;
   1416   1.1       mrg 	register_t *retval;
   1417   1.1       mrg {
   1418  1.19       eeh 	struct netbsd32_quotactl_args /* {
   1419  1.10       mrg 		syscallarg(const netbsd32_charp) path;
   1420   1.1       mrg 		syscallarg(int) cmd;
   1421   1.1       mrg 		syscallarg(int) uid;
   1422  1.10       mrg 		syscallarg(netbsd32_caddr_t) arg;
   1423   1.1       mrg 	} */ *uap = v;
   1424   1.1       mrg 	struct sys_quotactl_args ua;
   1425   1.1       mrg 
   1426  1.11       mrg 	NETBSD32TOP_UAP(path, const char);
   1427  1.11       mrg 	NETBSD32TO64_UAP(cmd);
   1428  1.11       mrg 	NETBSD32TO64_UAP(uid);
   1429  1.11       mrg 	NETBSD32TOX64_UAP(arg, caddr_t);
   1430  1.70   thorpej 	return (sys_quotactl(l, &ua, retval));
   1431   1.1       mrg }
   1432   1.1       mrg 
   1433   1.6       eeh #if defined(NFS) || defined(NFSSERVER)
   1434   1.1       mrg int
   1435  1.70   thorpej netbsd32_nfssvc(l, v, retval)
   1436  1.70   thorpej 	struct lwp *l;
   1437   1.1       mrg 	void *v;
   1438   1.1       mrg 	register_t *retval;
   1439   1.1       mrg {
   1440   1.6       eeh #if 0
   1441  1.19       eeh 	struct netbsd32_nfssvc_args /* {
   1442   1.1       mrg 		syscallarg(int) flag;
   1443  1.10       mrg 		syscallarg(netbsd32_voidp) argp;
   1444   1.1       mrg 	} */ *uap = v;
   1445   1.1       mrg 	struct sys_nfssvc_args ua;
   1446   1.1       mrg 
   1447  1.11       mrg 	NETBSD32TO64_UAP(flag);
   1448  1.11       mrg 	NETBSD32TOP_UAP(argp, void);
   1449  1.70   thorpej 	return (sys_nfssvc(l, &ua, retval));
   1450   1.6       eeh #else
   1451   1.6       eeh 	/* Why would we want to support a 32-bit nfsd? */
   1452   1.6       eeh 	return (ENOSYS);
   1453   1.6       eeh #endif
   1454   1.1       mrg }
   1455   1.6       eeh #endif
   1456   1.1       mrg 
   1457   1.6       eeh #if defined(NFS) || defined(NFSSERVER)
   1458   1.1       mrg int
   1459  1.70   thorpej netbsd32_getfh(l, v, retval)
   1460  1.70   thorpej 	struct lwp *l;
   1461   1.1       mrg 	void *v;
   1462   1.1       mrg 	register_t *retval;
   1463   1.1       mrg {
   1464  1.19       eeh 	struct netbsd32_getfh_args /* {
   1465  1.10       mrg 		syscallarg(const netbsd32_charp) fname;
   1466  1.10       mrg 		syscallarg(netbsd32_fhandlep_t) fhp;
   1467   1.1       mrg 	} */ *uap = v;
   1468   1.1       mrg 	struct sys_getfh_args ua;
   1469   1.1       mrg 
   1470  1.11       mrg 	NETBSD32TOP_UAP(fname, const char);
   1471  1.11       mrg 	NETBSD32TOP_UAP(fhp, struct fhandle);
   1472   1.6       eeh 	/* Lucky for us a fhandlep_t doesn't change sizes */
   1473  1.70   thorpej 	return (sys_getfh(l, &ua, retval));
   1474   1.1       mrg }
   1475   1.6       eeh #endif
   1476   1.1       mrg 
   1477   1.1       mrg int
   1478  1.70   thorpej netbsd32_pread(l, v, retval)
   1479  1.70   thorpej 	struct lwp *l;
   1480   1.1       mrg 	void *v;
   1481   1.1       mrg 	register_t *retval;
   1482   1.1       mrg {
   1483  1.19       eeh 	struct netbsd32_pread_args /* {
   1484   1.1       mrg 		syscallarg(int) fd;
   1485  1.10       mrg 		syscallarg(netbsd32_voidp) buf;
   1486  1.10       mrg 		syscallarg(netbsd32_size_t) nbyte;
   1487   1.1       mrg 		syscallarg(int) pad;
   1488   1.1       mrg 		syscallarg(off_t) offset;
   1489   1.1       mrg 	} */ *uap = v;
   1490   1.1       mrg 	struct sys_pread_args ua;
   1491   1.1       mrg 	ssize_t rt;
   1492   1.1       mrg 	int error;
   1493   1.1       mrg 
   1494  1.11       mrg 	NETBSD32TO64_UAP(fd);
   1495  1.11       mrg 	NETBSD32TOP_UAP(buf, void);
   1496  1.11       mrg 	NETBSD32TOX_UAP(nbyte, size_t);
   1497  1.11       mrg 	NETBSD32TO64_UAP(pad);
   1498  1.11       mrg 	NETBSD32TO64_UAP(offset);
   1499  1.70   thorpej 	error = sys_pread(l, &ua, (register_t *)&rt);
   1500  1.32       mrg 	*retval = rt;
   1501   1.1       mrg 	return (error);
   1502   1.1       mrg }
   1503   1.1       mrg 
   1504   1.1       mrg int
   1505  1.70   thorpej netbsd32_pwrite(l, v, retval)
   1506  1.70   thorpej 	struct lwp *l;
   1507   1.1       mrg 	void *v;
   1508   1.1       mrg 	register_t *retval;
   1509   1.1       mrg {
   1510  1.19       eeh 	struct netbsd32_pwrite_args /* {
   1511   1.1       mrg 		syscallarg(int) fd;
   1512  1.10       mrg 		syscallarg(const netbsd32_voidp) buf;
   1513  1.10       mrg 		syscallarg(netbsd32_size_t) nbyte;
   1514   1.1       mrg 		syscallarg(int) pad;
   1515   1.1       mrg 		syscallarg(off_t) offset;
   1516   1.1       mrg 	} */ *uap = v;
   1517   1.1       mrg 	struct sys_pwrite_args ua;
   1518   1.1       mrg 	ssize_t rt;
   1519   1.1       mrg 	int error;
   1520   1.1       mrg 
   1521  1.11       mrg 	NETBSD32TO64_UAP(fd);
   1522  1.11       mrg 	NETBSD32TOP_UAP(buf, void);
   1523  1.11       mrg 	NETBSD32TOX_UAP(nbyte, size_t);
   1524  1.11       mrg 	NETBSD32TO64_UAP(pad);
   1525  1.11       mrg 	NETBSD32TO64_UAP(offset);
   1526  1.70   thorpej 	error = sys_pwrite(l, &ua, (register_t *)&rt);
   1527  1.32       mrg 	*retval = rt;
   1528   1.1       mrg 	return (error);
   1529   1.1       mrg }
   1530   1.1       mrg 
   1531   1.6       eeh int
   1532  1.70   thorpej netbsd32_setgid(l, v, retval)
   1533  1.70   thorpej 	struct lwp *l;
   1534   1.6       eeh 	void *v;
   1535   1.6       eeh 	register_t *retval;
   1536   1.6       eeh {
   1537  1.19       eeh 	struct netbsd32_setgid_args /* {
   1538   1.6       eeh 		syscallarg(gid_t) gid;
   1539   1.6       eeh 	} */ *uap = v;
   1540   1.6       eeh 	struct sys_setgid_args ua;
   1541   1.6       eeh 
   1542  1.11       mrg 	NETBSD32TO64_UAP(gid);
   1543  1.70   thorpej 	return (sys_setgid(l, v, retval));
   1544   1.6       eeh }
   1545   1.6       eeh 
   1546   1.6       eeh int
   1547  1.70   thorpej netbsd32_setegid(l, v, retval)
   1548  1.70   thorpej 	struct lwp *l;
   1549   1.6       eeh 	void *v;
   1550   1.6       eeh 	register_t *retval;
   1551   1.6       eeh {
   1552  1.19       eeh 	struct netbsd32_setegid_args /* {
   1553   1.6       eeh 		syscallarg(gid_t) egid;
   1554   1.6       eeh 	} */ *uap = v;
   1555   1.6       eeh 	struct sys_setegid_args ua;
   1556   1.6       eeh 
   1557  1.11       mrg 	NETBSD32TO64_UAP(egid);
   1558  1.70   thorpej 	return (sys_setegid(l, v, retval));
   1559   1.6       eeh }
   1560   1.6       eeh 
   1561   1.6       eeh int
   1562  1.70   thorpej netbsd32_seteuid(l, v, retval)
   1563  1.70   thorpej 	struct lwp *l;
   1564   1.6       eeh 	void *v;
   1565   1.6       eeh 	register_t *retval;
   1566   1.6       eeh {
   1567  1.19       eeh 	struct netbsd32_seteuid_args /* {
   1568   1.6       eeh 		syscallarg(gid_t) euid;
   1569   1.6       eeh 	} */ *uap = v;
   1570   1.6       eeh 	struct sys_seteuid_args ua;
   1571   1.6       eeh 
   1572  1.11       mrg 	NETBSD32TO64_UAP(euid);
   1573  1.70   thorpej 	return (sys_seteuid(l, v, retval));
   1574   1.1       mrg }
   1575   1.1       mrg 
   1576   1.6       eeh #ifdef LFS
   1577   1.1       mrg int
   1578  1.70   thorpej netbsd32_sys_lfs_bmapv(l, v, retval)
   1579  1.70   thorpej 	struct lwp *l;
   1580   1.1       mrg 	void *v;
   1581   1.1       mrg 	register_t *retval;
   1582   1.1       mrg {
   1583   1.1       mrg 
   1584   1.1       mrg 	return (ENOSYS);	/* XXX */
   1585   1.1       mrg }
   1586   1.1       mrg 
   1587   1.1       mrg int
   1588  1.70   thorpej netbsd32_sys_lfs_markv(l, v, retval)
   1589  1.70   thorpej 	struct lwp *l;
   1590   1.1       mrg 	void *v;
   1591   1.1       mrg 	register_t *retval;
   1592   1.1       mrg {
   1593   1.1       mrg 
   1594   1.1       mrg 	return (ENOSYS);	/* XXX */
   1595   1.1       mrg }
   1596   1.1       mrg 
   1597   1.1       mrg int
   1598  1.70   thorpej netbsd32_sys_lfs_segclean(l, v, retval)
   1599  1.70   thorpej 	struct lwp *l;
   1600   1.1       mrg 	void *v;
   1601   1.1       mrg 	register_t *retval;
   1602   1.1       mrg {
   1603  1.20       eeh 
   1604   1.1       mrg 	return (ENOSYS);	/* XXX */
   1605   1.1       mrg }
   1606   1.1       mrg 
   1607   1.1       mrg int
   1608  1.70   thorpej netbsd32_sys_lfs_segwait(l, v, retval)
   1609  1.70   thorpej 	struct lwp *l;
   1610   1.1       mrg 	void *v;
   1611   1.1       mrg 	register_t *retval;
   1612   1.1       mrg {
   1613  1.20       eeh 
   1614   1.1       mrg 	return (ENOSYS);	/* XXX */
   1615   1.1       mrg }
   1616   1.6       eeh #endif
   1617   1.1       mrg 
   1618   1.1       mrg int
   1619  1.70   thorpej netbsd32_pathconf(l, v, retval)
   1620  1.70   thorpej 	struct lwp *l;
   1621   1.1       mrg 	void *v;
   1622   1.1       mrg 	register_t *retval;
   1623   1.1       mrg {
   1624  1.19       eeh 	struct netbsd32_pathconf_args /* {
   1625   1.1       mrg 		syscallarg(int) fd;
   1626   1.1       mrg 		syscallarg(int) name;
   1627   1.1       mrg 	} */ *uap = v;
   1628   1.1       mrg 	struct sys_pathconf_args ua;
   1629   1.1       mrg 	long rt;
   1630   1.1       mrg 	int error;
   1631   1.1       mrg 
   1632  1.11       mrg 	NETBSD32TOP_UAP(path, const char);
   1633  1.11       mrg 	NETBSD32TO64_UAP(name);
   1634  1.70   thorpej 	error = sys_pathconf(l, &ua, (register_t *)&rt);
   1635  1.32       mrg 	*retval = rt;
   1636   1.1       mrg 	return (error);
   1637   1.1       mrg }
   1638   1.1       mrg 
   1639   1.1       mrg int
   1640  1.70   thorpej netbsd32_fpathconf(l, v, retval)
   1641  1.70   thorpej 	struct lwp *l;
   1642   1.1       mrg 	void *v;
   1643   1.1       mrg 	register_t *retval;
   1644   1.1       mrg {
   1645  1.19       eeh 	struct netbsd32_fpathconf_args /* {
   1646   1.1       mrg 		syscallarg(int) fd;
   1647   1.1       mrg 		syscallarg(int) name;
   1648   1.1       mrg 	} */ *uap = v;
   1649   1.1       mrg 	struct sys_fpathconf_args ua;
   1650   1.1       mrg 	long rt;
   1651   1.1       mrg 	int error;
   1652   1.1       mrg 
   1653  1.11       mrg 	NETBSD32TO64_UAP(fd);
   1654  1.11       mrg 	NETBSD32TO64_UAP(name);
   1655  1.70   thorpej 	error = sys_fpathconf(l, &ua, (register_t *)&rt);
   1656  1.32       mrg 	*retval = rt;
   1657   1.1       mrg 	return (error);
   1658   1.1       mrg }
   1659   1.1       mrg 
   1660   1.1       mrg int
   1661  1.70   thorpej netbsd32_getrlimit(l, v, retval)
   1662  1.70   thorpej 	struct lwp *l;
   1663   1.1       mrg 	void *v;
   1664   1.1       mrg 	register_t *retval;
   1665   1.1       mrg {
   1666  1.19       eeh 	struct netbsd32_getrlimit_args /* {
   1667   1.1       mrg 		syscallarg(int) which;
   1668  1.10       mrg 		syscallarg(netbsd32_rlimitp_t) rlp;
   1669   1.1       mrg 	} */ *uap = v;
   1670   1.6       eeh 	int which = SCARG(uap, which);
   1671   1.1       mrg 
   1672   1.6       eeh 	if ((u_int)which >= RLIM_NLIMITS)
   1673   1.6       eeh 		return (EINVAL);
   1674  1.70   thorpej 	return (copyout(&l->l_proc->p_rlimit[which],
   1675  1.66       scw 	    (caddr_t)NETBSD32PTR64(SCARG(uap, rlp)), sizeof(struct rlimit)));
   1676   1.1       mrg }
   1677   1.1       mrg 
   1678   1.1       mrg int
   1679  1.70   thorpej netbsd32_setrlimit(l, v, retval)
   1680  1.70   thorpej 	struct lwp *l;
   1681   1.1       mrg 	void *v;
   1682   1.1       mrg 	register_t *retval;
   1683   1.1       mrg {
   1684  1.19       eeh 	struct netbsd32_setrlimit_args /* {
   1685   1.1       mrg 		syscallarg(int) which;
   1686  1.10       mrg 		syscallarg(const netbsd32_rlimitp_t) rlp;
   1687   1.1       mrg 	} */ *uap = v;
   1688   1.6       eeh 		int which = SCARG(uap, which);
   1689   1.6       eeh 	struct rlimit alim;
   1690   1.6       eeh 	int error;
   1691  1.70   thorpej 	struct proc *p = l->l_proc;
   1692   1.1       mrg 
   1693  1.66       scw 	error = copyin((caddr_t)NETBSD32PTR64(SCARG(uap, rlp)), &alim,
   1694  1.66       scw 	    sizeof(struct rlimit));
   1695   1.6       eeh 	if (error)
   1696   1.6       eeh 		return (error);
   1697  1.88      fvdl 
   1698  1.88      fvdl 	switch (which) {
   1699  1.88      fvdl 	case RLIMIT_DATA:
   1700  1.88      fvdl 		if (alim.rlim_cur > MAXDSIZ32)
   1701  1.88      fvdl 			alim.rlim_cur = MAXDSIZ32;
   1702  1.88      fvdl 		if (alim.rlim_max > MAXDSIZ32)
   1703  1.88      fvdl 			alim.rlim_max = MAXDSIZ32;
   1704  1.88      fvdl 		break;
   1705  1.88      fvdl 
   1706  1.88      fvdl 	case RLIMIT_STACK:
   1707  1.88      fvdl 		if (alim.rlim_cur > MAXSSIZ32)
   1708  1.88      fvdl 			alim.rlim_cur = MAXSSIZ32;
   1709  1.88      fvdl 		if (alim.rlim_max > MAXSSIZ32)
   1710  1.88      fvdl 			alim.rlim_max = MAXSSIZ32;
   1711  1.88      fvdl 	default:
   1712  1.88      fvdl 		break;
   1713  1.88      fvdl 	}
   1714  1.88      fvdl 
   1715  1.18    bouyer 	return (dosetrlimit(p, p->p_cred, which, &alim));
   1716   1.1       mrg }
   1717   1.1       mrg 
   1718   1.1       mrg int
   1719  1.70   thorpej netbsd32_mmap(l, v, retval)
   1720  1.70   thorpej 	struct lwp *l;
   1721   1.1       mrg 	void *v;
   1722   1.1       mrg 	register_t *retval;
   1723   1.1       mrg {
   1724  1.19       eeh 	struct netbsd32_mmap_args /* {
   1725  1.10       mrg 		syscallarg(netbsd32_voidp) addr;
   1726  1.10       mrg 		syscallarg(netbsd32_size_t) len;
   1727   1.1       mrg 		syscallarg(int) prot;
   1728   1.1       mrg 		syscallarg(int) flags;
   1729   1.1       mrg 		syscallarg(int) fd;
   1730  1.10       mrg 		syscallarg(netbsd32_long) pad;
   1731   1.1       mrg 		syscallarg(off_t) pos;
   1732   1.1       mrg 	} */ *uap = v;
   1733   1.1       mrg 	struct sys_mmap_args ua;
   1734   1.1       mrg 	int error;
   1735   1.1       mrg 
   1736  1.11       mrg 	NETBSD32TOP_UAP(addr, void);
   1737  1.11       mrg 	NETBSD32TOX_UAP(len, size_t);
   1738  1.11       mrg 	NETBSD32TO64_UAP(prot);
   1739  1.11       mrg 	NETBSD32TO64_UAP(flags);
   1740  1.11       mrg 	NETBSD32TO64_UAP(fd);
   1741  1.11       mrg 	NETBSD32TOX_UAP(pad, long);
   1742  1.11       mrg 	NETBSD32TOX_UAP(pos, off_t);
   1743  1.70   thorpej 	error = sys_mmap(l, &ua, retval);
   1744  1.69       scw 	if ((u_long)*retval > (u_long)UINT_MAX) {
   1745  1.69       scw 		printf("netbsd32_mmap: retval out of range: 0x%lx",
   1746  1.69       scw 		    (u_long)*retval);
   1747  1.55       eeh 		/* Should try to recover and return an error here. */
   1748  1.55       eeh 	}
   1749   1.1       mrg 	return (error);
   1750   1.1       mrg }
   1751   1.1       mrg 
   1752   1.1       mrg int
   1753  1.70   thorpej netbsd32_lseek(l, v, retval)
   1754  1.70   thorpej 	struct lwp *l;
   1755   1.6       eeh 	void *v;
   1756   1.6       eeh 	register_t *retval;
   1757   1.6       eeh {
   1758  1.19       eeh 	struct netbsd32_lseek_args /* {
   1759   1.6       eeh 		syscallarg(int) fd;
   1760   1.6       eeh 		syscallarg(int) pad;
   1761   1.6       eeh 		syscallarg(off_t) offset;
   1762   1.6       eeh 		syscallarg(int) whence;
   1763   1.6       eeh 	} */ *uap = v;
   1764   1.6       eeh 	struct sys_lseek_args ua;
   1765   1.6       eeh 
   1766  1.11       mrg 	NETBSD32TO64_UAP(fd);
   1767  1.11       mrg 	NETBSD32TO64_UAP(pad);
   1768  1.11       mrg 	NETBSD32TO64_UAP(offset);
   1769  1.11       mrg 	NETBSD32TO64_UAP(whence);
   1770  1.70   thorpej 	return (sys_lseek(l, &ua, retval));
   1771   1.6       eeh }
   1772   1.6       eeh 
   1773   1.6       eeh int
   1774  1.70   thorpej netbsd32_truncate(l, v, retval)
   1775  1.70   thorpej 	struct lwp *l;
   1776   1.1       mrg 	void *v;
   1777   1.1       mrg 	register_t *retval;
   1778   1.1       mrg {
   1779  1.19       eeh 	struct netbsd32_truncate_args /* {
   1780  1.10       mrg 		syscallarg(const netbsd32_charp) path;
   1781   1.1       mrg 		syscallarg(int) pad;
   1782   1.1       mrg 		syscallarg(off_t) length;
   1783   1.1       mrg 	} */ *uap = v;
   1784   1.1       mrg 	struct sys_truncate_args ua;
   1785   1.1       mrg 
   1786  1.11       mrg 	NETBSD32TOP_UAP(path, const char);
   1787  1.11       mrg 	NETBSD32TO64_UAP(pad);
   1788  1.11       mrg 	NETBSD32TO64_UAP(length);
   1789  1.70   thorpej 	return (sys_truncate(l, &ua, retval));
   1790   1.1       mrg }
   1791   1.1       mrg 
   1792   1.1       mrg int
   1793  1.70   thorpej netbsd32_ftruncate(l, v, retval)
   1794  1.70   thorpej 	struct lwp *l;
   1795   1.6       eeh 	void *v;
   1796   1.6       eeh 	register_t *retval;
   1797   1.6       eeh {
   1798  1.19       eeh 	struct netbsd32_ftruncate_args /* {
   1799   1.6       eeh 		syscallarg(int) fd;
   1800   1.6       eeh 		syscallarg(int) pad;
   1801   1.6       eeh 		syscallarg(off_t) length;
   1802   1.6       eeh 	} */ *uap = v;
   1803   1.6       eeh 	struct sys_ftruncate_args ua;
   1804   1.6       eeh 
   1805  1.11       mrg 	NETBSD32TO64_UAP(fd);
   1806  1.11       mrg 	NETBSD32TO64_UAP(pad);
   1807  1.11       mrg 	NETBSD32TO64_UAP(length);
   1808  1.70   thorpej 	return (sys_ftruncate(l, &ua, retval));
   1809   1.6       eeh }
   1810   1.6       eeh 
   1811  1.53       mrg int
   1812  1.70   thorpej netbsd32_mlock(l, v, retval)
   1813  1.70   thorpej 	struct lwp *l;
   1814  1.57       mrg 	void *v;
   1815  1.57       mrg 	register_t *retval;
   1816  1.53       mrg {
   1817  1.57       mrg 	struct netbsd32_mlock_args /* {
   1818  1.57       mrg 		syscallarg(const netbsd32_voidp) addr;
   1819  1.57       mrg 		syscallarg(netbsd32_size_t) len;
   1820  1.57       mrg 	} */ *uap = v;
   1821  1.57       mrg 	struct sys_mlock_args ua;
   1822  1.53       mrg 
   1823  1.57       mrg 	NETBSD32TOP_UAP(addr, const void);
   1824  1.57       mrg 	NETBSD32TO64_UAP(len);
   1825  1.70   thorpej 	return (sys_mlock(l, &ua, retval));
   1826  1.53       mrg }
   1827  1.53       mrg 
   1828   1.6       eeh int
   1829  1.70   thorpej netbsd32_munlock(l, v, retval)
   1830  1.70   thorpej 	struct lwp *l;
   1831   1.1       mrg 	void *v;
   1832   1.1       mrg 	register_t *retval;
   1833   1.1       mrg {
   1834  1.57       mrg 	struct netbsd32_munlock_args /* {
   1835  1.57       mrg 		syscallarg(const netbsd32_voidp) addr;
   1836  1.57       mrg 		syscallarg(netbsd32_size_t) len;
   1837   1.1       mrg 	} */ *uap = v;
   1838   1.1       mrg 	struct sys_munlock_args ua;
   1839   1.1       mrg 
   1840  1.11       mrg 	NETBSD32TOP_UAP(addr, const void);
   1841  1.11       mrg 	NETBSD32TO64_UAP(len);
   1842  1.70   thorpej 	return (sys_munlock(l, &ua, retval));
   1843   1.1       mrg }
   1844   1.1       mrg 
   1845   1.1       mrg int
   1846  1.70   thorpej netbsd32_undelete(l, v, retval)
   1847  1.70   thorpej 	struct lwp *l;
   1848   1.1       mrg 	void *v;
   1849   1.1       mrg 	register_t *retval;
   1850   1.1       mrg {
   1851  1.19       eeh 	struct netbsd32_undelete_args /* {
   1852  1.10       mrg 		syscallarg(const netbsd32_charp) path;
   1853   1.1       mrg 	} */ *uap = v;
   1854   1.1       mrg 	struct sys_undelete_args ua;
   1855   1.1       mrg 
   1856  1.11       mrg 	NETBSD32TOP_UAP(path, const char);
   1857  1.70   thorpej 	return (sys_undelete(l, &ua, retval));
   1858   1.1       mrg }
   1859   1.1       mrg 
   1860   1.6       eeh int
   1861  1.70   thorpej netbsd32_getpgid(l, v, retval)
   1862  1.70   thorpej 	struct lwp *l;
   1863   1.6       eeh 	void *v;
   1864   1.6       eeh 	register_t *retval;
   1865   1.6       eeh {
   1866  1.19       eeh 	struct netbsd32_getpgid_args /* {
   1867   1.6       eeh 		syscallarg(pid_t) pid;
   1868   1.6       eeh 	} */ *uap = v;
   1869   1.6       eeh 	struct sys_getpgid_args ua;
   1870   1.1       mrg 
   1871  1.11       mrg 	NETBSD32TO64_UAP(pid);
   1872  1.70   thorpej 	return (sys_getpgid(l, &ua, retval));
   1873   1.1       mrg }
   1874   1.1       mrg 
   1875   1.1       mrg int
   1876  1.70   thorpej netbsd32_reboot(l, v, retval)
   1877  1.70   thorpej 	struct lwp *l;
   1878   1.1       mrg 	void *v;
   1879   1.1       mrg 	register_t *retval;
   1880   1.1       mrg {
   1881  1.19       eeh 	struct netbsd32_reboot_args /* {
   1882   1.1       mrg 		syscallarg(int) opt;
   1883  1.10       mrg 		syscallarg(netbsd32_charp) bootstr;
   1884   1.1       mrg 	} */ *uap = v;
   1885   1.1       mrg 	struct sys_reboot_args ua;
   1886   1.1       mrg 
   1887  1.11       mrg 	NETBSD32TO64_UAP(opt);
   1888  1.11       mrg 	NETBSD32TOP_UAP(bootstr, char);
   1889  1.70   thorpej 	return (sys_reboot(l, &ua, retval));
   1890   1.1       mrg }
   1891   1.1       mrg 
   1892   1.1       mrg int
   1893  1.70   thorpej netbsd32_poll(l, v, retval)
   1894  1.70   thorpej 	struct lwp *l;
   1895   1.1       mrg 	void *v;
   1896   1.1       mrg 	register_t *retval;
   1897   1.1       mrg {
   1898  1.19       eeh 	struct netbsd32_poll_args /* {
   1899  1.10       mrg 		syscallarg(netbsd32_pollfdp_t) fds;
   1900   1.1       mrg 		syscallarg(u_int) nfds;
   1901   1.1       mrg 		syscallarg(int) timeout;
   1902   1.1       mrg 	} */ *uap = v;
   1903   1.1       mrg 	struct sys_poll_args ua;
   1904   1.1       mrg 
   1905  1.11       mrg 	NETBSD32TOP_UAP(fds, struct pollfd);
   1906  1.11       mrg 	NETBSD32TO64_UAP(nfds);
   1907  1.11       mrg 	NETBSD32TO64_UAP(timeout);
   1908  1.70   thorpej 	return (sys_poll(l, &ua, retval));
   1909   1.1       mrg }
   1910   1.1       mrg 
   1911   1.6       eeh int
   1912  1.70   thorpej netbsd32_fdatasync(l, v, retval)
   1913  1.70   thorpej 	struct lwp *l;
   1914   1.6       eeh 	void *v;
   1915   1.6       eeh 	register_t *retval;
   1916   1.6       eeh {
   1917  1.19       eeh 	struct netbsd32_fdatasync_args /* {
   1918   1.6       eeh 		syscallarg(int) fd;
   1919   1.6       eeh 	} */ *uap = v;
   1920   1.6       eeh 	struct sys_fdatasync_args ua;
   1921   1.6       eeh 
   1922  1.11       mrg 	NETBSD32TO64_UAP(fd);
   1923  1.70   thorpej 	return (sys_fdatasync(l, &ua, retval));
   1924   1.1       mrg }
   1925   1.1       mrg 
   1926   1.1       mrg int
   1927  1.70   thorpej netbsd32___posix_rename(l, v, retval)
   1928  1.70   thorpej 	struct lwp *l;
   1929   1.1       mrg 	void *v;
   1930   1.1       mrg 	register_t *retval;
   1931   1.1       mrg {
   1932  1.19       eeh 	struct netbsd32___posix_rename_args /* {
   1933  1.10       mrg 		syscallarg(const netbsd32_charp) from;
   1934  1.10       mrg 		syscallarg(const netbsd32_charp) to;
   1935   1.1       mrg 	} */ *uap = v;
   1936   1.1       mrg 	struct sys___posix_rename_args ua;
   1937   1.1       mrg 
   1938  1.20       eeh 	NETBSD32TOP_UAP(from, const char);
   1939  1.20       eeh 	NETBSD32TOP_UAP(to, const char);
   1940  1.70   thorpej 	return (sys___posix_rename(l, &ua, retval));
   1941   1.1       mrg }
   1942   1.1       mrg 
   1943   1.1       mrg int
   1944  1.70   thorpej netbsd32_swapctl(l, v, retval)
   1945  1.70   thorpej 	struct lwp *l;
   1946   1.1       mrg 	void *v;
   1947   1.1       mrg 	register_t *retval;
   1948   1.1       mrg {
   1949  1.19       eeh 	struct netbsd32_swapctl_args /* {
   1950   1.1       mrg 		syscallarg(int) cmd;
   1951  1.10       mrg 		syscallarg(const netbsd32_voidp) arg;
   1952   1.1       mrg 		syscallarg(int) misc;
   1953   1.1       mrg 	} */ *uap = v;
   1954   1.1       mrg 	struct sys_swapctl_args ua;
   1955   1.1       mrg 
   1956  1.11       mrg 	NETBSD32TO64_UAP(cmd);
   1957  1.89       chs 	NETBSD32TOP_UAP(arg, void);
   1958  1.11       mrg 	NETBSD32TO64_UAP(misc);
   1959  1.70   thorpej 	return (sys_swapctl(l, &ua, retval));
   1960   1.1       mrg }
   1961   1.1       mrg 
   1962   1.1       mrg int
   1963  1.70   thorpej netbsd32_minherit(l, v, retval)
   1964  1.70   thorpej 	struct lwp *l;
   1965   1.1       mrg 	void *v;
   1966   1.1       mrg 	register_t *retval;
   1967   1.1       mrg {
   1968  1.19       eeh 	struct netbsd32_minherit_args /* {
   1969  1.10       mrg 		syscallarg(netbsd32_voidp) addr;
   1970  1.10       mrg 		syscallarg(netbsd32_size_t) len;
   1971   1.1       mrg 		syscallarg(int) inherit;
   1972   1.1       mrg 	} */ *uap = v;
   1973   1.1       mrg 	struct sys_minherit_args ua;
   1974   1.1       mrg 
   1975  1.11       mrg 	NETBSD32TOP_UAP(addr, void);
   1976  1.11       mrg 	NETBSD32TOX_UAP(len, size_t);
   1977  1.11       mrg 	NETBSD32TO64_UAP(inherit);
   1978  1.70   thorpej 	return (sys_minherit(l, &ua, retval));
   1979   1.1       mrg }
   1980   1.1       mrg 
   1981   1.1       mrg int
   1982  1.70   thorpej netbsd32_lchmod(l, v, retval)
   1983  1.70   thorpej 	struct lwp *l;
   1984   1.1       mrg 	void *v;
   1985   1.1       mrg 	register_t *retval;
   1986   1.1       mrg {
   1987  1.19       eeh 	struct netbsd32_lchmod_args /* {
   1988  1.10       mrg 		syscallarg(const netbsd32_charp) path;
   1989   1.1       mrg 		syscallarg(mode_t) mode;
   1990   1.1       mrg 	} */ *uap = v;
   1991   1.1       mrg 	struct sys_lchmod_args ua;
   1992   1.1       mrg 
   1993  1.11       mrg 	NETBSD32TOP_UAP(path, const char);
   1994  1.11       mrg 	NETBSD32TO64_UAP(mode);
   1995  1.70   thorpej 	return (sys_lchmod(l, &ua, retval));
   1996   1.1       mrg }
   1997   1.1       mrg 
   1998   1.1       mrg int
   1999  1.70   thorpej netbsd32_lchown(l, v, retval)
   2000  1.70   thorpej 	struct lwp *l;
   2001   1.1       mrg 	void *v;
   2002   1.1       mrg 	register_t *retval;
   2003   1.1       mrg {
   2004  1.19       eeh 	struct netbsd32_lchown_args /* {
   2005  1.10       mrg 		syscallarg(const netbsd32_charp) path;
   2006   1.1       mrg 		syscallarg(uid_t) uid;
   2007   1.1       mrg 		syscallarg(gid_t) gid;
   2008   1.1       mrg 	} */ *uap = v;
   2009   1.1       mrg 	struct sys_lchown_args ua;
   2010   1.1       mrg 
   2011  1.11       mrg 	NETBSD32TOP_UAP(path, const char);
   2012  1.11       mrg 	NETBSD32TO64_UAP(uid);
   2013  1.11       mrg 	NETBSD32TO64_UAP(gid);
   2014  1.70   thorpej 	return (sys_lchown(l, &ua, retval));
   2015   1.1       mrg }
   2016   1.1       mrg 
   2017   1.1       mrg int
   2018  1.70   thorpej netbsd32___msync13(l, v, retval)
   2019  1.70   thorpej 	struct lwp *l;
   2020   1.1       mrg 	void *v;
   2021   1.1       mrg 	register_t *retval;
   2022   1.1       mrg {
   2023  1.19       eeh 	struct netbsd32___msync13_args /* {
   2024  1.10       mrg 		syscallarg(netbsd32_voidp) addr;
   2025  1.10       mrg 		syscallarg(netbsd32_size_t) len;
   2026   1.1       mrg 		syscallarg(int) flags;
   2027   1.1       mrg 	} */ *uap = v;
   2028   1.1       mrg 	struct sys___msync13_args ua;
   2029   1.1       mrg 
   2030  1.11       mrg 	NETBSD32TOP_UAP(addr, void);
   2031  1.11       mrg 	NETBSD32TOX_UAP(len, size_t);
   2032  1.11       mrg 	NETBSD32TO64_UAP(flags);
   2033  1.70   thorpej 	return (sys___msync13(l, &ua, retval));
   2034   1.1       mrg }
   2035   1.1       mrg 
   2036   1.1       mrg int
   2037  1.70   thorpej netbsd32___posix_chown(l, v, retval)
   2038  1.70   thorpej 	struct lwp *l;
   2039   1.1       mrg 	void *v;
   2040   1.1       mrg 	register_t *retval;
   2041   1.1       mrg {
   2042  1.19       eeh 	struct netbsd32___posix_chown_args /* {
   2043  1.10       mrg 		syscallarg(const netbsd32_charp) path;
   2044   1.1       mrg 		syscallarg(uid_t) uid;
   2045   1.1       mrg 		syscallarg(gid_t) gid;
   2046   1.1       mrg 	} */ *uap = v;
   2047   1.1       mrg 	struct sys___posix_chown_args ua;
   2048   1.1       mrg 
   2049  1.11       mrg 	NETBSD32TOP_UAP(path, const char);
   2050  1.11       mrg 	NETBSD32TO64_UAP(uid);
   2051  1.11       mrg 	NETBSD32TO64_UAP(gid);
   2052  1.70   thorpej 	return (sys___posix_chown(l, &ua, retval));
   2053   1.1       mrg }
   2054   1.1       mrg 
   2055   1.1       mrg int
   2056  1.70   thorpej netbsd32___posix_fchown(l, v, retval)
   2057  1.70   thorpej 	struct lwp *l;
   2058   1.6       eeh 	void *v;
   2059   1.6       eeh 	register_t *retval;
   2060   1.6       eeh {
   2061  1.19       eeh 	struct netbsd32___posix_fchown_args /* {
   2062   1.6       eeh 		syscallarg(int) fd;
   2063   1.6       eeh 		syscallarg(uid_t) uid;
   2064   1.6       eeh 		syscallarg(gid_t) gid;
   2065   1.6       eeh 	} */ *uap = v;
   2066   1.6       eeh 	struct sys___posix_fchown_args ua;
   2067   1.6       eeh 
   2068  1.11       mrg 	NETBSD32TO64_UAP(fd);
   2069  1.11       mrg 	NETBSD32TO64_UAP(uid);
   2070  1.11       mrg 	NETBSD32TO64_UAP(gid);
   2071  1.70   thorpej 	return (sys___posix_fchown(l, &ua, retval));
   2072   1.6       eeh }
   2073   1.6       eeh 
   2074   1.6       eeh int
   2075  1.70   thorpej netbsd32___posix_lchown(l, v, retval)
   2076  1.70   thorpej 	struct lwp *l;
   2077   1.1       mrg 	void *v;
   2078   1.1       mrg 	register_t *retval;
   2079   1.1       mrg {
   2080  1.19       eeh 	struct netbsd32___posix_lchown_args /* {
   2081  1.10       mrg 		syscallarg(const netbsd32_charp) path;
   2082   1.1       mrg 		syscallarg(uid_t) uid;
   2083   1.1       mrg 		syscallarg(gid_t) gid;
   2084   1.1       mrg 	} */ *uap = v;
   2085   1.1       mrg 	struct sys___posix_lchown_args ua;
   2086   1.1       mrg 
   2087  1.11       mrg 	NETBSD32TOP_UAP(path, const char);
   2088  1.11       mrg 	NETBSD32TO64_UAP(uid);
   2089  1.11       mrg 	NETBSD32TO64_UAP(gid);
   2090  1.70   thorpej 	return (sys___posix_lchown(l, &ua, retval));
   2091   1.1       mrg }
   2092   1.1       mrg 
   2093   1.1       mrg int
   2094  1.70   thorpej netbsd32_getsid(l, v, retval)
   2095  1.70   thorpej 	struct lwp *l;
   2096   1.6       eeh 	void *v;
   2097   1.6       eeh 	register_t *retval;
   2098   1.6       eeh {
   2099  1.19       eeh 	struct netbsd32_getsid_args /* {
   2100   1.6       eeh 		syscallarg(pid_t) pid;
   2101   1.6       eeh 	} */ *uap = v;
   2102   1.6       eeh 	struct sys_getsid_args ua;
   2103   1.6       eeh 
   2104  1.11       mrg 	NETBSD32TO64_UAP(pid);
   2105  1.70   thorpej 	return (sys_getsid(l, &ua, retval));
   2106   1.6       eeh }
   2107   1.6       eeh 
   2108  1.42  jdolecek #ifdef KTRACE
   2109   1.6       eeh int
   2110  1.70   thorpej netbsd32_fktrace(l, v, retval)
   2111  1.70   thorpej 	struct lwp *l;
   2112   1.6       eeh 	void *v;
   2113   1.6       eeh 	register_t *retval;
   2114   1.6       eeh {
   2115  1.19       eeh 	struct netbsd32_fktrace_args /* {
   2116   1.6       eeh 		syscallarg(const int) fd;
   2117   1.6       eeh 		syscallarg(int) ops;
   2118   1.6       eeh 		syscallarg(int) facs;
   2119   1.6       eeh 		syscallarg(int) pid;
   2120   1.6       eeh 	} */ *uap = v;
   2121  1.43      fvdl #if 0
   2122   1.6       eeh 	struct sys_fktrace_args ua;
   2123  1.43      fvdl #else
   2124  1.43      fvdl 	/* XXXX */
   2125  1.43      fvdl 	struct sys_fktrace_noconst_args {
   2126  1.43      fvdl 		syscallarg(int) fd;
   2127  1.43      fvdl 		syscallarg(int) ops;
   2128  1.43      fvdl 		syscallarg(int) facs;
   2129  1.43      fvdl 		syscallarg(int) pid;
   2130  1.43      fvdl 	} ua;
   2131  1.43      fvdl #endif
   2132   1.6       eeh 
   2133  1.32       mrg 	NETBSD32TOX_UAP(fd, int);
   2134  1.11       mrg 	NETBSD32TO64_UAP(ops);
   2135  1.11       mrg 	NETBSD32TO64_UAP(facs);
   2136  1.11       mrg 	NETBSD32TO64_UAP(pid);
   2137  1.70   thorpej 	return (sys_fktrace(l, &ua, retval));
   2138   1.6       eeh }
   2139  1.42  jdolecek #endif /* KTRACE */
   2140   1.6       eeh 
   2141  1.87     perry int netbsd32___sigpending14(l, v, retval)
   2142  1.70   thorpej 	struct lwp *l;
   2143  1.20       eeh 	void   *v;
   2144  1.20       eeh 	register_t *retval;
   2145  1.20       eeh {
   2146  1.25  augustss 	struct netbsd32___sigpending14_args /* {
   2147  1.20       eeh 		syscallarg(sigset_t *) set;
   2148  1.20       eeh 	} */ *uap = v;
   2149  1.20       eeh 	struct sys___sigpending14_args ua;
   2150  1.20       eeh 
   2151  1.20       eeh 	NETBSD32TOP_UAP(set, sigset_t);
   2152  1.70   thorpej 	return (sys___sigpending14(l, &ua, retval));
   2153  1.20       eeh }
   2154  1.20       eeh 
   2155  1.87     perry int netbsd32___sigprocmask14(l, v, retval)
   2156  1.70   thorpej 	struct lwp *l;
   2157  1.20       eeh 	void   *v;
   2158  1.20       eeh 	register_t *retval;
   2159  1.20       eeh {
   2160  1.25  augustss 	struct netbsd32___sigprocmask14_args /* {
   2161  1.20       eeh 		syscallarg(int) how;
   2162  1.20       eeh 		syscallarg(const sigset_t *) set;
   2163  1.20       eeh 		syscallarg(sigset_t *) oset;
   2164  1.20       eeh 	} */ *uap = v;
   2165  1.20       eeh 	struct sys___sigprocmask14_args ua;
   2166  1.20       eeh 
   2167  1.20       eeh 	NETBSD32TO64_UAP(how);
   2168  1.20       eeh 	NETBSD32TOP_UAP(set, sigset_t);
   2169  1.20       eeh 	NETBSD32TOP_UAP(oset, sigset_t);
   2170  1.70   thorpej 	return (sys___sigprocmask14(l, &ua, retval));
   2171  1.20       eeh }
   2172  1.20       eeh 
   2173  1.87     perry int netbsd32___sigsuspend14(l, v, retval)
   2174  1.70   thorpej 	struct lwp *l;
   2175  1.20       eeh 	void   *v;
   2176  1.20       eeh 	register_t *retval;
   2177  1.20       eeh {
   2178  1.20       eeh 	struct netbsd32___sigsuspend14_args /* {
   2179  1.20       eeh 		syscallarg(const sigset_t *) set;
   2180  1.20       eeh 	} */ *uap = v;
   2181  1.20       eeh 	struct sys___sigsuspend14_args ua;
   2182  1.20       eeh 
   2183  1.20       eeh 	NETBSD32TOP_UAP(set, sigset_t);
   2184  1.70   thorpej 	return (sys___sigsuspend14(l, &ua, retval));
   2185  1.20       eeh };
   2186  1.20       eeh 
   2187  1.70   thorpej int netbsd32_fchroot(l, v, retval)
   2188  1.70   thorpej 	struct lwp *l;
   2189  1.20       eeh 	void *v;
   2190  1.20       eeh 	register_t *retval;
   2191  1.20       eeh {
   2192  1.25  augustss 	struct netbsd32_fchroot_args /* {
   2193  1.20       eeh 		syscallarg(int) fd;
   2194  1.20       eeh 	} */ *uap = v;
   2195  1.20       eeh 	struct sys_fchroot_args ua;
   2196  1.87     perry 
   2197  1.20       eeh 	NETBSD32TO64_UAP(fd);
   2198  1.70   thorpej 	return (sys_fchroot(l, &ua, retval));
   2199  1.20       eeh }
   2200  1.20       eeh 
   2201  1.20       eeh /*
   2202  1.20       eeh  * Open a file given a file handle.
   2203  1.20       eeh  *
   2204  1.20       eeh  * Check permissions, allocate an open file structure,
   2205  1.20       eeh  * and call the device open routine if any.
   2206  1.20       eeh  */
   2207   1.6       eeh int
   2208  1.70   thorpej netbsd32_fhopen(l, v, retval)
   2209  1.70   thorpej 	struct lwp *l;
   2210  1.20       eeh 	void *v;
   2211  1.20       eeh 	register_t *retval;
   2212  1.20       eeh {
   2213  1.25  augustss 	struct netbsd32_fhopen_args /* {
   2214  1.20       eeh 		syscallarg(const fhandle_t *) fhp;
   2215  1.20       eeh 		syscallarg(int) flags;
   2216  1.20       eeh 	} */ *uap = v;
   2217  1.20       eeh 	struct sys_fhopen_args ua;
   2218  1.20       eeh 
   2219  1.20       eeh 	NETBSD32TOP_UAP(fhp, fhandle_t);
   2220  1.20       eeh 	NETBSD32TO64_UAP(flags);
   2221  1.70   thorpej 	return (sys_fhopen(l, &ua, retval));
   2222  1.20       eeh }
   2223  1.20       eeh 
   2224  1.70   thorpej int netbsd32_fhstat(l, v, retval)
   2225  1.70   thorpej 	struct lwp *l;
   2226  1.20       eeh 	void *v;
   2227  1.20       eeh 	register_t *retval;
   2228  1.20       eeh {
   2229  1.25  augustss 	struct netbsd32_fhstat_args /* {
   2230  1.20       eeh 		syscallarg(const netbsd32_fhandlep_t) fhp;
   2231  1.20       eeh 		syscallarg(struct stat *) sb;
   2232  1.20       eeh 	} */ *uap = v;
   2233  1.20       eeh 	struct sys_fhstat_args ua;
   2234  1.20       eeh 
   2235  1.20       eeh 	NETBSD32TOP_UAP(fhp, const fhandle_t);
   2236  1.20       eeh 	NETBSD32TOP_UAP(sb, struct stat);
   2237  1.70   thorpej 	return (sys_fhstat(l, &ua, retval));
   2238  1.20       eeh }
   2239  1.20       eeh 
   2240  1.37    martin /* virtual memory syscalls */
   2241  1.37    martin int
   2242  1.70   thorpej netbsd32_ovadvise(l, v, retval)
   2243  1.70   thorpej 	struct lwp *l;
   2244  1.37    martin 	void *v;
   2245  1.37    martin 	register_t *retval;
   2246  1.37    martin {
   2247  1.37    martin 	struct netbsd32_ovadvise_args /* {
   2248  1.37    martin 		syscallarg(int) anom;
   2249  1.37    martin 	} */ *uap = v;
   2250  1.37    martin 	struct sys_ovadvise_args ua;
   2251  1.37    martin 
   2252  1.37    martin 	NETBSD32TO64_UAP(anom);
   2253  1.70   thorpej 	return (sys_ovadvise(l, &ua, retval));
   2254  1.37    martin }
   2255  1.37    martin 
   2256  1.88      fvdl void
   2257  1.88      fvdl netbsd32_adjust_limits(struct proc *p)
   2258  1.88      fvdl {
   2259  1.88      fvdl 	rlim_t *valp;
   2260  1.88      fvdl 
   2261  1.88      fvdl 	valp = &p->p_rlimit[RLIMIT_DATA].rlim_cur;
   2262  1.88      fvdl 	if (*valp != RLIM_INFINITY && *valp > MAXDSIZ32)
   2263  1.88      fvdl 		*valp = MAXDSIZ32;
   2264  1.88      fvdl 	valp = &p->p_rlimit[RLIMIT_DATA].rlim_max;
   2265  1.88      fvdl 	if (*valp != RLIM_INFINITY && *valp > MAXDSIZ32)
   2266  1.88      fvdl 		*valp = MAXDSIZ32;
   2267  1.88      fvdl 
   2268  1.88      fvdl 	valp = &p->p_rlimit[RLIMIT_STACK].rlim_cur;
   2269  1.88      fvdl 	if (*valp != RLIM_INFINITY && *valp > MAXSSIZ32)
   2270  1.88      fvdl 		*valp = MAXSSIZ32;
   2271  1.88      fvdl 	valp = &p->p_rlimit[RLIMIT_STACK].rlim_max;
   2272  1.88      fvdl 	if (*valp != RLIM_INFINITY && *valp > MAXSSIZ32)
   2273  1.88      fvdl 		*valp = MAXSSIZ32;
   2274  1.88      fvdl }
   2275  1.90      cube 
   2276  1.90      cube int
   2277  1.90      cube netbsd32_uuidgen(struct lwp *l, void *v, register_t *retval)
   2278  1.90      cube {
   2279  1.90      cube 	struct netbsd32_uuidgen_args /* {
   2280  1.90      cube 		syscallarg(netbsd32_uuidp_t) store;
   2281  1.90      cube 		syscallarg(int) count;
   2282  1.90      cube 	} */ *uap = v;
   2283  1.90      cube 	struct sys_uuidgen_args ua;
   2284  1.90      cube 
   2285  1.90      cube 	NETBSD32TOP_UAP(store, struct uuid);
   2286  1.90      cube 	NETBSD32TO64_UAP(count);
   2287  1.90      cube 	return (sys_uuidgen(l, &ua, retval));
   2288  1.90      cube }
   2289