Home | History | Annotate | Line # | Download | only in netbsd32
netbsd32_netbsd.c revision 1.100.4.5
      1  1.100.4.5      elad /*	$NetBSD: netbsd32_netbsd.c,v 1.100.4.5 2006/05/11 23:27:31 elad 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.100.4.5      elad __KERNEL_RCSID(0, "$NetBSD: netbsd32_netbsd.c,v 1.100.4.5 2006/05/11 23:27:31 elad 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.98  christos #include <sys/dirent.h>
     78       1.29       mrg 
     79       1.29       mrg #include <uvm/uvm_extern.h>
     80       1.29       mrg 
     81       1.70   thorpej #include <sys/sa.h>
     82  1.100.4.4      elad #include <sys/savar.h>
     83        1.1       mrg #include <sys/syscallargs.h>
     84        1.6       eeh #include <sys/proc.h>
     85       1.20       eeh #include <sys/acct.h>
     86       1.20       eeh #include <sys/exec.h>
     87        1.1       mrg 
     88        1.1       mrg #include <net/if.h>
     89        1.1       mrg 
     90       1.10       mrg #include <compat/netbsd32/netbsd32.h>
     91       1.75  christos #include <compat/netbsd32/netbsd32_exec.h>
     92       1.42  jdolecek #include <compat/netbsd32/netbsd32_syscall.h>
     93       1.10       mrg #include <compat/netbsd32/netbsd32_syscallargs.h>
     94       1.56       mrg #include <compat/netbsd32/netbsd32_conv.h>
     95  1.100.4.4      elad #include <compat/netbsd32/netbsd32_sa.h>
     96        1.1       mrg 
     97        1.4       eeh #include <machine/frame.h>
     98       1.28       eeh 
     99       1.28       eeh #if defined(DDB)
    100       1.28       eeh #include <ddb/ddbvar.h>
    101       1.28       eeh #endif
    102        1.4       eeh 
    103       1.42  jdolecek extern struct sysent netbsd32_sysent[];
    104       1.42  jdolecek #ifdef SYSCALL_DEBUG
    105       1.42  jdolecek extern const char * const netbsd32_syscallnames[];
    106       1.42  jdolecek #endif
    107       1.46   mycroft #ifdef __HAVE_SYSCALL_INTERN
    108       1.60      fvdl void netbsd32_syscall_intern __P((struct proc *));
    109       1.46   mycroft #else
    110       1.45  jdolecek void syscall __P((void));
    111       1.46   mycroft #endif
    112       1.42  jdolecek 
    113       1.82  drochner #ifdef COMPAT_16
    114       1.82  drochner extern char netbsd32_sigcode[], netbsd32_esigcode[];
    115       1.74       chs struct uvm_object *emul_netbsd32_object;
    116       1.82  drochner #endif
    117       1.82  drochner 
    118       1.77    atatat extern struct sysctlnode netbsd32_sysctl_root;
    119       1.74       chs 
    120  1.100.4.4      elad const struct sa_emul saemul_netbsd32 = {
    121  1.100.4.4      elad 	sizeof(ucontext32_t),
    122  1.100.4.4      elad 	sizeof(struct netbsd32_sa_t),
    123  1.100.4.4      elad 	sizeof(netbsd32_sa_tp),
    124  1.100.4.4      elad 	netbsd32_sacopyout,
    125  1.100.4.4      elad 	netbsd32_upcallconv,
    126  1.100.4.4      elad 	netbsd32_cpu_upcall,
    127  1.100.4.4      elad 	(void (*)(struct lwp *, void *))getucontext32,
    128  1.100.4.4      elad 	netbsd32_sa_ucsp
    129  1.100.4.4      elad };
    130  1.100.4.4      elad 
    131       1.42  jdolecek const struct emul emul_netbsd32 = {
    132       1.42  jdolecek 	"netbsd32",
    133       1.42  jdolecek 	"/emul/netbsd32",
    134       1.46   mycroft #ifndef __HAVE_MINIMAL_EMUL
    135       1.46   mycroft 	0,
    136       1.42  jdolecek 	NULL,
    137       1.42  jdolecek 	netbsd32_SYS_syscall,
    138       1.67  jdolecek 	netbsd32_SYS_NSYSENT,
    139       1.46   mycroft #endif
    140       1.42  jdolecek 	netbsd32_sysent,
    141       1.42  jdolecek #ifdef SYSCALL_DEBUG
    142       1.42  jdolecek 	netbsd32_syscallnames,
    143       1.42  jdolecek #else
    144       1.42  jdolecek 	NULL,
    145       1.42  jdolecek #endif
    146       1.46   mycroft 	netbsd32_sendsig,
    147       1.59  christos 	trapsignal,
    148       1.80      fvdl 	NULL,
    149       1.82  drochner #ifdef COMPAT_16
    150       1.42  jdolecek 	netbsd32_sigcode,
    151       1.42  jdolecek 	netbsd32_esigcode,
    152       1.74       chs 	&emul_netbsd32_object,
    153       1.82  drochner #else
    154       1.82  drochner 	NULL,
    155       1.82  drochner 	NULL,
    156       1.82  drochner 	NULL,
    157       1.82  drochner #endif
    158       1.61  jdolecek 	netbsd32_setregs,
    159       1.45  jdolecek 	NULL,
    160       1.45  jdolecek 	NULL,
    161       1.45  jdolecek 	NULL,
    162       1.79      manu 	NULL,
    163       1.79      manu 	NULL,
    164       1.46   mycroft #ifdef __HAVE_SYSCALL_INTERN
    165       1.60      fvdl 	netbsd32_syscall_intern,
    166       1.46   mycroft #else
    167       1.46   mycroft 	syscall,
    168       1.46   mycroft #endif
    169       1.77    atatat 	&netbsd32_sysctl_root,
    170       1.65      manu 	NULL,
    171       1.88      fvdl 
    172       1.88      fvdl 	netbsd32_vm_default_addr,
    173  1.100.4.4      elad 	NULL,
    174  1.100.4.4      elad 	&saemul_netbsd32,
    175       1.42  jdolecek };
    176       1.42  jdolecek 
    177        1.1       mrg /*
    178        1.1       mrg  * below are all the standard NetBSD system calls, in the 32bit
    179       1.32       mrg  * environment, with the necessary conversions to 64bit before
    180       1.57       mrg  * calling the real syscall.  anything that needs special
    181       1.57       mrg  * attention is handled elsewhere.
    182        1.1       mrg  */
    183        1.1       mrg 
    184        1.6       eeh int
    185       1.70   thorpej netbsd32_exit(l, v, retval)
    186       1.70   thorpej 	struct lwp *l;
    187        1.6       eeh 	void *v;
    188        1.6       eeh 	register_t *retval;
    189        1.6       eeh {
    190       1.19       eeh 	struct netbsd32_exit_args /* {
    191        1.6       eeh 		syscallarg(int) rval;
    192        1.6       eeh 	} */ *uap = v;
    193        1.6       eeh 	struct sys_exit_args ua;
    194        1.6       eeh 
    195       1.11       mrg 	NETBSD32TO64_UAP(rval);
    196       1.70   thorpej 	return sys_exit(l, &ua, retval);
    197        1.6       eeh }
    198        1.6       eeh 
    199        1.1       mrg int
    200       1.70   thorpej netbsd32_read(l, v, retval)
    201       1.70   thorpej 	struct lwp *l;
    202        1.1       mrg 	void *v;
    203        1.1       mrg 	register_t *retval;
    204        1.1       mrg {
    205       1.19       eeh 	struct netbsd32_read_args /* {
    206        1.1       mrg 		syscallarg(int) fd;
    207       1.10       mrg 		syscallarg(netbsd32_voidp) buf;
    208       1.10       mrg 		syscallarg(netbsd32_size_t) nbyte;
    209        1.1       mrg 	} */ *uap = v;
    210        1.1       mrg 	struct sys_read_args ua;
    211        1.1       mrg 
    212       1.11       mrg 	NETBSD32TO64_UAP(fd);
    213       1.11       mrg 	NETBSD32TOP_UAP(buf, void *);
    214       1.11       mrg 	NETBSD32TOX_UAP(nbyte, size_t);
    215       1.70   thorpej 	return sys_read(l, &ua, retval);
    216        1.1       mrg }
    217        1.1       mrg 
    218        1.1       mrg int
    219       1.70   thorpej netbsd32_write(l, v, retval)
    220       1.70   thorpej 	struct lwp *l;
    221        1.1       mrg 	void *v;
    222        1.1       mrg 	register_t *retval;
    223        1.1       mrg {
    224       1.19       eeh 	struct netbsd32_write_args /* {
    225        1.1       mrg 		syscallarg(int) fd;
    226       1.10       mrg 		syscallarg(const netbsd32_voidp) buf;
    227       1.10       mrg 		syscallarg(netbsd32_size_t) nbyte;
    228        1.1       mrg 	} */ *uap = v;
    229        1.1       mrg 	struct sys_write_args ua;
    230        1.1       mrg 
    231       1.11       mrg 	NETBSD32TO64_UAP(fd);
    232       1.11       mrg 	NETBSD32TOP_UAP(buf, void *);
    233       1.11       mrg 	NETBSD32TOX_UAP(nbyte, size_t);
    234       1.70   thorpej 	return sys_write(l, &ua, retval);
    235        1.6       eeh }
    236        1.6       eeh 
    237        1.6       eeh int
    238       1.70   thorpej netbsd32_close(l, v, retval)
    239       1.70   thorpej 	struct lwp *l;
    240        1.6       eeh 	void *v;
    241        1.6       eeh 	register_t *retval;
    242        1.6       eeh {
    243       1.19       eeh 	struct netbsd32_close_args /* {
    244        1.6       eeh 		syscallarg(int) fd;
    245        1.6       eeh 	} */ *uap = v;
    246        1.6       eeh 	struct sys_close_args ua;
    247        1.1       mrg 
    248       1.11       mrg 	NETBSD32TO64_UAP(fd);
    249       1.70   thorpej 	return sys_close(l, &ua, retval);
    250        1.1       mrg }
    251        1.1       mrg 
    252        1.1       mrg int
    253       1.70   thorpej netbsd32_open(l, v, retval)
    254       1.70   thorpej 	struct lwp *l;
    255        1.1       mrg 	void *v;
    256        1.1       mrg 	register_t *retval;
    257        1.1       mrg {
    258       1.19       eeh 	struct netbsd32_open_args /* {
    259       1.10       mrg 		syscallarg(const netbsd32_charp) path;
    260        1.1       mrg 		syscallarg(int) flags;
    261        1.1       mrg 		syscallarg(mode_t) mode;
    262        1.1       mrg 	} */ *uap = v;
    263        1.1       mrg 	struct sys_open_args ua;
    264        1.1       mrg 	caddr_t sg;
    265        1.1       mrg 
    266       1.11       mrg 	NETBSD32TOP_UAP(path, const char);
    267       1.11       mrg 	NETBSD32TO64_UAP(flags);
    268       1.11       mrg 	NETBSD32TO64_UAP(mode);
    269       1.70   thorpej 	sg = stackgap_init(l->l_proc, 0);
    270       1.99  christos 	CHECK_ALT_EXIST(l, &sg, SCARG(&ua, path));
    271        1.1       mrg 
    272       1.70   thorpej 	return (sys_open(l, &ua, retval));
    273        1.1       mrg }
    274        1.1       mrg 
    275        1.1       mrg int
    276       1.70   thorpej netbsd32_link(l, v, retval)
    277       1.70   thorpej 	struct lwp *l;
    278        1.1       mrg 	void *v;
    279        1.1       mrg 	register_t *retval;
    280        1.1       mrg {
    281       1.19       eeh 	struct netbsd32_link_args /* {
    282       1.10       mrg 		syscallarg(const netbsd32_charp) path;
    283       1.10       mrg 		syscallarg(const netbsd32_charp) link;
    284        1.1       mrg 	} */ *uap = v;
    285        1.1       mrg 	struct sys_link_args ua;
    286        1.1       mrg 
    287       1.11       mrg 	NETBSD32TOP_UAP(path, const char);
    288       1.11       mrg 	NETBSD32TOP_UAP(link, const char);
    289       1.70   thorpej 	return (sys_link(l, &ua, retval));
    290        1.1       mrg }
    291        1.1       mrg 
    292        1.1       mrg int
    293       1.70   thorpej netbsd32_unlink(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_unlink_args /* {
    299       1.10       mrg 		syscallarg(const netbsd32_charp) path;
    300        1.1       mrg 	} */ *uap = v;
    301        1.1       mrg 	struct sys_unlink_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_unlink(l, &ua, retval));
    306        1.1       mrg }
    307        1.1       mrg 
    308        1.1       mrg int
    309       1.70   thorpej netbsd32_chdir(l, v, retval)
    310       1.70   thorpej 	struct lwp *l;
    311        1.1       mrg 	void *v;
    312        1.1       mrg 	register_t *retval;
    313        1.1       mrg {
    314       1.19       eeh 	struct netbsd32_chdir_args /* {
    315       1.10       mrg 		syscallarg(const netbsd32_charp) path;
    316        1.1       mrg 	} */ *uap = v;
    317        1.1       mrg 	struct sys_chdir_args ua;
    318        1.1       mrg 
    319       1.11       mrg 	NETBSD32TOP_UAP(path, const char);
    320        1.1       mrg 
    321       1.70   thorpej 	return (sys_chdir(l, &ua, retval));
    322        1.1       mrg }
    323        1.1       mrg 
    324        1.1       mrg int
    325       1.70   thorpej netbsd32_fchdir(l, v, retval)
    326       1.70   thorpej 	struct lwp *l;
    327        1.6       eeh 	void *v;
    328        1.6       eeh 	register_t *retval;
    329        1.6       eeh {
    330       1.19       eeh 	struct netbsd32_fchdir_args /* {
    331        1.6       eeh 		syscallarg(int) fd;
    332        1.6       eeh 	} */ *uap = v;
    333        1.6       eeh 	struct sys_fchdir_args ua;
    334        1.6       eeh 
    335       1.11       mrg 	NETBSD32TO64_UAP(fd);
    336        1.6       eeh 
    337       1.70   thorpej 	return (sys_fchdir(l, &ua, retval));
    338        1.6       eeh }
    339        1.6       eeh 
    340        1.6       eeh int
    341       1.70   thorpej netbsd32_mknod(l, v, retval)
    342       1.70   thorpej 	struct lwp *l;
    343        1.1       mrg 	void *v;
    344        1.1       mrg 	register_t *retval;
    345        1.1       mrg {
    346       1.19       eeh 	struct netbsd32_mknod_args /* {
    347       1.10       mrg 		syscallarg(const netbsd32_charp) path;
    348        1.1       mrg 		syscallarg(mode_t) mode;
    349        1.1       mrg 		syscallarg(dev_t) dev;
    350        1.1       mrg 	} */ *uap = v;
    351        1.1       mrg 	struct sys_mknod_args ua;
    352        1.1       mrg 
    353       1.11       mrg 	NETBSD32TOP_UAP(path, const char);
    354       1.11       mrg 	NETBSD32TO64_UAP(dev);
    355       1.11       mrg 	NETBSD32TO64_UAP(mode);
    356        1.1       mrg 
    357       1.70   thorpej 	return (sys_mknod(l, &ua, retval));
    358        1.1       mrg }
    359        1.1       mrg 
    360        1.1       mrg int
    361       1.70   thorpej netbsd32_chmod(l, v, retval)
    362       1.70   thorpej 	struct lwp *l;
    363        1.1       mrg 	void *v;
    364        1.1       mrg 	register_t *retval;
    365        1.1       mrg {
    366       1.19       eeh 	struct netbsd32_chmod_args /* {
    367       1.10       mrg 		syscallarg(const netbsd32_charp) path;
    368        1.1       mrg 		syscallarg(mode_t) mode;
    369        1.1       mrg 	} */ *uap = v;
    370        1.1       mrg 	struct sys_chmod_args ua;
    371        1.1       mrg 
    372       1.11       mrg 	NETBSD32TOP_UAP(path, const char);
    373       1.11       mrg 	NETBSD32TO64_UAP(mode);
    374        1.1       mrg 
    375       1.70   thorpej 	return (sys_chmod(l, &ua, retval));
    376        1.1       mrg }
    377        1.1       mrg 
    378        1.1       mrg int
    379       1.70   thorpej netbsd32_chown(l, v, retval)
    380       1.70   thorpej 	struct lwp *l;
    381        1.1       mrg 	void *v;
    382        1.1       mrg 	register_t *retval;
    383        1.1       mrg {
    384       1.19       eeh 	struct netbsd32_chown_args /* {
    385       1.10       mrg 		syscallarg(const netbsd32_charp) path;
    386        1.1       mrg 		syscallarg(uid_t) uid;
    387        1.1       mrg 		syscallarg(gid_t) gid;
    388        1.1       mrg 	} */ *uap = v;
    389        1.1       mrg 	struct sys_chown_args ua;
    390        1.1       mrg 
    391       1.11       mrg 	NETBSD32TOP_UAP(path, const char);
    392       1.11       mrg 	NETBSD32TO64_UAP(uid);
    393       1.11       mrg 	NETBSD32TO64_UAP(gid);
    394        1.1       mrg 
    395       1.70   thorpej 	return (sys_chown(l, &ua, retval));
    396        1.1       mrg }
    397        1.1       mrg 
    398        1.1       mrg int
    399       1.70   thorpej netbsd32_break(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_break_args /* {
    405       1.10       mrg 		syscallarg(netbsd32_charp) nsize;
    406        1.1       mrg 	} */ *uap = v;
    407        1.1       mrg 	struct sys_obreak_args ua;
    408        1.1       mrg 
    409       1.66       scw 	SCARG(&ua, nsize) = (char *)NETBSD32PTR64(SCARG(uap, nsize));
    410       1.11       mrg 	NETBSD32TOP_UAP(nsize, char);
    411       1.70   thorpej 	return (sys_obreak(l, &ua, retval));
    412        1.1       mrg }
    413        1.1       mrg 
    414        1.1       mrg int
    415       1.70   thorpej netbsd32_mount(l, v, retval)
    416       1.70   thorpej 	struct lwp *l;
    417        1.1       mrg 	void *v;
    418        1.1       mrg 	register_t *retval;
    419        1.1       mrg {
    420       1.19       eeh 	struct netbsd32_mount_args /* {
    421       1.10       mrg 		syscallarg(const netbsd32_charp) type;
    422       1.10       mrg 		syscallarg(const netbsd32_charp) path;
    423        1.1       mrg 		syscallarg(int) flags;
    424       1.10       mrg 		syscallarg(netbsd32_voidp) data;
    425        1.1       mrg 	} */ *uap = v;
    426        1.1       mrg 	struct sys_mount_args ua;
    427        1.1       mrg 
    428       1.11       mrg 	NETBSD32TOP_UAP(type, const char);
    429       1.11       mrg 	NETBSD32TOP_UAP(path, const char);
    430       1.11       mrg 	NETBSD32TO64_UAP(flags);
    431       1.11       mrg 	NETBSD32TOP_UAP(data, void);
    432       1.70   thorpej 	return (sys_mount(l, &ua, retval));
    433        1.1       mrg }
    434        1.1       mrg 
    435        1.1       mrg int
    436       1.70   thorpej netbsd32_unmount(l, v, retval)
    437       1.70   thorpej 	struct lwp *l;
    438        1.1       mrg 	void *v;
    439        1.1       mrg 	register_t *retval;
    440        1.1       mrg {
    441       1.19       eeh 	struct netbsd32_unmount_args /* {
    442       1.10       mrg 		syscallarg(const netbsd32_charp) path;
    443        1.1       mrg 		syscallarg(int) flags;
    444        1.1       mrg 	} */ *uap = v;
    445        1.1       mrg 	struct sys_unmount_args ua;
    446        1.1       mrg 
    447       1.11       mrg 	NETBSD32TOP_UAP(path, const char);
    448       1.11       mrg 	NETBSD32TO64_UAP(flags);
    449       1.70   thorpej 	return (sys_unmount(l, &ua, retval));
    450        1.1       mrg }
    451        1.1       mrg 
    452        1.1       mrg int
    453       1.70   thorpej netbsd32_setuid(l, v, retval)
    454       1.70   thorpej 	struct lwp *l;
    455        1.6       eeh 	void *v;
    456        1.6       eeh 	register_t *retval;
    457        1.6       eeh {
    458       1.19       eeh 	struct netbsd32_setuid_args /* {
    459        1.6       eeh 		syscallarg(uid_t) uid;
    460        1.6       eeh 	} */ *uap = v;
    461        1.6       eeh 	struct sys_setuid_args ua;
    462        1.6       eeh 
    463       1.11       mrg 	NETBSD32TO64_UAP(uid);
    464       1.70   thorpej 	return (sys_setuid(l, &ua, retval));
    465        1.6       eeh }
    466        1.6       eeh 
    467        1.6       eeh int
    468       1.70   thorpej netbsd32_ptrace(l, v, retval)
    469       1.70   thorpej 	struct lwp *l;
    470        1.1       mrg 	void *v;
    471        1.1       mrg 	register_t *retval;
    472        1.1       mrg {
    473       1.19       eeh 	struct netbsd32_ptrace_args /* {
    474        1.1       mrg 		syscallarg(int) req;
    475        1.1       mrg 		syscallarg(pid_t) pid;
    476       1.10       mrg 		syscallarg(netbsd32_caddr_t) addr;
    477        1.1       mrg 		syscallarg(int) data;
    478        1.1       mrg 	} */ *uap = v;
    479        1.1       mrg 	struct sys_ptrace_args ua;
    480        1.1       mrg 
    481       1.11       mrg 	NETBSD32TO64_UAP(req);
    482       1.11       mrg 	NETBSD32TO64_UAP(pid);
    483       1.11       mrg 	NETBSD32TOX64_UAP(addr, caddr_t);
    484       1.11       mrg 	NETBSD32TO64_UAP(data);
    485       1.70   thorpej 	return (sys_ptrace(l, &ua, retval));
    486        1.1       mrg }
    487        1.1       mrg 
    488        1.1       mrg int
    489       1.70   thorpej netbsd32_accept(l, v, retval)
    490       1.70   thorpej 	struct lwp *l;
    491        1.1       mrg 	void *v;
    492        1.1       mrg 	register_t *retval;
    493        1.1       mrg {
    494       1.19       eeh 	struct netbsd32_accept_args /* {
    495        1.1       mrg 		syscallarg(int) s;
    496       1.10       mrg 		syscallarg(netbsd32_sockaddrp_t) name;
    497       1.10       mrg 		syscallarg(netbsd32_intp) anamelen;
    498        1.1       mrg 	} */ *uap = v;
    499        1.1       mrg 	struct sys_accept_args ua;
    500        1.1       mrg 
    501       1.11       mrg 	NETBSD32TO64_UAP(s);
    502       1.11       mrg 	NETBSD32TOP_UAP(name, struct sockaddr);
    503  1.100.4.5      elad 	NETBSD32TOP_UAP(anamelen, socklen_t);
    504       1.70   thorpej 	return (sys_accept(l, &ua, retval));
    505        1.1       mrg }
    506        1.1       mrg 
    507        1.1       mrg int
    508       1.70   thorpej netbsd32_getpeername(l, v, retval)
    509       1.70   thorpej 	struct lwp *l;
    510        1.1       mrg 	void *v;
    511        1.1       mrg 	register_t *retval;
    512        1.1       mrg {
    513       1.19       eeh 	struct netbsd32_getpeername_args /* {
    514        1.1       mrg 		syscallarg(int) fdes;
    515       1.10       mrg 		syscallarg(netbsd32_sockaddrp_t) asa;
    516       1.10       mrg 		syscallarg(netbsd32_intp) alen;
    517        1.1       mrg 	} */ *uap = v;
    518        1.1       mrg 	struct sys_getpeername_args ua;
    519        1.1       mrg 
    520       1.11       mrg 	NETBSD32TO64_UAP(fdes);
    521       1.11       mrg 	NETBSD32TOP_UAP(asa, struct sockaddr);
    522  1.100.4.5      elad 	NETBSD32TOP_UAP(alen, socklen_t);
    523        1.6       eeh /* NB: do the protocol specific sockaddrs need to be converted? */
    524       1.70   thorpej 	return (sys_getpeername(l, &ua, retval));
    525        1.1       mrg }
    526        1.1       mrg 
    527        1.1       mrg int
    528       1.70   thorpej netbsd32_getsockname(l, v, retval)
    529       1.70   thorpej 	struct lwp *l;
    530        1.1       mrg 	void *v;
    531        1.1       mrg 	register_t *retval;
    532        1.1       mrg {
    533       1.19       eeh 	struct netbsd32_getsockname_args /* {
    534        1.1       mrg 		syscallarg(int) fdes;
    535       1.10       mrg 		syscallarg(netbsd32_sockaddrp_t) asa;
    536       1.10       mrg 		syscallarg(netbsd32_intp) alen;
    537        1.1       mrg 	} */ *uap = v;
    538        1.1       mrg 	struct sys_getsockname_args ua;
    539        1.1       mrg 
    540       1.11       mrg 	NETBSD32TO64_UAP(fdes);
    541       1.11       mrg 	NETBSD32TOP_UAP(asa, struct sockaddr);
    542  1.100.4.5      elad 	NETBSD32TOP_UAP(alen, socklen_t);
    543       1.70   thorpej 	return (sys_getsockname(l, &ua, retval));
    544        1.1       mrg }
    545        1.1       mrg 
    546        1.1       mrg int
    547       1.70   thorpej netbsd32_access(l, v, retval)
    548       1.70   thorpej 	struct lwp *l;
    549        1.1       mrg 	void *v;
    550        1.1       mrg 	register_t *retval;
    551        1.1       mrg {
    552       1.19       eeh 	struct netbsd32_access_args /* {
    553       1.10       mrg 		syscallarg(const netbsd32_charp) path;
    554        1.1       mrg 		syscallarg(int) flags;
    555        1.1       mrg 	} */ *uap = v;
    556        1.1       mrg 	struct sys_access_args ua;
    557        1.1       mrg 	caddr_t sg;
    558        1.1       mrg 
    559       1.11       mrg 	NETBSD32TOP_UAP(path, const char);
    560       1.11       mrg 	NETBSD32TO64_UAP(flags);
    561       1.70   thorpej 	sg = stackgap_init(l->l_proc, 0);
    562       1.99  christos 	CHECK_ALT_EXIST(l, &sg, SCARG(&ua, path));
    563        1.1       mrg 
    564       1.70   thorpej 	return (sys_access(l, &ua, retval));
    565        1.1       mrg }
    566        1.1       mrg 
    567        1.1       mrg int
    568       1.70   thorpej netbsd32_chflags(l, v, retval)
    569       1.70   thorpej 	struct lwp *l;
    570        1.1       mrg 	void *v;
    571        1.1       mrg 	register_t *retval;
    572        1.1       mrg {
    573       1.19       eeh 	struct netbsd32_chflags_args /* {
    574       1.10       mrg 		syscallarg(const netbsd32_charp) path;
    575       1.10       mrg 		syscallarg(netbsd32_u_long) flags;
    576        1.1       mrg 	} */ *uap = v;
    577        1.1       mrg 	struct sys_chflags_args ua;
    578        1.1       mrg 
    579       1.11       mrg 	NETBSD32TOP_UAP(path, const char);
    580       1.11       mrg 	NETBSD32TO64_UAP(flags);
    581        1.1       mrg 
    582       1.70   thorpej 	return (sys_chflags(l, &ua, retval));
    583        1.1       mrg }
    584        1.1       mrg 
    585        1.1       mrg int
    586       1.70   thorpej netbsd32_fchflags(l, v, retval)
    587       1.70   thorpej 	struct lwp *l;
    588        1.1       mrg 	void *v;
    589        1.1       mrg 	register_t *retval;
    590        1.1       mrg {
    591       1.19       eeh 	struct netbsd32_fchflags_args /* {
    592        1.1       mrg 		syscallarg(int) fd;
    593       1.10       mrg 		syscallarg(netbsd32_u_long) flags;
    594        1.1       mrg 	} */ *uap = v;
    595        1.1       mrg 	struct sys_fchflags_args ua;
    596        1.1       mrg 
    597       1.11       mrg 	NETBSD32TO64_UAP(fd);
    598       1.11       mrg 	NETBSD32TO64_UAP(flags);
    599        1.1       mrg 
    600       1.70   thorpej 	return (sys_fchflags(l, &ua, retval));
    601        1.1       mrg }
    602        1.1       mrg 
    603        1.1       mrg int
    604       1.70   thorpej netbsd32_lchflags(l, v, retval)
    605       1.70   thorpej 	struct lwp *l;
    606       1.50       mrg 	void *v;
    607       1.50       mrg 	register_t *retval;
    608       1.50       mrg {
    609       1.50       mrg 	struct netbsd32_lchflags_args /* {
    610       1.81       mrg 		syscallarg(const char *) path;
    611       1.50       mrg 		syscallarg(netbsd32_u_long) flags;
    612       1.50       mrg 	} */ *uap = v;
    613       1.50       mrg 	struct sys_lchflags_args ua;
    614       1.50       mrg 
    615       1.50       mrg 	NETBSD32TOP_UAP(path, const char);
    616       1.50       mrg 	NETBSD32TO64_UAP(flags);
    617       1.50       mrg 
    618       1.70   thorpej 	return (sys_lchflags(l, &ua, retval));
    619       1.50       mrg }
    620       1.50       mrg 
    621       1.50       mrg int
    622       1.70   thorpej netbsd32_kill(l, v, retval)
    623       1.70   thorpej 	struct lwp *l;
    624        1.6       eeh 	void *v;
    625        1.6       eeh 	register_t *retval;
    626        1.6       eeh {
    627       1.19       eeh 	struct netbsd32_kill_args /* {
    628        1.6       eeh 		syscallarg(int) pid;
    629        1.6       eeh 		syscallarg(int) signum;
    630        1.6       eeh 	} */ *uap = v;
    631        1.6       eeh 	struct sys_kill_args ua;
    632        1.6       eeh 
    633       1.11       mrg 	NETBSD32TO64_UAP(pid);
    634       1.11       mrg 	NETBSD32TO64_UAP(signum);
    635        1.6       eeh 
    636       1.70   thorpej 	return (sys_kill(l, &ua, retval));
    637        1.6       eeh }
    638        1.6       eeh 
    639        1.6       eeh int
    640       1.70   thorpej netbsd32_dup(l, v, retval)
    641       1.70   thorpej 	struct lwp *l;
    642        1.6       eeh 	void *v;
    643        1.6       eeh 	register_t *retval;
    644        1.6       eeh {
    645       1.19       eeh 	struct netbsd32_dup_args /* {
    646        1.6       eeh 		syscallarg(int) fd;
    647        1.6       eeh 	} */ *uap = v;
    648        1.6       eeh 	struct sys_dup_args ua;
    649        1.6       eeh 
    650       1.11       mrg 	NETBSD32TO64_UAP(fd);
    651        1.6       eeh 
    652       1.70   thorpej 	return (sys_dup(l, &ua, retval));
    653        1.6       eeh }
    654        1.6       eeh 
    655        1.6       eeh int
    656       1.70   thorpej netbsd32_profil(l, v, retval)
    657       1.70   thorpej 	struct lwp *l;
    658        1.1       mrg 	void *v;
    659        1.1       mrg 	register_t *retval;
    660        1.1       mrg {
    661       1.19       eeh 	struct netbsd32_profil_args /* {
    662       1.10       mrg 		syscallarg(netbsd32_caddr_t) samples;
    663       1.10       mrg 		syscallarg(netbsd32_size_t) size;
    664       1.10       mrg 		syscallarg(netbsd32_u_long) offset;
    665        1.1       mrg 		syscallarg(u_int) scale;
    666        1.1       mrg 	} */ *uap = v;
    667        1.1       mrg 	struct sys_profil_args ua;
    668        1.1       mrg 
    669       1.11       mrg 	NETBSD32TOX64_UAP(samples, caddr_t);
    670       1.11       mrg 	NETBSD32TOX_UAP(size, size_t);
    671       1.11       mrg 	NETBSD32TOX_UAP(offset, u_long);
    672       1.11       mrg 	NETBSD32TO64_UAP(scale);
    673       1.70   thorpej 	return (sys_profil(l, &ua, retval));
    674        1.1       mrg }
    675        1.1       mrg 
    676       1.42  jdolecek #ifdef KTRACE
    677        1.1       mrg int
    678       1.70   thorpej netbsd32_ktrace(l, v, retval)
    679       1.70   thorpej 	struct lwp *l;
    680        1.1       mrg 	void *v;
    681        1.1       mrg 	register_t *retval;
    682        1.1       mrg {
    683       1.19       eeh 	struct netbsd32_ktrace_args /* {
    684       1.10       mrg 		syscallarg(const netbsd32_charp) fname;
    685        1.1       mrg 		syscallarg(int) ops;
    686        1.1       mrg 		syscallarg(int) facs;
    687        1.1       mrg 		syscallarg(int) pid;
    688        1.1       mrg 	} */ *uap = v;
    689        1.1       mrg 	struct sys_ktrace_args ua;
    690        1.1       mrg 
    691       1.11       mrg 	NETBSD32TOP_UAP(fname, const char);
    692       1.11       mrg 	NETBSD32TO64_UAP(ops);
    693       1.11       mrg 	NETBSD32TO64_UAP(facs);
    694       1.11       mrg 	NETBSD32TO64_UAP(pid);
    695       1.70   thorpej 	return (sys_ktrace(l, &ua, retval));
    696        1.1       mrg }
    697       1.42  jdolecek #endif /* KTRACE */
    698       1.50       mrg 
    699       1.50       mrg int
    700       1.70   thorpej netbsd32_utrace(l, v, retval)
    701       1.70   thorpej 	struct lwp *l;
    702       1.50       mrg 	void *v;
    703       1.50       mrg 	register_t *retval;
    704       1.50       mrg {
    705       1.50       mrg 	struct netbsd32_utrace_args /* {
    706       1.50       mrg 		syscallarg(const netbsd32_charp) label;
    707       1.50       mrg 		syscallarg(netbsd32_voidp) addr;
    708       1.50       mrg 		syscallarg(netbsd32_size_t) len;
    709       1.50       mrg 	} */ *uap = v;
    710       1.50       mrg 	struct sys_utrace_args ua;
    711       1.50       mrg 
    712       1.50       mrg 	NETBSD32TOP_UAP(label, const char);
    713       1.50       mrg 	NETBSD32TOP_UAP(addr, void);
    714       1.50       mrg 	NETBSD32TO64_UAP(len);
    715       1.70   thorpej 	return (sys_utrace(l, &ua, retval));
    716       1.50       mrg }
    717        1.1       mrg 
    718        1.1       mrg int
    719       1.70   thorpej netbsd32___getlogin(l, v, retval)
    720       1.70   thorpej 	struct lwp *l;
    721        1.1       mrg 	void *v;
    722        1.1       mrg 	register_t *retval;
    723        1.1       mrg {
    724       1.19       eeh 	struct netbsd32___getlogin_args /* {
    725       1.10       mrg 		syscallarg(netbsd32_charp) namebuf;
    726        1.1       mrg 		syscallarg(u_int) namelen;
    727        1.1       mrg 	} */ *uap = v;
    728        1.1       mrg 	struct sys___getlogin_args ua;
    729        1.1       mrg 
    730       1.11       mrg 	NETBSD32TOP_UAP(namebuf, char);
    731       1.11       mrg 	NETBSD32TO64_UAP(namelen);
    732       1.70   thorpej 	return (sys___getlogin(l, &ua, retval));
    733        1.1       mrg }
    734        1.1       mrg 
    735        1.1       mrg int
    736       1.70   thorpej netbsd32_setlogin(l, v, retval)
    737       1.70   thorpej 	struct lwp *l;
    738        1.1       mrg 	void *v;
    739        1.1       mrg 	register_t *retval;
    740        1.1       mrg {
    741       1.19       eeh 	struct netbsd32_setlogin_args /* {
    742       1.10       mrg 		syscallarg(const netbsd32_charp) namebuf;
    743        1.1       mrg 	} */ *uap = v;
    744       1.70   thorpej 	struct sys___setlogin_args ua;
    745        1.1       mrg 
    746       1.11       mrg 	NETBSD32TOP_UAP(namebuf, char);
    747       1.70   thorpej 	return (sys___setlogin(l, &ua, retval));
    748        1.1       mrg }
    749        1.1       mrg 
    750        1.1       mrg int
    751       1.70   thorpej netbsd32_acct(l, v, retval)
    752       1.70   thorpej 	struct lwp *l;
    753        1.1       mrg 	void *v;
    754        1.1       mrg 	register_t *retval;
    755        1.1       mrg {
    756       1.19       eeh 	struct netbsd32_acct_args /* {
    757       1.10       mrg 		syscallarg(const netbsd32_charp) path;
    758        1.1       mrg 	} */ *uap = v;
    759        1.1       mrg 	struct sys_acct_args ua;
    760        1.1       mrg 
    761       1.11       mrg 	NETBSD32TOP_UAP(path, const char);
    762       1.70   thorpej 	return (sys_acct(l, &ua, retval));
    763        1.1       mrg }
    764        1.1       mrg 
    765        1.1       mrg int
    766       1.70   thorpej netbsd32_revoke(l, v, retval)
    767       1.70   thorpej 	struct lwp *l;
    768        1.1       mrg 	void *v;
    769        1.1       mrg 	register_t *retval;
    770        1.1       mrg {
    771       1.19       eeh 	struct netbsd32_revoke_args /* {
    772       1.10       mrg 		syscallarg(const netbsd32_charp) path;
    773        1.1       mrg 	} */ *uap = v;
    774        1.1       mrg 	struct sys_revoke_args ua;
    775        1.1       mrg 	caddr_t sg;
    776        1.1       mrg 
    777       1.11       mrg 	NETBSD32TOP_UAP(path, const char);
    778       1.70   thorpej 	sg = stackgap_init(l->l_proc, 0);
    779       1.99  christos 	CHECK_ALT_EXIST(l, &sg, SCARG(&ua, path));
    780        1.1       mrg 
    781       1.70   thorpej 	return (sys_revoke(l, &ua, retval));
    782        1.1       mrg }
    783        1.1       mrg 
    784        1.1       mrg int
    785       1.70   thorpej netbsd32_symlink(l, v, retval)
    786       1.70   thorpej 	struct lwp *l;
    787        1.1       mrg 	void *v;
    788        1.1       mrg 	register_t *retval;
    789        1.1       mrg {
    790       1.19       eeh 	struct netbsd32_symlink_args /* {
    791       1.10       mrg 		syscallarg(const netbsd32_charp) path;
    792       1.10       mrg 		syscallarg(const netbsd32_charp) link;
    793        1.1       mrg 	} */ *uap = v;
    794        1.1       mrg 	struct sys_symlink_args ua;
    795        1.1       mrg 
    796       1.11       mrg 	NETBSD32TOP_UAP(path, const char);
    797       1.11       mrg 	NETBSD32TOP_UAP(link, const char);
    798        1.1       mrg 
    799       1.70   thorpej 	return (sys_symlink(l, &ua, retval));
    800        1.1       mrg }
    801        1.1       mrg 
    802        1.1       mrg int
    803       1.70   thorpej netbsd32_readlink(l, v, retval)
    804       1.70   thorpej 	struct lwp *l;
    805        1.1       mrg 	void *v;
    806        1.1       mrg 	register_t *retval;
    807        1.1       mrg {
    808       1.19       eeh 	struct netbsd32_readlink_args /* {
    809       1.10       mrg 		syscallarg(const netbsd32_charp) path;
    810       1.10       mrg 		syscallarg(netbsd32_charp) buf;
    811       1.10       mrg 		syscallarg(netbsd32_size_t) count;
    812        1.1       mrg 	} */ *uap = v;
    813        1.1       mrg 	struct sys_readlink_args ua;
    814        1.1       mrg 	caddr_t sg;
    815        1.1       mrg 
    816       1.11       mrg 	NETBSD32TOP_UAP(path, const char);
    817       1.11       mrg 	NETBSD32TOP_UAP(buf, char);
    818       1.11       mrg 	NETBSD32TOX_UAP(count, size_t);
    819       1.70   thorpej 	sg = stackgap_init(l->l_proc, 0);
    820       1.99  christos 	CHECK_ALT_SYMLINK(l, &sg, SCARG(&ua, path));
    821        1.1       mrg 
    822       1.70   thorpej 	return (sys_readlink(l, &ua, retval));
    823        1.1       mrg }
    824        1.1       mrg 
    825        1.1       mrg int
    826       1.70   thorpej netbsd32_umask(l, v, retval)
    827       1.70   thorpej 	struct lwp *l;
    828        1.6       eeh 	void *v;
    829        1.6       eeh 	register_t *retval;
    830        1.6       eeh {
    831       1.19       eeh 	struct netbsd32_umask_args /* {
    832        1.6       eeh 		syscallarg(mode_t) newmask;
    833        1.6       eeh 	} */ *uap = v;
    834        1.6       eeh 	struct sys_umask_args ua;
    835        1.6       eeh 
    836       1.11       mrg 	NETBSD32TO64_UAP(newmask);
    837       1.70   thorpej 	return (sys_umask(l, &ua, retval));
    838        1.6       eeh }
    839        1.6       eeh 
    840        1.6       eeh int
    841       1.70   thorpej netbsd32_chroot(l, v, retval)
    842       1.70   thorpej 	struct lwp *l;
    843        1.1       mrg 	void *v;
    844        1.1       mrg 	register_t *retval;
    845        1.1       mrg {
    846       1.19       eeh 	struct netbsd32_chroot_args /* {
    847       1.10       mrg 		syscallarg(const netbsd32_charp) path;
    848        1.1       mrg 	} */ *uap = v;
    849        1.1       mrg 	struct sys_chroot_args ua;
    850        1.1       mrg 
    851       1.11       mrg 	NETBSD32TOP_UAP(path, const char);
    852       1.70   thorpej 	return (sys_chroot(l, &ua, retval));
    853        1.1       mrg }
    854        1.1       mrg 
    855        1.1       mrg int
    856       1.70   thorpej netbsd32_sbrk(l, v, retval)
    857       1.70   thorpej 	struct lwp *l;
    858        1.6       eeh 	void *v;
    859        1.6       eeh 	register_t *retval;
    860        1.6       eeh {
    861       1.19       eeh 	struct netbsd32_sbrk_args /* {
    862        1.6       eeh 		syscallarg(int) incr;
    863        1.6       eeh 	} */ *uap = v;
    864        1.6       eeh 	struct sys_sbrk_args ua;
    865        1.6       eeh 
    866       1.11       mrg 	NETBSD32TO64_UAP(incr);
    867       1.70   thorpej 	return (sys_sbrk(l, &ua, retval));
    868        1.6       eeh }
    869        1.6       eeh 
    870        1.6       eeh int
    871       1.70   thorpej netbsd32_sstk(l, v, retval)
    872       1.70   thorpej 	struct lwp *l;
    873        1.6       eeh 	void *v;
    874        1.6       eeh 	register_t *retval;
    875        1.6       eeh {
    876       1.19       eeh 	struct netbsd32_sstk_args /* {
    877        1.6       eeh 		syscallarg(int) incr;
    878        1.6       eeh 	} */ *uap = v;
    879        1.6       eeh 	struct sys_sstk_args ua;
    880        1.6       eeh 
    881       1.11       mrg 	NETBSD32TO64_UAP(incr);
    882       1.70   thorpej 	return (sys_sstk(l, &ua, retval));
    883        1.6       eeh }
    884        1.6       eeh 
    885        1.6       eeh int
    886       1.70   thorpej netbsd32_munmap(l, v, retval)
    887       1.70   thorpej 	struct lwp *l;
    888        1.1       mrg 	void *v;
    889        1.1       mrg 	register_t *retval;
    890        1.1       mrg {
    891       1.19       eeh 	struct netbsd32_munmap_args /* {
    892       1.10       mrg 		syscallarg(netbsd32_voidp) addr;
    893       1.10       mrg 		syscallarg(netbsd32_size_t) len;
    894        1.1       mrg 	} */ *uap = v;
    895        1.1       mrg 	struct sys_munmap_args ua;
    896        1.1       mrg 
    897       1.11       mrg 	NETBSD32TOP_UAP(addr, void);
    898       1.11       mrg 	NETBSD32TOX_UAP(len, size_t);
    899       1.70   thorpej 	return (sys_munmap(l, &ua, retval));
    900        1.1       mrg }
    901        1.1       mrg 
    902        1.1       mrg int
    903       1.70   thorpej netbsd32_mprotect(l, v, retval)
    904       1.70   thorpej 	struct lwp *l;
    905        1.1       mrg 	void *v;
    906        1.1       mrg 	register_t *retval;
    907        1.1       mrg {
    908       1.19       eeh 	struct netbsd32_mprotect_args /* {
    909       1.10       mrg 		syscallarg(netbsd32_voidp) addr;
    910       1.10       mrg 		syscallarg(netbsd32_size_t) len;
    911        1.1       mrg 		syscallarg(int) prot;
    912        1.1       mrg 	} */ *uap = v;
    913        1.1       mrg 	struct sys_mprotect_args ua;
    914        1.1       mrg 
    915       1.11       mrg 	NETBSD32TOP_UAP(addr, void);
    916       1.11       mrg 	NETBSD32TOX_UAP(len, size_t);
    917       1.11       mrg 	NETBSD32TO64_UAP(prot);
    918       1.70   thorpej 	return (sys_mprotect(l, &ua, retval));
    919        1.1       mrg }
    920        1.1       mrg 
    921        1.1       mrg int
    922       1.70   thorpej netbsd32_madvise(l, v, retval)
    923       1.70   thorpej 	struct lwp *l;
    924        1.1       mrg 	void *v;
    925        1.1       mrg 	register_t *retval;
    926        1.1       mrg {
    927       1.19       eeh 	struct netbsd32_madvise_args /* {
    928       1.10       mrg 		syscallarg(netbsd32_voidp) addr;
    929       1.10       mrg 		syscallarg(netbsd32_size_t) len;
    930        1.1       mrg 		syscallarg(int) behav;
    931        1.1       mrg 	} */ *uap = v;
    932        1.1       mrg 	struct sys_madvise_args ua;
    933        1.1       mrg 
    934       1.11       mrg 	NETBSD32TOP_UAP(addr, void);
    935       1.11       mrg 	NETBSD32TOX_UAP(len, size_t);
    936       1.11       mrg 	NETBSD32TO64_UAP(behav);
    937       1.70   thorpej 	return (sys_madvise(l, &ua, retval));
    938        1.1       mrg }
    939        1.1       mrg 
    940        1.1       mrg int
    941       1.70   thorpej netbsd32_mincore(l, v, retval)
    942       1.70   thorpej 	struct lwp *l;
    943        1.1       mrg 	void *v;
    944        1.1       mrg 	register_t *retval;
    945        1.1       mrg {
    946       1.19       eeh 	struct netbsd32_mincore_args /* {
    947       1.10       mrg 		syscallarg(netbsd32_caddr_t) addr;
    948       1.10       mrg 		syscallarg(netbsd32_size_t) len;
    949       1.10       mrg 		syscallarg(netbsd32_charp) vec;
    950        1.1       mrg 	} */ *uap = v;
    951        1.1       mrg 	struct sys_mincore_args ua;
    952        1.1       mrg 
    953       1.11       mrg 	NETBSD32TOX64_UAP(addr, caddr_t);
    954       1.11       mrg 	NETBSD32TOX_UAP(len, size_t);
    955       1.11       mrg 	NETBSD32TOP_UAP(vec, char);
    956       1.70   thorpej 	return (sys_mincore(l, &ua, retval));
    957        1.1       mrg }
    958        1.1       mrg 
    959       1.57       mrg /* XXX MOVE ME XXX ? */
    960        1.1       mrg int
    961       1.70   thorpej netbsd32_getgroups(l, v, retval)
    962       1.70   thorpej 	struct lwp *l;
    963        1.1       mrg 	void *v;
    964        1.1       mrg 	register_t *retval;
    965        1.1       mrg {
    966       1.19       eeh 	struct netbsd32_getgroups_args /* {
    967        1.1       mrg 		syscallarg(int) gidsetsize;
    968       1.10       mrg 		syscallarg(netbsd32_gid_tp) gidset;
    969        1.1       mrg 	} */ *uap = v;
    970  1.100.4.1      elad 	kauth_cred_t pc = l->l_proc->p_cred;
    971       1.25  augustss 	int ngrp;
    972        1.6       eeh 	int error;
    973  1.100.4.1      elad 	gid_t *grbuf;
    974        1.1       mrg 
    975        1.6       eeh 	ngrp = SCARG(uap, gidsetsize);
    976        1.6       eeh 	if (ngrp == 0) {
    977  1.100.4.1      elad 		*retval = kauth_cred_ngroups(pc);
    978        1.6       eeh 		return (0);
    979        1.6       eeh 	}
    980  1.100.4.1      elad 	if (ngrp < kauth_cred_ngroups(pc))
    981        1.6       eeh 		return (EINVAL);
    982  1.100.4.1      elad 	ngrp = kauth_cred_ngroups(pc);
    983       1.10       mrg 	/* Should convert gid_t to netbsd32_gid_t, but they're the same */
    984  1.100.4.1      elad 	grbuf = malloc(ngrp * sizeof(*grbuf), M_TEMP, M_WAITOK);
    985  1.100.4.2      elad 	kauth_cred_getgroups(pc, grbuf, ngrp);
    986  1.100.4.1      elad 	error = copyout(grbuf, (caddr_t)NETBSD32PTR64(SCARG(uap, gidset)),
    987  1.100.4.1      elad 			ngrp * sizeof(*grbuf));
    988  1.100.4.1      elad 	free(grbuf, M_TEMP);
    989        1.6       eeh 	if (error)
    990        1.6       eeh 		return (error);
    991        1.6       eeh 	*retval = ngrp;
    992        1.6       eeh 	return (0);
    993        1.1       mrg }
    994        1.1       mrg 
    995        1.1       mrg int
    996       1.70   thorpej netbsd32_setgroups(l, v, retval)
    997       1.70   thorpej 	struct lwp *l;
    998        1.1       mrg 	void *v;
    999        1.1       mrg 	register_t *retval;
   1000        1.1       mrg {
   1001       1.19       eeh 	struct netbsd32_setgroups_args /* {
   1002        1.1       mrg 		syscallarg(int) gidsetsize;
   1003       1.10       mrg 		syscallarg(const netbsd32_gid_tp) gidset;
   1004        1.1       mrg 	} */ *uap = v;
   1005        1.1       mrg 	struct sys_setgroups_args ua;
   1006        1.1       mrg 
   1007       1.11       mrg 	NETBSD32TO64_UAP(gidsetsize);
   1008       1.11       mrg 	NETBSD32TOP_UAP(gidset, gid_t);
   1009       1.70   thorpej 	return (sys_setgroups(l, &ua, retval));
   1010        1.1       mrg }
   1011        1.1       mrg 
   1012        1.1       mrg int
   1013       1.70   thorpej netbsd32_setpgid(l, v, retval)
   1014       1.70   thorpej 	struct lwp *l;
   1015        1.6       eeh 	void *v;
   1016        1.6       eeh 	register_t *retval;
   1017        1.6       eeh {
   1018       1.19       eeh 	struct netbsd32_setpgid_args /* {
   1019        1.6       eeh 		syscallarg(int) pid;
   1020        1.6       eeh 		syscallarg(int) pgid;
   1021        1.6       eeh 	} */ *uap = v;
   1022        1.6       eeh 	struct sys_setpgid_args ua;
   1023        1.6       eeh 
   1024       1.11       mrg 	NETBSD32TO64_UAP(pid);
   1025       1.11       mrg 	NETBSD32TO64_UAP(pgid);
   1026       1.70   thorpej 	return (sys_setpgid(l, &ua, retval));
   1027        1.6       eeh }
   1028        1.6       eeh 
   1029        1.1       mrg int
   1030       1.70   thorpej netbsd32_fcntl(l, v, retval)
   1031       1.70   thorpej 	struct lwp *l;
   1032        1.1       mrg 	void *v;
   1033        1.1       mrg 	register_t *retval;
   1034        1.1       mrg {
   1035       1.19       eeh 	struct netbsd32_fcntl_args /* {
   1036        1.1       mrg 		syscallarg(int) fd;
   1037        1.1       mrg 		syscallarg(int) cmd;
   1038       1.10       mrg 		syscallarg(netbsd32_voidp) arg;
   1039        1.1       mrg 	} */ *uap = v;
   1040        1.1       mrg 	struct sys_fcntl_args ua;
   1041        1.1       mrg 
   1042       1.11       mrg 	NETBSD32TO64_UAP(fd);
   1043       1.11       mrg 	NETBSD32TO64_UAP(cmd);
   1044       1.11       mrg 	NETBSD32TOP_UAP(arg, void);
   1045       1.54       mrg 	/* we can do this because `struct flock' doesn't change */
   1046       1.70   thorpej 	return (sys_fcntl(l, &ua, retval));
   1047        1.1       mrg }
   1048        1.1       mrg 
   1049        1.1       mrg int
   1050       1.70   thorpej netbsd32_dup2(l, v, retval)
   1051       1.70   thorpej 	struct lwp *l;
   1052        1.6       eeh 	void *v;
   1053        1.6       eeh 	register_t *retval;
   1054        1.6       eeh {
   1055       1.19       eeh 	struct netbsd32_dup2_args /* {
   1056        1.6       eeh 		syscallarg(int) from;
   1057        1.6       eeh 		syscallarg(int) to;
   1058        1.6       eeh 	} */ *uap = v;
   1059        1.6       eeh 	struct sys_dup2_args ua;
   1060        1.6       eeh 
   1061       1.11       mrg 	NETBSD32TO64_UAP(from);
   1062       1.11       mrg 	NETBSD32TO64_UAP(to);
   1063       1.70   thorpej 	return (sys_dup2(l, &ua, retval));
   1064        1.6       eeh }
   1065        1.6       eeh 
   1066        1.6       eeh int
   1067       1.70   thorpej netbsd32_fsync(l, v, retval)
   1068       1.70   thorpej 	struct lwp *l;
   1069        1.6       eeh 	void *v;
   1070        1.6       eeh 	register_t *retval;
   1071        1.6       eeh {
   1072       1.19       eeh 	struct netbsd32_fsync_args /* {
   1073        1.6       eeh 		syscallarg(int) fd;
   1074        1.6       eeh 	} */ *uap = v;
   1075        1.6       eeh 	struct sys_fsync_args ua;
   1076        1.1       mrg 
   1077       1.11       mrg 	NETBSD32TO64_UAP(fd);
   1078       1.70   thorpej 	return (sys_fsync(l, &ua, retval));
   1079        1.6       eeh }
   1080        1.6       eeh 
   1081        1.6       eeh int
   1082       1.70   thorpej netbsd32_setpriority(l, v, retval)
   1083       1.70   thorpej 	struct lwp *l;
   1084        1.6       eeh 	void *v;
   1085        1.6       eeh 	register_t *retval;
   1086        1.6       eeh {
   1087       1.19       eeh 	struct netbsd32_setpriority_args /* {
   1088        1.6       eeh 		syscallarg(int) which;
   1089        1.6       eeh 		syscallarg(int) who;
   1090        1.6       eeh 		syscallarg(int) prio;
   1091        1.6       eeh 	} */ *uap = v;
   1092        1.6       eeh 	struct sys_setpriority_args ua;
   1093        1.6       eeh 
   1094       1.11       mrg 	NETBSD32TO64_UAP(which);
   1095       1.11       mrg 	NETBSD32TO64_UAP(who);
   1096       1.11       mrg 	NETBSD32TO64_UAP(prio);
   1097       1.70   thorpej 	return (sys_setpriority(l, &ua, retval));
   1098        1.6       eeh }
   1099        1.6       eeh 
   1100        1.6       eeh int
   1101       1.70   thorpej netbsd32_socket(l, v, retval)
   1102       1.70   thorpej 	struct lwp *l;
   1103        1.6       eeh 	void *v;
   1104        1.6       eeh 	register_t *retval;
   1105        1.6       eeh {
   1106       1.19       eeh 	struct netbsd32_socket_args /* {
   1107        1.6       eeh 		syscallarg(int) domain;
   1108        1.6       eeh 		syscallarg(int) type;
   1109        1.6       eeh 		syscallarg(int) protocol;
   1110        1.6       eeh 	} */ *uap = v;
   1111        1.6       eeh 	struct sys_socket_args ua;
   1112        1.6       eeh 
   1113       1.11       mrg 	NETBSD32TO64_UAP(domain);
   1114       1.11       mrg 	NETBSD32TO64_UAP(type);
   1115       1.11       mrg 	NETBSD32TO64_UAP(protocol);
   1116       1.70   thorpej 	return (sys_socket(l, &ua, retval));
   1117        1.1       mrg }
   1118        1.1       mrg 
   1119        1.1       mrg int
   1120       1.70   thorpej netbsd32_connect(l, v, retval)
   1121       1.70   thorpej 	struct lwp *l;
   1122        1.1       mrg 	void *v;
   1123        1.1       mrg 	register_t *retval;
   1124        1.1       mrg {
   1125       1.19       eeh 	struct netbsd32_connect_args /* {
   1126        1.1       mrg 		syscallarg(int) s;
   1127       1.10       mrg 		syscallarg(const netbsd32_sockaddrp_t) name;
   1128        1.1       mrg 		syscallarg(int) namelen;
   1129        1.1       mrg 	} */ *uap = v;
   1130        1.1       mrg 	struct sys_connect_args ua;
   1131        1.1       mrg 
   1132       1.11       mrg 	NETBSD32TO64_UAP(s);
   1133       1.11       mrg 	NETBSD32TOP_UAP(name, struct sockaddr);
   1134       1.11       mrg 	NETBSD32TO64_UAP(namelen);
   1135       1.70   thorpej 	return (sys_connect(l, &ua, retval));
   1136        1.1       mrg }
   1137        1.1       mrg 
   1138        1.6       eeh int
   1139       1.70   thorpej netbsd32_getpriority(l, v, retval)
   1140       1.70   thorpej 	struct lwp *l;
   1141        1.6       eeh 	void *v;
   1142        1.6       eeh 	register_t *retval;
   1143        1.6       eeh {
   1144       1.19       eeh 	struct netbsd32_getpriority_args /* {
   1145        1.6       eeh 		syscallarg(int) which;
   1146        1.6       eeh 		syscallarg(int) who;
   1147        1.6       eeh 	} */ *uap = v;
   1148        1.6       eeh 	struct sys_getpriority_args ua;
   1149        1.6       eeh 
   1150       1.11       mrg 	NETBSD32TO64_UAP(which);
   1151       1.11       mrg 	NETBSD32TO64_UAP(who);
   1152       1.70   thorpej 	return (sys_getpriority(l, &ua, retval));
   1153        1.6       eeh }
   1154        1.6       eeh 
   1155        1.1       mrg int
   1156       1.70   thorpej netbsd32_bind(l, v, retval)
   1157       1.70   thorpej 	struct lwp *l;
   1158        1.1       mrg 	void *v;
   1159        1.1       mrg 	register_t *retval;
   1160        1.1       mrg {
   1161       1.19       eeh 	struct netbsd32_bind_args /* {
   1162        1.1       mrg 		syscallarg(int) s;
   1163       1.10       mrg 		syscallarg(const netbsd32_sockaddrp_t) name;
   1164        1.1       mrg 		syscallarg(int) namelen;
   1165        1.1       mrg 	} */ *uap = v;
   1166        1.6       eeh 	struct sys_bind_args ua;
   1167        1.1       mrg 
   1168       1.11       mrg 	NETBSD32TO64_UAP(s);
   1169       1.11       mrg 	NETBSD32TOP_UAP(name, struct sockaddr);
   1170       1.11       mrg 	NETBSD32TO64_UAP(namelen);
   1171       1.70   thorpej 	return (sys_bind(l, &ua, retval));
   1172        1.1       mrg }
   1173        1.1       mrg 
   1174        1.1       mrg int
   1175       1.70   thorpej netbsd32_setsockopt(l, v, retval)
   1176       1.70   thorpej 	struct lwp *l;
   1177        1.1       mrg 	void *v;
   1178        1.1       mrg 	register_t *retval;
   1179        1.1       mrg {
   1180       1.19       eeh 	struct netbsd32_setsockopt_args /* {
   1181        1.1       mrg 		syscallarg(int) s;
   1182        1.1       mrg 		syscallarg(int) level;
   1183        1.1       mrg 		syscallarg(int) name;
   1184       1.10       mrg 		syscallarg(const netbsd32_voidp) val;
   1185        1.1       mrg 		syscallarg(int) valsize;
   1186        1.1       mrg 	} */ *uap = v;
   1187        1.1       mrg 	struct sys_setsockopt_args ua;
   1188        1.1       mrg 
   1189       1.11       mrg 	NETBSD32TO64_UAP(s);
   1190       1.11       mrg 	NETBSD32TO64_UAP(level);
   1191       1.11       mrg 	NETBSD32TO64_UAP(name);
   1192       1.11       mrg 	NETBSD32TOP_UAP(val, void);
   1193       1.11       mrg 	NETBSD32TO64_UAP(valsize);
   1194        1.6       eeh 	/* may be more efficient to do this inline. */
   1195       1.70   thorpej 	return (sys_setsockopt(l, &ua, retval));
   1196        1.1       mrg }
   1197        1.1       mrg 
   1198        1.1       mrg int
   1199       1.70   thorpej netbsd32_listen(l, v, retval)
   1200       1.70   thorpej 	struct lwp *l;
   1201        1.6       eeh 	void *v;
   1202        1.6       eeh 	register_t *retval;
   1203        1.6       eeh {
   1204       1.19       eeh 	struct netbsd32_listen_args /* {
   1205        1.6       eeh 		syscallarg(int) s;
   1206        1.6       eeh 		syscallarg(int) backlog;
   1207        1.6       eeh 	} */ *uap = v;
   1208        1.6       eeh 	struct sys_listen_args ua;
   1209        1.6       eeh 
   1210       1.11       mrg 	NETBSD32TO64_UAP(s);
   1211       1.11       mrg 	NETBSD32TO64_UAP(backlog);
   1212       1.70   thorpej 	return (sys_listen(l, &ua, retval));
   1213        1.6       eeh }
   1214        1.6       eeh 
   1215        1.6       eeh int
   1216       1.70   thorpej netbsd32_fchown(l, v, retval)
   1217       1.70   thorpej 	struct lwp *l;
   1218        1.1       mrg 	void *v;
   1219        1.1       mrg 	register_t *retval;
   1220        1.1       mrg {
   1221       1.57       mrg 	struct netbsd32_fchown_args /* {
   1222       1.57       mrg 		syscallarg(int) fd;
   1223       1.57       mrg 		syscallarg(uid_t) uid;
   1224       1.57       mrg 		syscallarg(gid_t) gid;
   1225        1.1       mrg 	} */ *uap = v;
   1226       1.57       mrg 	struct sys_fchown_args ua;
   1227        1.6       eeh 
   1228       1.11       mrg 	NETBSD32TO64_UAP(fd);
   1229       1.11       mrg 	NETBSD32TO64_UAP(uid);
   1230       1.11       mrg 	NETBSD32TO64_UAP(gid);
   1231       1.70   thorpej 	return (sys_fchown(l, &ua, retval));
   1232        1.6       eeh }
   1233        1.6       eeh 
   1234        1.6       eeh int
   1235       1.70   thorpej netbsd32_fchmod(l, v, retval)
   1236       1.70   thorpej 	struct lwp *l;
   1237        1.6       eeh 	void *v;
   1238        1.6       eeh 	register_t *retval;
   1239        1.6       eeh {
   1240       1.19       eeh 	struct netbsd32_fchmod_args /* {
   1241        1.6       eeh 		syscallarg(int) fd;
   1242        1.6       eeh 		syscallarg(mode_t) mode;
   1243        1.6       eeh 	} */ *uap = v;
   1244        1.6       eeh 	struct sys_fchmod_args ua;
   1245        1.6       eeh 
   1246       1.11       mrg 	NETBSD32TO64_UAP(fd);
   1247       1.11       mrg 	NETBSD32TO64_UAP(mode);
   1248       1.70   thorpej 	return (sys_fchmod(l, &ua, retval));
   1249        1.6       eeh }
   1250        1.6       eeh 
   1251        1.6       eeh int
   1252       1.70   thorpej netbsd32_setreuid(l, v, retval)
   1253       1.70   thorpej 	struct lwp *l;
   1254        1.6       eeh 	void *v;
   1255        1.6       eeh 	register_t *retval;
   1256        1.6       eeh {
   1257       1.19       eeh 	struct netbsd32_setreuid_args /* {
   1258        1.6       eeh 		syscallarg(uid_t) ruid;
   1259        1.6       eeh 		syscallarg(uid_t) euid;
   1260        1.6       eeh 	} */ *uap = v;
   1261        1.6       eeh 	struct sys_setreuid_args ua;
   1262        1.6       eeh 
   1263       1.11       mrg 	NETBSD32TO64_UAP(ruid);
   1264       1.11       mrg 	NETBSD32TO64_UAP(euid);
   1265       1.70   thorpej 	return (sys_setreuid(l, &ua, retval));
   1266        1.6       eeh }
   1267        1.1       mrg 
   1268        1.6       eeh int
   1269       1.70   thorpej netbsd32_setregid(l, v, retval)
   1270       1.70   thorpej 	struct lwp *l;
   1271        1.6       eeh 	void *v;
   1272        1.6       eeh 	register_t *retval;
   1273        1.6       eeh {
   1274       1.19       eeh 	struct netbsd32_setregid_args /* {
   1275        1.6       eeh 		syscallarg(gid_t) rgid;
   1276        1.6       eeh 		syscallarg(gid_t) egid;
   1277        1.6       eeh 	} */ *uap = v;
   1278        1.6       eeh 	struct sys_setregid_args ua;
   1279        1.6       eeh 
   1280       1.11       mrg 	NETBSD32TO64_UAP(rgid);
   1281       1.11       mrg 	NETBSD32TO64_UAP(egid);
   1282       1.70   thorpej 	return (sys_setregid(l, &ua, retval));
   1283        1.1       mrg }
   1284        1.1       mrg 
   1285        1.1       mrg int
   1286       1.70   thorpej netbsd32_getsockopt(l, v, retval)
   1287       1.70   thorpej 	struct lwp *l;
   1288        1.1       mrg 	void *v;
   1289        1.1       mrg 	register_t *retval;
   1290        1.1       mrg {
   1291       1.19       eeh 	struct netbsd32_getsockopt_args /* {
   1292        1.1       mrg 		syscallarg(int) s;
   1293        1.1       mrg 		syscallarg(int) level;
   1294        1.1       mrg 		syscallarg(int) name;
   1295       1.10       mrg 		syscallarg(netbsd32_voidp) val;
   1296       1.10       mrg 		syscallarg(netbsd32_intp) avalsize;
   1297        1.1       mrg 	} */ *uap = v;
   1298        1.1       mrg 	struct sys_getsockopt_args ua;
   1299        1.1       mrg 
   1300       1.11       mrg 	NETBSD32TO64_UAP(s);
   1301       1.11       mrg 	NETBSD32TO64_UAP(level);
   1302       1.11       mrg 	NETBSD32TO64_UAP(name);
   1303       1.11       mrg 	NETBSD32TOP_UAP(val, void);
   1304  1.100.4.5      elad 	NETBSD32TOP_UAP(avalsize, socklen_t);
   1305       1.70   thorpej 	return (sys_getsockopt(l, &ua, retval));
   1306        1.1       mrg }
   1307        1.1       mrg 
   1308        1.1       mrg int
   1309       1.70   thorpej netbsd32_rename(l, v, retval)
   1310       1.70   thorpej 	struct lwp *l;
   1311        1.1       mrg 	void *v;
   1312        1.1       mrg 	register_t *retval;
   1313        1.1       mrg {
   1314       1.19       eeh 	struct netbsd32_rename_args /* {
   1315       1.10       mrg 		syscallarg(const netbsd32_charp) from;
   1316       1.10       mrg 		syscallarg(const netbsd32_charp) to;
   1317        1.1       mrg 	} */ *uap = v;
   1318        1.1       mrg 	struct sys_rename_args ua;
   1319        1.1       mrg 
   1320       1.20       eeh 	NETBSD32TOP_UAP(from, const char);
   1321       1.20       eeh 	NETBSD32TOP_UAP(to, const char)
   1322        1.6       eeh 
   1323       1.70   thorpej 	return (sys_rename(l, &ua, retval));
   1324        1.1       mrg }
   1325        1.1       mrg 
   1326        1.1       mrg int
   1327       1.70   thorpej netbsd32_flock(l, v, retval)
   1328       1.70   thorpej 	struct lwp *l;
   1329        1.6       eeh 	void *v;
   1330        1.6       eeh 	register_t *retval;
   1331        1.6       eeh {
   1332       1.19       eeh 	struct netbsd32_flock_args /* {
   1333        1.6       eeh 		syscallarg(int) fd;
   1334        1.6       eeh 		syscallarg(int) how;
   1335        1.6       eeh 	} */ *uap = v;
   1336        1.6       eeh 	struct sys_flock_args ua;
   1337        1.6       eeh 
   1338       1.11       mrg 	NETBSD32TO64_UAP(fd);
   1339       1.11       mrg 	NETBSD32TO64_UAP(how)
   1340        1.6       eeh 
   1341       1.70   thorpej 	return (sys_flock(l, &ua, retval));
   1342        1.6       eeh }
   1343        1.6       eeh 
   1344        1.6       eeh int
   1345       1.70   thorpej netbsd32_mkfifo(l, v, retval)
   1346       1.70   thorpej 	struct lwp *l;
   1347        1.1       mrg 	void *v;
   1348        1.1       mrg 	register_t *retval;
   1349        1.1       mrg {
   1350       1.19       eeh 	struct netbsd32_mkfifo_args /* {
   1351       1.10       mrg 		syscallarg(const netbsd32_charp) path;
   1352        1.1       mrg 		syscallarg(mode_t) mode;
   1353        1.1       mrg 	} */ *uap = v;
   1354        1.1       mrg 	struct sys_mkfifo_args ua;
   1355        1.1       mrg 
   1356       1.11       mrg 	NETBSD32TOP_UAP(path, const char)
   1357       1.11       mrg 	NETBSD32TO64_UAP(mode);
   1358       1.70   thorpej 	return (sys_mkfifo(l, &ua, retval));
   1359        1.1       mrg }
   1360        1.1       mrg 
   1361        1.1       mrg int
   1362       1.70   thorpej netbsd32_shutdown(l, v, retval)
   1363       1.70   thorpej 	struct lwp *l;
   1364        1.6       eeh 	void *v;
   1365        1.6       eeh 	register_t *retval;
   1366        1.6       eeh {
   1367       1.19       eeh 	struct netbsd32_shutdown_args /* {
   1368        1.6       eeh 		syscallarg(int) s;
   1369        1.6       eeh 		syscallarg(int) how;
   1370        1.6       eeh 	} */ *uap = v;
   1371        1.6       eeh 	struct sys_shutdown_args ua;
   1372        1.6       eeh 
   1373       1.11       mrg 	NETBSD32TO64_UAP(s)
   1374       1.11       mrg 	NETBSD32TO64_UAP(how);
   1375       1.70   thorpej 	return (sys_shutdown(l, &ua, retval));
   1376        1.6       eeh }
   1377        1.6       eeh 
   1378        1.6       eeh int
   1379       1.70   thorpej netbsd32_socketpair(l, v, retval)
   1380       1.70   thorpej 	struct lwp *l;
   1381        1.6       eeh 	void *v;
   1382        1.6       eeh 	register_t *retval;
   1383        1.6       eeh {
   1384       1.19       eeh 	struct netbsd32_socketpair_args /* {
   1385        1.6       eeh 		syscallarg(int) domain;
   1386        1.6       eeh 		syscallarg(int) type;
   1387        1.6       eeh 		syscallarg(int) protocol;
   1388       1.10       mrg 		syscallarg(netbsd32_intp) rsv;
   1389        1.6       eeh 	} */ *uap = v;
   1390        1.6       eeh 	struct sys_socketpair_args ua;
   1391        1.6       eeh 
   1392       1.11       mrg 	NETBSD32TO64_UAP(domain);
   1393       1.11       mrg 	NETBSD32TO64_UAP(type);
   1394       1.11       mrg 	NETBSD32TO64_UAP(protocol);
   1395       1.11       mrg 	NETBSD32TOP_UAP(rsv, int);
   1396        1.6       eeh 	/* Since we're just copying out two `int's we can do this */
   1397       1.70   thorpej 	return (sys_socketpair(l, &ua, retval));
   1398        1.6       eeh }
   1399        1.6       eeh 
   1400        1.6       eeh int
   1401       1.70   thorpej netbsd32_mkdir(l, v, retval)
   1402       1.70   thorpej 	struct lwp *l;
   1403        1.1       mrg 	void *v;
   1404        1.1       mrg 	register_t *retval;
   1405        1.1       mrg {
   1406       1.19       eeh 	struct netbsd32_mkdir_args /* {
   1407       1.10       mrg 		syscallarg(const netbsd32_charp) path;
   1408        1.1       mrg 		syscallarg(mode_t) mode;
   1409        1.1       mrg 	} */ *uap = v;
   1410        1.1       mrg 	struct sys_mkdir_args ua;
   1411        1.1       mrg 
   1412       1.11       mrg 	NETBSD32TOP_UAP(path, const char)
   1413       1.11       mrg 	NETBSD32TO64_UAP(mode);
   1414       1.70   thorpej 	return (sys_mkdir(l, &ua, retval));
   1415        1.1       mrg }
   1416        1.1       mrg 
   1417        1.1       mrg int
   1418       1.70   thorpej netbsd32_rmdir(l, v, retval)
   1419       1.70   thorpej 	struct lwp *l;
   1420        1.1       mrg 	void *v;
   1421        1.1       mrg 	register_t *retval;
   1422        1.1       mrg {
   1423       1.19       eeh 	struct netbsd32_rmdir_args /* {
   1424       1.10       mrg 		syscallarg(const netbsd32_charp) path;
   1425        1.1       mrg 	} */ *uap = v;
   1426        1.1       mrg 	struct sys_rmdir_args ua;
   1427        1.1       mrg 
   1428       1.11       mrg 	NETBSD32TOP_UAP(path, const char);
   1429       1.70   thorpej 	return (sys_rmdir(l, &ua, retval));
   1430        1.1       mrg }
   1431        1.1       mrg 
   1432        1.1       mrg int
   1433       1.70   thorpej netbsd32_quotactl(l, v, retval)
   1434       1.70   thorpej 	struct lwp *l;
   1435        1.1       mrg 	void *v;
   1436        1.1       mrg 	register_t *retval;
   1437        1.1       mrg {
   1438       1.19       eeh 	struct netbsd32_quotactl_args /* {
   1439       1.10       mrg 		syscallarg(const netbsd32_charp) path;
   1440        1.1       mrg 		syscallarg(int) cmd;
   1441        1.1       mrg 		syscallarg(int) uid;
   1442       1.10       mrg 		syscallarg(netbsd32_caddr_t) arg;
   1443        1.1       mrg 	} */ *uap = v;
   1444        1.1       mrg 	struct sys_quotactl_args ua;
   1445        1.1       mrg 
   1446       1.11       mrg 	NETBSD32TOP_UAP(path, const char);
   1447       1.11       mrg 	NETBSD32TO64_UAP(cmd);
   1448       1.11       mrg 	NETBSD32TO64_UAP(uid);
   1449       1.11       mrg 	NETBSD32TOX64_UAP(arg, caddr_t);
   1450       1.70   thorpej 	return (sys_quotactl(l, &ua, retval));
   1451        1.1       mrg }
   1452        1.1       mrg 
   1453        1.6       eeh #if defined(NFS) || defined(NFSSERVER)
   1454        1.1       mrg int
   1455       1.70   thorpej netbsd32_nfssvc(l, v, retval)
   1456       1.70   thorpej 	struct lwp *l;
   1457        1.1       mrg 	void *v;
   1458        1.1       mrg 	register_t *retval;
   1459        1.1       mrg {
   1460        1.6       eeh #if 0
   1461       1.19       eeh 	struct netbsd32_nfssvc_args /* {
   1462        1.1       mrg 		syscallarg(int) flag;
   1463       1.10       mrg 		syscallarg(netbsd32_voidp) argp;
   1464        1.1       mrg 	} */ *uap = v;
   1465        1.1       mrg 	struct sys_nfssvc_args ua;
   1466        1.1       mrg 
   1467       1.11       mrg 	NETBSD32TO64_UAP(flag);
   1468       1.11       mrg 	NETBSD32TOP_UAP(argp, void);
   1469       1.70   thorpej 	return (sys_nfssvc(l, &ua, retval));
   1470        1.6       eeh #else
   1471        1.6       eeh 	/* Why would we want to support a 32-bit nfsd? */
   1472        1.6       eeh 	return (ENOSYS);
   1473        1.6       eeh #endif
   1474        1.1       mrg }
   1475        1.6       eeh #endif
   1476        1.1       mrg 
   1477        1.6       eeh #if defined(NFS) || defined(NFSSERVER)
   1478        1.1       mrg int
   1479       1.70   thorpej netbsd32_getfh(l, v, retval)
   1480       1.70   thorpej 	struct lwp *l;
   1481        1.1       mrg 	void *v;
   1482        1.1       mrg 	register_t *retval;
   1483        1.1       mrg {
   1484       1.19       eeh 	struct netbsd32_getfh_args /* {
   1485       1.10       mrg 		syscallarg(const netbsd32_charp) fname;
   1486       1.10       mrg 		syscallarg(netbsd32_fhandlep_t) fhp;
   1487        1.1       mrg 	} */ *uap = v;
   1488        1.1       mrg 	struct sys_getfh_args ua;
   1489        1.1       mrg 
   1490       1.11       mrg 	NETBSD32TOP_UAP(fname, const char);
   1491       1.11       mrg 	NETBSD32TOP_UAP(fhp, struct fhandle);
   1492        1.6       eeh 	/* Lucky for us a fhandlep_t doesn't change sizes */
   1493       1.70   thorpej 	return (sys_getfh(l, &ua, retval));
   1494        1.1       mrg }
   1495        1.6       eeh #endif
   1496        1.1       mrg 
   1497        1.1       mrg int
   1498       1.70   thorpej netbsd32_pread(l, v, retval)
   1499       1.70   thorpej 	struct lwp *l;
   1500        1.1       mrg 	void *v;
   1501        1.1       mrg 	register_t *retval;
   1502        1.1       mrg {
   1503       1.19       eeh 	struct netbsd32_pread_args /* {
   1504        1.1       mrg 		syscallarg(int) fd;
   1505       1.10       mrg 		syscallarg(netbsd32_voidp) buf;
   1506       1.10       mrg 		syscallarg(netbsd32_size_t) nbyte;
   1507        1.1       mrg 		syscallarg(int) pad;
   1508        1.1       mrg 		syscallarg(off_t) offset;
   1509        1.1       mrg 	} */ *uap = v;
   1510        1.1       mrg 	struct sys_pread_args ua;
   1511        1.1       mrg 	ssize_t rt;
   1512        1.1       mrg 	int error;
   1513        1.1       mrg 
   1514       1.11       mrg 	NETBSD32TO64_UAP(fd);
   1515       1.11       mrg 	NETBSD32TOP_UAP(buf, void);
   1516       1.11       mrg 	NETBSD32TOX_UAP(nbyte, size_t);
   1517       1.11       mrg 	NETBSD32TO64_UAP(pad);
   1518       1.11       mrg 	NETBSD32TO64_UAP(offset);
   1519       1.70   thorpej 	error = sys_pread(l, &ua, (register_t *)&rt);
   1520       1.32       mrg 	*retval = rt;
   1521        1.1       mrg 	return (error);
   1522        1.1       mrg }
   1523        1.1       mrg 
   1524        1.1       mrg int
   1525       1.70   thorpej netbsd32_pwrite(l, v, retval)
   1526       1.70   thorpej 	struct lwp *l;
   1527        1.1       mrg 	void *v;
   1528        1.1       mrg 	register_t *retval;
   1529        1.1       mrg {
   1530       1.19       eeh 	struct netbsd32_pwrite_args /* {
   1531        1.1       mrg 		syscallarg(int) fd;
   1532       1.10       mrg 		syscallarg(const netbsd32_voidp) buf;
   1533       1.10       mrg 		syscallarg(netbsd32_size_t) nbyte;
   1534        1.1       mrg 		syscallarg(int) pad;
   1535        1.1       mrg 		syscallarg(off_t) offset;
   1536        1.1       mrg 	} */ *uap = v;
   1537        1.1       mrg 	struct sys_pwrite_args ua;
   1538        1.1       mrg 	ssize_t rt;
   1539        1.1       mrg 	int error;
   1540        1.1       mrg 
   1541       1.11       mrg 	NETBSD32TO64_UAP(fd);
   1542       1.11       mrg 	NETBSD32TOP_UAP(buf, void);
   1543       1.11       mrg 	NETBSD32TOX_UAP(nbyte, size_t);
   1544       1.11       mrg 	NETBSD32TO64_UAP(pad);
   1545       1.11       mrg 	NETBSD32TO64_UAP(offset);
   1546       1.70   thorpej 	error = sys_pwrite(l, &ua, (register_t *)&rt);
   1547       1.32       mrg 	*retval = rt;
   1548        1.1       mrg 	return (error);
   1549        1.1       mrg }
   1550        1.1       mrg 
   1551        1.6       eeh int
   1552       1.70   thorpej netbsd32_setgid(l, v, retval)
   1553       1.70   thorpej 	struct lwp *l;
   1554        1.6       eeh 	void *v;
   1555        1.6       eeh 	register_t *retval;
   1556        1.6       eeh {
   1557       1.19       eeh 	struct netbsd32_setgid_args /* {
   1558        1.6       eeh 		syscallarg(gid_t) gid;
   1559        1.6       eeh 	} */ *uap = v;
   1560        1.6       eeh 	struct sys_setgid_args ua;
   1561        1.6       eeh 
   1562       1.11       mrg 	NETBSD32TO64_UAP(gid);
   1563       1.70   thorpej 	return (sys_setgid(l, v, retval));
   1564        1.6       eeh }
   1565        1.6       eeh 
   1566        1.6       eeh int
   1567       1.70   thorpej netbsd32_setegid(l, v, retval)
   1568       1.70   thorpej 	struct lwp *l;
   1569        1.6       eeh 	void *v;
   1570        1.6       eeh 	register_t *retval;
   1571        1.6       eeh {
   1572       1.19       eeh 	struct netbsd32_setegid_args /* {
   1573        1.6       eeh 		syscallarg(gid_t) egid;
   1574        1.6       eeh 	} */ *uap = v;
   1575        1.6       eeh 	struct sys_setegid_args ua;
   1576        1.6       eeh 
   1577       1.11       mrg 	NETBSD32TO64_UAP(egid);
   1578       1.70   thorpej 	return (sys_setegid(l, v, retval));
   1579        1.6       eeh }
   1580        1.6       eeh 
   1581        1.6       eeh int
   1582       1.70   thorpej netbsd32_seteuid(l, v, retval)
   1583       1.70   thorpej 	struct lwp *l;
   1584        1.6       eeh 	void *v;
   1585        1.6       eeh 	register_t *retval;
   1586        1.6       eeh {
   1587       1.19       eeh 	struct netbsd32_seteuid_args /* {
   1588        1.6       eeh 		syscallarg(gid_t) euid;
   1589        1.6       eeh 	} */ *uap = v;
   1590        1.6       eeh 	struct sys_seteuid_args ua;
   1591        1.6       eeh 
   1592       1.11       mrg 	NETBSD32TO64_UAP(euid);
   1593       1.70   thorpej 	return (sys_seteuid(l, v, retval));
   1594        1.1       mrg }
   1595        1.1       mrg 
   1596        1.6       eeh #ifdef LFS
   1597        1.1       mrg int
   1598       1.70   thorpej netbsd32_sys_lfs_bmapv(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.1       mrg 
   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_markv(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.1       mrg 
   1614        1.1       mrg 	return (ENOSYS);	/* XXX */
   1615        1.1       mrg }
   1616        1.1       mrg 
   1617        1.1       mrg int
   1618       1.70   thorpej netbsd32_sys_lfs_segclean(l, v, retval)
   1619       1.70   thorpej 	struct lwp *l;
   1620        1.1       mrg 	void *v;
   1621        1.1       mrg 	register_t *retval;
   1622        1.1       mrg {
   1623       1.20       eeh 
   1624        1.1       mrg 	return (ENOSYS);	/* XXX */
   1625        1.1       mrg }
   1626        1.1       mrg 
   1627        1.1       mrg int
   1628       1.70   thorpej netbsd32_sys_lfs_segwait(l, v, retval)
   1629       1.70   thorpej 	struct lwp *l;
   1630        1.1       mrg 	void *v;
   1631        1.1       mrg 	register_t *retval;
   1632        1.1       mrg {
   1633       1.20       eeh 
   1634        1.1       mrg 	return (ENOSYS);	/* XXX */
   1635        1.1       mrg }
   1636        1.6       eeh #endif
   1637        1.1       mrg 
   1638        1.1       mrg int
   1639       1.70   thorpej netbsd32_pathconf(l, v, retval)
   1640       1.70   thorpej 	struct lwp *l;
   1641        1.1       mrg 	void *v;
   1642        1.1       mrg 	register_t *retval;
   1643        1.1       mrg {
   1644       1.19       eeh 	struct netbsd32_pathconf_args /* {
   1645        1.1       mrg 		syscallarg(int) fd;
   1646        1.1       mrg 		syscallarg(int) name;
   1647        1.1       mrg 	} */ *uap = v;
   1648        1.1       mrg 	struct sys_pathconf_args ua;
   1649        1.1       mrg 	long rt;
   1650        1.1       mrg 	int error;
   1651        1.1       mrg 
   1652       1.11       mrg 	NETBSD32TOP_UAP(path, const char);
   1653       1.11       mrg 	NETBSD32TO64_UAP(name);
   1654       1.70   thorpej 	error = sys_pathconf(l, &ua, (register_t *)&rt);
   1655       1.32       mrg 	*retval = rt;
   1656        1.1       mrg 	return (error);
   1657        1.1       mrg }
   1658        1.1       mrg 
   1659        1.1       mrg int
   1660       1.70   thorpej netbsd32_fpathconf(l, v, retval)
   1661       1.70   thorpej 	struct lwp *l;
   1662        1.1       mrg 	void *v;
   1663        1.1       mrg 	register_t *retval;
   1664        1.1       mrg {
   1665       1.19       eeh 	struct netbsd32_fpathconf_args /* {
   1666        1.1       mrg 		syscallarg(int) fd;
   1667        1.1       mrg 		syscallarg(int) name;
   1668        1.1       mrg 	} */ *uap = v;
   1669        1.1       mrg 	struct sys_fpathconf_args ua;
   1670        1.1       mrg 	long rt;
   1671        1.1       mrg 	int error;
   1672        1.1       mrg 
   1673       1.11       mrg 	NETBSD32TO64_UAP(fd);
   1674       1.11       mrg 	NETBSD32TO64_UAP(name);
   1675       1.70   thorpej 	error = sys_fpathconf(l, &ua, (register_t *)&rt);
   1676       1.32       mrg 	*retval = rt;
   1677        1.1       mrg 	return (error);
   1678        1.1       mrg }
   1679        1.1       mrg 
   1680        1.1       mrg int
   1681       1.70   thorpej netbsd32_getrlimit(l, v, retval)
   1682       1.70   thorpej 	struct lwp *l;
   1683        1.1       mrg 	void *v;
   1684        1.1       mrg 	register_t *retval;
   1685        1.1       mrg {
   1686       1.19       eeh 	struct netbsd32_getrlimit_args /* {
   1687        1.1       mrg 		syscallarg(int) which;
   1688       1.10       mrg 		syscallarg(netbsd32_rlimitp_t) rlp;
   1689        1.1       mrg 	} */ *uap = v;
   1690        1.6       eeh 	int which = SCARG(uap, which);
   1691        1.1       mrg 
   1692        1.6       eeh 	if ((u_int)which >= RLIM_NLIMITS)
   1693        1.6       eeh 		return (EINVAL);
   1694       1.70   thorpej 	return (copyout(&l->l_proc->p_rlimit[which],
   1695       1.66       scw 	    (caddr_t)NETBSD32PTR64(SCARG(uap, rlp)), sizeof(struct rlimit)));
   1696        1.1       mrg }
   1697        1.1       mrg 
   1698        1.1       mrg int
   1699       1.70   thorpej netbsd32_setrlimit(l, v, retval)
   1700       1.70   thorpej 	struct lwp *l;
   1701        1.1       mrg 	void *v;
   1702        1.1       mrg 	register_t *retval;
   1703        1.1       mrg {
   1704       1.19       eeh 	struct netbsd32_setrlimit_args /* {
   1705        1.1       mrg 		syscallarg(int) which;
   1706       1.10       mrg 		syscallarg(const netbsd32_rlimitp_t) rlp;
   1707        1.1       mrg 	} */ *uap = v;
   1708        1.6       eeh 		int which = SCARG(uap, which);
   1709        1.6       eeh 	struct rlimit alim;
   1710        1.6       eeh 	int error;
   1711       1.70   thorpej 	struct proc *p = l->l_proc;
   1712        1.1       mrg 
   1713       1.66       scw 	error = copyin((caddr_t)NETBSD32PTR64(SCARG(uap, rlp)), &alim,
   1714       1.66       scw 	    sizeof(struct rlimit));
   1715        1.6       eeh 	if (error)
   1716        1.6       eeh 		return (error);
   1717       1.88      fvdl 
   1718       1.88      fvdl 	switch (which) {
   1719       1.88      fvdl 	case RLIMIT_DATA:
   1720       1.88      fvdl 		if (alim.rlim_cur > MAXDSIZ32)
   1721       1.88      fvdl 			alim.rlim_cur = MAXDSIZ32;
   1722       1.88      fvdl 		if (alim.rlim_max > MAXDSIZ32)
   1723       1.88      fvdl 			alim.rlim_max = MAXDSIZ32;
   1724       1.88      fvdl 		break;
   1725       1.88      fvdl 
   1726       1.88      fvdl 	case RLIMIT_STACK:
   1727       1.88      fvdl 		if (alim.rlim_cur > MAXSSIZ32)
   1728       1.88      fvdl 			alim.rlim_cur = MAXSSIZ32;
   1729       1.88      fvdl 		if (alim.rlim_max > MAXSSIZ32)
   1730       1.88      fvdl 			alim.rlim_max = MAXSSIZ32;
   1731       1.88      fvdl 	default:
   1732       1.88      fvdl 		break;
   1733       1.88      fvdl 	}
   1734       1.88      fvdl 
   1735       1.18    bouyer 	return (dosetrlimit(p, p->p_cred, which, &alim));
   1736        1.1       mrg }
   1737        1.1       mrg 
   1738        1.1       mrg int
   1739       1.70   thorpej netbsd32_mmap(l, v, retval)
   1740       1.70   thorpej 	struct lwp *l;
   1741        1.1       mrg 	void *v;
   1742        1.1       mrg 	register_t *retval;
   1743        1.1       mrg {
   1744       1.19       eeh 	struct netbsd32_mmap_args /* {
   1745       1.10       mrg 		syscallarg(netbsd32_voidp) addr;
   1746       1.10       mrg 		syscallarg(netbsd32_size_t) len;
   1747        1.1       mrg 		syscallarg(int) prot;
   1748        1.1       mrg 		syscallarg(int) flags;
   1749        1.1       mrg 		syscallarg(int) fd;
   1750       1.10       mrg 		syscallarg(netbsd32_long) pad;
   1751        1.1       mrg 		syscallarg(off_t) pos;
   1752        1.1       mrg 	} */ *uap = v;
   1753        1.1       mrg 	struct sys_mmap_args ua;
   1754        1.1       mrg 	int error;
   1755        1.1       mrg 
   1756       1.11       mrg 	NETBSD32TOP_UAP(addr, void);
   1757       1.11       mrg 	NETBSD32TOX_UAP(len, size_t);
   1758       1.11       mrg 	NETBSD32TO64_UAP(prot);
   1759       1.11       mrg 	NETBSD32TO64_UAP(flags);
   1760       1.11       mrg 	NETBSD32TO64_UAP(fd);
   1761       1.11       mrg 	NETBSD32TOX_UAP(pad, long);
   1762       1.11       mrg 	NETBSD32TOX_UAP(pos, off_t);
   1763       1.70   thorpej 	error = sys_mmap(l, &ua, retval);
   1764       1.69       scw 	if ((u_long)*retval > (u_long)UINT_MAX) {
   1765       1.69       scw 		printf("netbsd32_mmap: retval out of range: 0x%lx",
   1766       1.69       scw 		    (u_long)*retval);
   1767       1.55       eeh 		/* Should try to recover and return an error here. */
   1768       1.55       eeh 	}
   1769        1.1       mrg 	return (error);
   1770        1.1       mrg }
   1771        1.1       mrg 
   1772        1.1       mrg int
   1773       1.70   thorpej netbsd32_lseek(l, v, retval)
   1774       1.70   thorpej 	struct lwp *l;
   1775        1.6       eeh 	void *v;
   1776        1.6       eeh 	register_t *retval;
   1777        1.6       eeh {
   1778       1.19       eeh 	struct netbsd32_lseek_args /* {
   1779        1.6       eeh 		syscallarg(int) fd;
   1780        1.6       eeh 		syscallarg(int) pad;
   1781        1.6       eeh 		syscallarg(off_t) offset;
   1782        1.6       eeh 		syscallarg(int) whence;
   1783        1.6       eeh 	} */ *uap = v;
   1784        1.6       eeh 	struct sys_lseek_args ua;
   1785       1.97    martin 	int rv;
   1786        1.6       eeh 
   1787       1.11       mrg 	NETBSD32TO64_UAP(fd);
   1788       1.11       mrg 	NETBSD32TO64_UAP(pad);
   1789       1.11       mrg 	NETBSD32TO64_UAP(offset);
   1790       1.11       mrg 	NETBSD32TO64_UAP(whence);
   1791       1.97    martin 	rv = sys_lseek(l, &ua, retval);
   1792       1.97    martin #ifdef NETBSD32_OFF_T_RETURN
   1793       1.97    martin 	if (rv == 0)
   1794       1.97    martin 		NETBSD32_OFF_T_RETURN(retval);
   1795       1.97    martin #endif
   1796       1.97    martin 	return rv;
   1797        1.6       eeh }
   1798        1.6       eeh 
   1799        1.6       eeh int
   1800       1.70   thorpej netbsd32_truncate(l, v, retval)
   1801       1.70   thorpej 	struct lwp *l;
   1802        1.1       mrg 	void *v;
   1803        1.1       mrg 	register_t *retval;
   1804        1.1       mrg {
   1805       1.19       eeh 	struct netbsd32_truncate_args /* {
   1806       1.10       mrg 		syscallarg(const netbsd32_charp) path;
   1807        1.1       mrg 		syscallarg(int) pad;
   1808        1.1       mrg 		syscallarg(off_t) length;
   1809        1.1       mrg 	} */ *uap = v;
   1810        1.1       mrg 	struct sys_truncate_args ua;
   1811        1.1       mrg 
   1812       1.11       mrg 	NETBSD32TOP_UAP(path, const char);
   1813       1.11       mrg 	NETBSD32TO64_UAP(pad);
   1814       1.11       mrg 	NETBSD32TO64_UAP(length);
   1815       1.70   thorpej 	return (sys_truncate(l, &ua, retval));
   1816        1.1       mrg }
   1817        1.1       mrg 
   1818        1.1       mrg int
   1819       1.70   thorpej netbsd32_ftruncate(l, v, retval)
   1820       1.70   thorpej 	struct lwp *l;
   1821        1.6       eeh 	void *v;
   1822        1.6       eeh 	register_t *retval;
   1823        1.6       eeh {
   1824       1.19       eeh 	struct netbsd32_ftruncate_args /* {
   1825        1.6       eeh 		syscallarg(int) fd;
   1826        1.6       eeh 		syscallarg(int) pad;
   1827        1.6       eeh 		syscallarg(off_t) length;
   1828        1.6       eeh 	} */ *uap = v;
   1829        1.6       eeh 	struct sys_ftruncate_args ua;
   1830        1.6       eeh 
   1831       1.11       mrg 	NETBSD32TO64_UAP(fd);
   1832       1.11       mrg 	NETBSD32TO64_UAP(pad);
   1833       1.11       mrg 	NETBSD32TO64_UAP(length);
   1834       1.70   thorpej 	return (sys_ftruncate(l, &ua, retval));
   1835        1.6       eeh }
   1836        1.6       eeh 
   1837       1.53       mrg int
   1838       1.70   thorpej netbsd32_mlock(l, v, retval)
   1839       1.70   thorpej 	struct lwp *l;
   1840       1.57       mrg 	void *v;
   1841       1.57       mrg 	register_t *retval;
   1842       1.53       mrg {
   1843       1.57       mrg 	struct netbsd32_mlock_args /* {
   1844       1.57       mrg 		syscallarg(const netbsd32_voidp) addr;
   1845       1.57       mrg 		syscallarg(netbsd32_size_t) len;
   1846       1.57       mrg 	} */ *uap = v;
   1847       1.57       mrg 	struct sys_mlock_args ua;
   1848       1.53       mrg 
   1849       1.57       mrg 	NETBSD32TOP_UAP(addr, const void);
   1850       1.57       mrg 	NETBSD32TO64_UAP(len);
   1851       1.70   thorpej 	return (sys_mlock(l, &ua, retval));
   1852       1.53       mrg }
   1853       1.53       mrg 
   1854        1.6       eeh int
   1855       1.70   thorpej netbsd32_munlock(l, v, retval)
   1856       1.70   thorpej 	struct lwp *l;
   1857        1.1       mrg 	void *v;
   1858        1.1       mrg 	register_t *retval;
   1859        1.1       mrg {
   1860       1.57       mrg 	struct netbsd32_munlock_args /* {
   1861       1.57       mrg 		syscallarg(const netbsd32_voidp) addr;
   1862       1.57       mrg 		syscallarg(netbsd32_size_t) len;
   1863        1.1       mrg 	} */ *uap = v;
   1864        1.1       mrg 	struct sys_munlock_args ua;
   1865        1.1       mrg 
   1866       1.11       mrg 	NETBSD32TOP_UAP(addr, const void);
   1867       1.11       mrg 	NETBSD32TO64_UAP(len);
   1868       1.70   thorpej 	return (sys_munlock(l, &ua, retval));
   1869        1.1       mrg }
   1870        1.1       mrg 
   1871        1.1       mrg int
   1872       1.70   thorpej netbsd32_undelete(l, v, retval)
   1873       1.70   thorpej 	struct lwp *l;
   1874        1.1       mrg 	void *v;
   1875        1.1       mrg 	register_t *retval;
   1876        1.1       mrg {
   1877       1.19       eeh 	struct netbsd32_undelete_args /* {
   1878       1.10       mrg 		syscallarg(const netbsd32_charp) path;
   1879        1.1       mrg 	} */ *uap = v;
   1880        1.1       mrg 	struct sys_undelete_args ua;
   1881        1.1       mrg 
   1882       1.11       mrg 	NETBSD32TOP_UAP(path, const char);
   1883       1.70   thorpej 	return (sys_undelete(l, &ua, retval));
   1884        1.1       mrg }
   1885        1.1       mrg 
   1886        1.6       eeh int
   1887       1.70   thorpej netbsd32_getpgid(l, v, retval)
   1888       1.70   thorpej 	struct lwp *l;
   1889        1.6       eeh 	void *v;
   1890        1.6       eeh 	register_t *retval;
   1891        1.6       eeh {
   1892       1.19       eeh 	struct netbsd32_getpgid_args /* {
   1893        1.6       eeh 		syscallarg(pid_t) pid;
   1894        1.6       eeh 	} */ *uap = v;
   1895        1.6       eeh 	struct sys_getpgid_args ua;
   1896        1.1       mrg 
   1897       1.11       mrg 	NETBSD32TO64_UAP(pid);
   1898       1.70   thorpej 	return (sys_getpgid(l, &ua, retval));
   1899        1.1       mrg }
   1900        1.1       mrg 
   1901        1.1       mrg int
   1902       1.70   thorpej netbsd32_reboot(l, v, retval)
   1903       1.70   thorpej 	struct lwp *l;
   1904        1.1       mrg 	void *v;
   1905        1.1       mrg 	register_t *retval;
   1906        1.1       mrg {
   1907       1.19       eeh 	struct netbsd32_reboot_args /* {
   1908        1.1       mrg 		syscallarg(int) opt;
   1909       1.10       mrg 		syscallarg(netbsd32_charp) bootstr;
   1910        1.1       mrg 	} */ *uap = v;
   1911        1.1       mrg 	struct sys_reboot_args ua;
   1912        1.1       mrg 
   1913       1.11       mrg 	NETBSD32TO64_UAP(opt);
   1914       1.11       mrg 	NETBSD32TOP_UAP(bootstr, char);
   1915       1.70   thorpej 	return (sys_reboot(l, &ua, retval));
   1916        1.1       mrg }
   1917        1.1       mrg 
   1918      1.100      manu #include <sys/poll.h>
   1919        1.1       mrg int
   1920       1.70   thorpej netbsd32_poll(l, v, retval)
   1921       1.70   thorpej 	struct lwp *l;
   1922        1.1       mrg 	void *v;
   1923        1.1       mrg 	register_t *retval;
   1924        1.1       mrg {
   1925       1.19       eeh 	struct netbsd32_poll_args /* {
   1926       1.10       mrg 		syscallarg(netbsd32_pollfdp_t) fds;
   1927        1.1       mrg 		syscallarg(u_int) nfds;
   1928        1.1       mrg 		syscallarg(int) timeout;
   1929        1.1       mrg 	} */ *uap = v;
   1930        1.1       mrg 	struct sys_poll_args ua;
   1931        1.1       mrg 
   1932       1.11       mrg 	NETBSD32TOP_UAP(fds, struct pollfd);
   1933       1.11       mrg 	NETBSD32TO64_UAP(nfds);
   1934       1.11       mrg 	NETBSD32TO64_UAP(timeout);
   1935      1.100      manu 
   1936       1.70   thorpej 	return (sys_poll(l, &ua, retval));
   1937        1.1       mrg }
   1938        1.1       mrg 
   1939        1.6       eeh int
   1940       1.70   thorpej netbsd32_fdatasync(l, v, retval)
   1941       1.70   thorpej 	struct lwp *l;
   1942        1.6       eeh 	void *v;
   1943        1.6       eeh 	register_t *retval;
   1944        1.6       eeh {
   1945       1.19       eeh 	struct netbsd32_fdatasync_args /* {
   1946        1.6       eeh 		syscallarg(int) fd;
   1947        1.6       eeh 	} */ *uap = v;
   1948        1.6       eeh 	struct sys_fdatasync_args ua;
   1949        1.6       eeh 
   1950       1.11       mrg 	NETBSD32TO64_UAP(fd);
   1951       1.70   thorpej 	return (sys_fdatasync(l, &ua, retval));
   1952        1.1       mrg }
   1953        1.1       mrg 
   1954        1.1       mrg int
   1955       1.70   thorpej netbsd32___posix_rename(l, v, retval)
   1956       1.70   thorpej 	struct lwp *l;
   1957        1.1       mrg 	void *v;
   1958        1.1       mrg 	register_t *retval;
   1959        1.1       mrg {
   1960       1.19       eeh 	struct netbsd32___posix_rename_args /* {
   1961       1.10       mrg 		syscallarg(const netbsd32_charp) from;
   1962       1.10       mrg 		syscallarg(const netbsd32_charp) to;
   1963        1.1       mrg 	} */ *uap = v;
   1964        1.1       mrg 	struct sys___posix_rename_args ua;
   1965        1.1       mrg 
   1966       1.20       eeh 	NETBSD32TOP_UAP(from, const char);
   1967       1.20       eeh 	NETBSD32TOP_UAP(to, const char);
   1968       1.70   thorpej 	return (sys___posix_rename(l, &ua, retval));
   1969        1.1       mrg }
   1970        1.1       mrg 
   1971        1.1       mrg int
   1972       1.70   thorpej netbsd32_swapctl(l, v, retval)
   1973       1.70   thorpej 	struct lwp *l;
   1974        1.1       mrg 	void *v;
   1975        1.1       mrg 	register_t *retval;
   1976        1.1       mrg {
   1977       1.19       eeh 	struct netbsd32_swapctl_args /* {
   1978        1.1       mrg 		syscallarg(int) cmd;
   1979       1.10       mrg 		syscallarg(const netbsd32_voidp) arg;
   1980        1.1       mrg 		syscallarg(int) misc;
   1981        1.1       mrg 	} */ *uap = v;
   1982        1.1       mrg 	struct sys_swapctl_args ua;
   1983        1.1       mrg 
   1984       1.11       mrg 	NETBSD32TO64_UAP(cmd);
   1985       1.89       chs 	NETBSD32TOP_UAP(arg, void);
   1986       1.11       mrg 	NETBSD32TO64_UAP(misc);
   1987       1.70   thorpej 	return (sys_swapctl(l, &ua, retval));
   1988        1.1       mrg }
   1989        1.1       mrg 
   1990        1.1       mrg int
   1991       1.70   thorpej netbsd32_minherit(l, v, retval)
   1992       1.70   thorpej 	struct lwp *l;
   1993        1.1       mrg 	void *v;
   1994        1.1       mrg 	register_t *retval;
   1995        1.1       mrg {
   1996       1.19       eeh 	struct netbsd32_minherit_args /* {
   1997       1.10       mrg 		syscallarg(netbsd32_voidp) addr;
   1998       1.10       mrg 		syscallarg(netbsd32_size_t) len;
   1999        1.1       mrg 		syscallarg(int) inherit;
   2000        1.1       mrg 	} */ *uap = v;
   2001        1.1       mrg 	struct sys_minherit_args ua;
   2002        1.1       mrg 
   2003       1.11       mrg 	NETBSD32TOP_UAP(addr, void);
   2004       1.11       mrg 	NETBSD32TOX_UAP(len, size_t);
   2005       1.11       mrg 	NETBSD32TO64_UAP(inherit);
   2006       1.70   thorpej 	return (sys_minherit(l, &ua, retval));
   2007        1.1       mrg }
   2008        1.1       mrg 
   2009        1.1       mrg int
   2010       1.70   thorpej netbsd32_lchmod(l, v, retval)
   2011       1.70   thorpej 	struct lwp *l;
   2012        1.1       mrg 	void *v;
   2013        1.1       mrg 	register_t *retval;
   2014        1.1       mrg {
   2015       1.19       eeh 	struct netbsd32_lchmod_args /* {
   2016       1.10       mrg 		syscallarg(const netbsd32_charp) path;
   2017        1.1       mrg 		syscallarg(mode_t) mode;
   2018        1.1       mrg 	} */ *uap = v;
   2019        1.1       mrg 	struct sys_lchmod_args ua;
   2020        1.1       mrg 
   2021       1.11       mrg 	NETBSD32TOP_UAP(path, const char);
   2022       1.11       mrg 	NETBSD32TO64_UAP(mode);
   2023       1.70   thorpej 	return (sys_lchmod(l, &ua, retval));
   2024        1.1       mrg }
   2025        1.1       mrg 
   2026        1.1       mrg int
   2027       1.70   thorpej netbsd32_lchown(l, v, retval)
   2028       1.70   thorpej 	struct lwp *l;
   2029        1.1       mrg 	void *v;
   2030        1.1       mrg 	register_t *retval;
   2031        1.1       mrg {
   2032       1.19       eeh 	struct netbsd32_lchown_args /* {
   2033       1.10       mrg 		syscallarg(const netbsd32_charp) path;
   2034        1.1       mrg 		syscallarg(uid_t) uid;
   2035        1.1       mrg 		syscallarg(gid_t) gid;
   2036        1.1       mrg 	} */ *uap = v;
   2037        1.1       mrg 	struct sys_lchown_args ua;
   2038        1.1       mrg 
   2039       1.11       mrg 	NETBSD32TOP_UAP(path, const char);
   2040       1.11       mrg 	NETBSD32TO64_UAP(uid);
   2041       1.11       mrg 	NETBSD32TO64_UAP(gid);
   2042       1.70   thorpej 	return (sys_lchown(l, &ua, retval));
   2043        1.1       mrg }
   2044        1.1       mrg 
   2045        1.1       mrg int
   2046       1.70   thorpej netbsd32___msync13(l, v, retval)
   2047       1.70   thorpej 	struct lwp *l;
   2048        1.1       mrg 	void *v;
   2049        1.1       mrg 	register_t *retval;
   2050        1.1       mrg {
   2051       1.19       eeh 	struct netbsd32___msync13_args /* {
   2052       1.10       mrg 		syscallarg(netbsd32_voidp) addr;
   2053       1.10       mrg 		syscallarg(netbsd32_size_t) len;
   2054        1.1       mrg 		syscallarg(int) flags;
   2055        1.1       mrg 	} */ *uap = v;
   2056        1.1       mrg 	struct sys___msync13_args ua;
   2057        1.1       mrg 
   2058       1.11       mrg 	NETBSD32TOP_UAP(addr, void);
   2059       1.11       mrg 	NETBSD32TOX_UAP(len, size_t);
   2060       1.11       mrg 	NETBSD32TO64_UAP(flags);
   2061       1.70   thorpej 	return (sys___msync13(l, &ua, retval));
   2062        1.1       mrg }
   2063        1.1       mrg 
   2064        1.1       mrg int
   2065       1.70   thorpej netbsd32___posix_chown(l, v, retval)
   2066       1.70   thorpej 	struct lwp *l;
   2067        1.1       mrg 	void *v;
   2068        1.1       mrg 	register_t *retval;
   2069        1.1       mrg {
   2070       1.19       eeh 	struct netbsd32___posix_chown_args /* {
   2071       1.10       mrg 		syscallarg(const netbsd32_charp) path;
   2072        1.1       mrg 		syscallarg(uid_t) uid;
   2073        1.1       mrg 		syscallarg(gid_t) gid;
   2074        1.1       mrg 	} */ *uap = v;
   2075        1.1       mrg 	struct sys___posix_chown_args ua;
   2076        1.1       mrg 
   2077       1.11       mrg 	NETBSD32TOP_UAP(path, const char);
   2078       1.11       mrg 	NETBSD32TO64_UAP(uid);
   2079       1.11       mrg 	NETBSD32TO64_UAP(gid);
   2080       1.70   thorpej 	return (sys___posix_chown(l, &ua, retval));
   2081        1.1       mrg }
   2082        1.1       mrg 
   2083        1.1       mrg int
   2084       1.70   thorpej netbsd32___posix_fchown(l, v, retval)
   2085       1.70   thorpej 	struct lwp *l;
   2086        1.6       eeh 	void *v;
   2087        1.6       eeh 	register_t *retval;
   2088        1.6       eeh {
   2089       1.19       eeh 	struct netbsd32___posix_fchown_args /* {
   2090        1.6       eeh 		syscallarg(int) fd;
   2091        1.6       eeh 		syscallarg(uid_t) uid;
   2092        1.6       eeh 		syscallarg(gid_t) gid;
   2093        1.6       eeh 	} */ *uap = v;
   2094        1.6       eeh 	struct sys___posix_fchown_args ua;
   2095        1.6       eeh 
   2096       1.11       mrg 	NETBSD32TO64_UAP(fd);
   2097       1.11       mrg 	NETBSD32TO64_UAP(uid);
   2098       1.11       mrg 	NETBSD32TO64_UAP(gid);
   2099       1.70   thorpej 	return (sys___posix_fchown(l, &ua, retval));
   2100        1.6       eeh }
   2101        1.6       eeh 
   2102        1.6       eeh int
   2103       1.70   thorpej netbsd32___posix_lchown(l, v, retval)
   2104       1.70   thorpej 	struct lwp *l;
   2105        1.1       mrg 	void *v;
   2106        1.1       mrg 	register_t *retval;
   2107        1.1       mrg {
   2108       1.19       eeh 	struct netbsd32___posix_lchown_args /* {
   2109       1.10       mrg 		syscallarg(const netbsd32_charp) path;
   2110        1.1       mrg 		syscallarg(uid_t) uid;
   2111        1.1       mrg 		syscallarg(gid_t) gid;
   2112        1.1       mrg 	} */ *uap = v;
   2113        1.1       mrg 	struct sys___posix_lchown_args ua;
   2114        1.1       mrg 
   2115       1.11       mrg 	NETBSD32TOP_UAP(path, const char);
   2116       1.11       mrg 	NETBSD32TO64_UAP(uid);
   2117       1.11       mrg 	NETBSD32TO64_UAP(gid);
   2118       1.70   thorpej 	return (sys___posix_lchown(l, &ua, retval));
   2119        1.1       mrg }
   2120        1.1       mrg 
   2121        1.1       mrg int
   2122       1.70   thorpej netbsd32_getsid(l, v, retval)
   2123       1.70   thorpej 	struct lwp *l;
   2124        1.6       eeh 	void *v;
   2125        1.6       eeh 	register_t *retval;
   2126        1.6       eeh {
   2127       1.19       eeh 	struct netbsd32_getsid_args /* {
   2128        1.6       eeh 		syscallarg(pid_t) pid;
   2129        1.6       eeh 	} */ *uap = v;
   2130        1.6       eeh 	struct sys_getsid_args ua;
   2131        1.6       eeh 
   2132       1.11       mrg 	NETBSD32TO64_UAP(pid);
   2133       1.70   thorpej 	return (sys_getsid(l, &ua, retval));
   2134        1.6       eeh }
   2135        1.6       eeh 
   2136       1.42  jdolecek #ifdef KTRACE
   2137        1.6       eeh int
   2138       1.70   thorpej netbsd32_fktrace(l, v, retval)
   2139       1.70   thorpej 	struct lwp *l;
   2140        1.6       eeh 	void *v;
   2141        1.6       eeh 	register_t *retval;
   2142        1.6       eeh {
   2143       1.19       eeh 	struct netbsd32_fktrace_args /* {
   2144        1.6       eeh 		syscallarg(const int) fd;
   2145        1.6       eeh 		syscallarg(int) ops;
   2146        1.6       eeh 		syscallarg(int) facs;
   2147        1.6       eeh 		syscallarg(int) pid;
   2148        1.6       eeh 	} */ *uap = v;
   2149       1.43      fvdl #if 0
   2150        1.6       eeh 	struct sys_fktrace_args ua;
   2151       1.43      fvdl #else
   2152       1.43      fvdl 	/* XXXX */
   2153       1.43      fvdl 	struct sys_fktrace_noconst_args {
   2154       1.43      fvdl 		syscallarg(int) fd;
   2155       1.43      fvdl 		syscallarg(int) ops;
   2156       1.43      fvdl 		syscallarg(int) facs;
   2157       1.43      fvdl 		syscallarg(int) pid;
   2158       1.43      fvdl 	} ua;
   2159       1.43      fvdl #endif
   2160        1.6       eeh 
   2161       1.32       mrg 	NETBSD32TOX_UAP(fd, int);
   2162       1.11       mrg 	NETBSD32TO64_UAP(ops);
   2163       1.11       mrg 	NETBSD32TO64_UAP(facs);
   2164       1.11       mrg 	NETBSD32TO64_UAP(pid);
   2165       1.70   thorpej 	return (sys_fktrace(l, &ua, retval));
   2166        1.6       eeh }
   2167       1.42  jdolecek #endif /* KTRACE */
   2168        1.6       eeh 
   2169       1.87     perry int netbsd32___sigpending14(l, v, retval)
   2170       1.70   thorpej 	struct lwp *l;
   2171       1.20       eeh 	void   *v;
   2172       1.20       eeh 	register_t *retval;
   2173       1.20       eeh {
   2174       1.25  augustss 	struct netbsd32___sigpending14_args /* {
   2175       1.20       eeh 		syscallarg(sigset_t *) set;
   2176       1.20       eeh 	} */ *uap = v;
   2177       1.20       eeh 	struct sys___sigpending14_args ua;
   2178       1.20       eeh 
   2179       1.20       eeh 	NETBSD32TOP_UAP(set, sigset_t);
   2180       1.70   thorpej 	return (sys___sigpending14(l, &ua, retval));
   2181       1.20       eeh }
   2182       1.20       eeh 
   2183       1.87     perry int netbsd32___sigprocmask14(l, v, retval)
   2184       1.70   thorpej 	struct lwp *l;
   2185       1.20       eeh 	void   *v;
   2186       1.20       eeh 	register_t *retval;
   2187       1.20       eeh {
   2188       1.25  augustss 	struct netbsd32___sigprocmask14_args /* {
   2189       1.20       eeh 		syscallarg(int) how;
   2190       1.20       eeh 		syscallarg(const sigset_t *) set;
   2191       1.20       eeh 		syscallarg(sigset_t *) oset;
   2192       1.20       eeh 	} */ *uap = v;
   2193       1.20       eeh 	struct sys___sigprocmask14_args ua;
   2194       1.20       eeh 
   2195       1.20       eeh 	NETBSD32TO64_UAP(how);
   2196       1.20       eeh 	NETBSD32TOP_UAP(set, sigset_t);
   2197       1.20       eeh 	NETBSD32TOP_UAP(oset, sigset_t);
   2198       1.70   thorpej 	return (sys___sigprocmask14(l, &ua, retval));
   2199       1.20       eeh }
   2200       1.20       eeh 
   2201       1.87     perry int netbsd32___sigsuspend14(l, v, retval)
   2202       1.70   thorpej 	struct lwp *l;
   2203       1.20       eeh 	void   *v;
   2204       1.20       eeh 	register_t *retval;
   2205       1.20       eeh {
   2206       1.20       eeh 	struct netbsd32___sigsuspend14_args /* {
   2207       1.20       eeh 		syscallarg(const sigset_t *) set;
   2208       1.20       eeh 	} */ *uap = v;
   2209       1.20       eeh 	struct sys___sigsuspend14_args ua;
   2210       1.20       eeh 
   2211       1.20       eeh 	NETBSD32TOP_UAP(set, sigset_t);
   2212       1.70   thorpej 	return (sys___sigsuspend14(l, &ua, retval));
   2213       1.20       eeh };
   2214       1.20       eeh 
   2215       1.70   thorpej int netbsd32_fchroot(l, v, retval)
   2216       1.70   thorpej 	struct lwp *l;
   2217       1.20       eeh 	void *v;
   2218       1.20       eeh 	register_t *retval;
   2219       1.20       eeh {
   2220       1.25  augustss 	struct netbsd32_fchroot_args /* {
   2221       1.20       eeh 		syscallarg(int) fd;
   2222       1.20       eeh 	} */ *uap = v;
   2223       1.20       eeh 	struct sys_fchroot_args ua;
   2224       1.87     perry 
   2225       1.20       eeh 	NETBSD32TO64_UAP(fd);
   2226       1.70   thorpej 	return (sys_fchroot(l, &ua, retval));
   2227       1.20       eeh }
   2228       1.20       eeh 
   2229       1.20       eeh /*
   2230       1.20       eeh  * Open a file given a file handle.
   2231       1.20       eeh  *
   2232       1.20       eeh  * Check permissions, allocate an open file structure,
   2233       1.20       eeh  * and call the device open routine if any.
   2234       1.20       eeh  */
   2235        1.6       eeh int
   2236       1.70   thorpej netbsd32_fhopen(l, v, retval)
   2237       1.70   thorpej 	struct lwp *l;
   2238       1.20       eeh 	void *v;
   2239       1.20       eeh 	register_t *retval;
   2240       1.20       eeh {
   2241       1.25  augustss 	struct netbsd32_fhopen_args /* {
   2242       1.20       eeh 		syscallarg(const fhandle_t *) fhp;
   2243       1.20       eeh 		syscallarg(int) flags;
   2244       1.20       eeh 	} */ *uap = v;
   2245       1.20       eeh 	struct sys_fhopen_args ua;
   2246       1.20       eeh 
   2247       1.20       eeh 	NETBSD32TOP_UAP(fhp, fhandle_t);
   2248       1.20       eeh 	NETBSD32TO64_UAP(flags);
   2249       1.70   thorpej 	return (sys_fhopen(l, &ua, retval));
   2250       1.20       eeh }
   2251       1.20       eeh 
   2252       1.37    martin /* virtual memory syscalls */
   2253       1.37    martin int
   2254       1.70   thorpej netbsd32_ovadvise(l, v, retval)
   2255       1.70   thorpej 	struct lwp *l;
   2256       1.37    martin 	void *v;
   2257       1.37    martin 	register_t *retval;
   2258       1.37    martin {
   2259       1.37    martin 	struct netbsd32_ovadvise_args /* {
   2260       1.37    martin 		syscallarg(int) anom;
   2261       1.37    martin 	} */ *uap = v;
   2262       1.37    martin 	struct sys_ovadvise_args ua;
   2263       1.37    martin 
   2264       1.37    martin 	NETBSD32TO64_UAP(anom);
   2265       1.70   thorpej 	return (sys_ovadvise(l, &ua, retval));
   2266       1.37    martin }
   2267       1.37    martin 
   2268       1.88      fvdl void
   2269       1.88      fvdl netbsd32_adjust_limits(struct proc *p)
   2270       1.88      fvdl {
   2271       1.88      fvdl 	rlim_t *valp;
   2272       1.88      fvdl 
   2273       1.88      fvdl 	valp = &p->p_rlimit[RLIMIT_DATA].rlim_cur;
   2274       1.88      fvdl 	if (*valp != RLIM_INFINITY && *valp > MAXDSIZ32)
   2275       1.88      fvdl 		*valp = MAXDSIZ32;
   2276       1.88      fvdl 	valp = &p->p_rlimit[RLIMIT_DATA].rlim_max;
   2277       1.88      fvdl 	if (*valp != RLIM_INFINITY && *valp > MAXDSIZ32)
   2278       1.88      fvdl 		*valp = MAXDSIZ32;
   2279       1.88      fvdl 
   2280       1.88      fvdl 	valp = &p->p_rlimit[RLIMIT_STACK].rlim_cur;
   2281       1.88      fvdl 	if (*valp != RLIM_INFINITY && *valp > MAXSSIZ32)
   2282       1.88      fvdl 		*valp = MAXSSIZ32;
   2283       1.88      fvdl 	valp = &p->p_rlimit[RLIMIT_STACK].rlim_max;
   2284       1.88      fvdl 	if (*valp != RLIM_INFINITY && *valp > MAXSSIZ32)
   2285       1.88      fvdl 		*valp = MAXSSIZ32;
   2286       1.88      fvdl }
   2287       1.90      cube 
   2288       1.90      cube int
   2289       1.90      cube netbsd32_uuidgen(struct lwp *l, void *v, register_t *retval)
   2290       1.90      cube {
   2291       1.90      cube 	struct netbsd32_uuidgen_args /* {
   2292       1.90      cube 		syscallarg(netbsd32_uuidp_t) store;
   2293       1.90      cube 		syscallarg(int) count;
   2294       1.90      cube 	} */ *uap = v;
   2295       1.90      cube 	struct sys_uuidgen_args ua;
   2296       1.90      cube 
   2297       1.90      cube 	NETBSD32TOP_UAP(store, struct uuid);
   2298       1.90      cube 	NETBSD32TO64_UAP(count);
   2299       1.90      cube 	return (sys_uuidgen(l, &ua, retval));
   2300       1.90      cube }
   2301       1.91      cube 
   2302       1.91      cube int
   2303       1.91      cube netbsd32_extattrctl(struct lwp *l, void *v, register_t *retval)
   2304       1.91      cube {
   2305       1.91      cube 	struct netbsd32_extattrctl_args /* {
   2306       1.91      cube 		syscallarg(const netbsd32_charp) path;
   2307       1.91      cube 		syscallarg(int) cmd;
   2308       1.91      cube 		syscallarg(const netbsd32_charp) filename;
   2309       1.91      cube 		syscallarg(int) attrnamespace;
   2310       1.91      cube 		syscallarg(const netbsd32_charp) attrname;
   2311       1.91      cube 	} */ *uap = v;
   2312       1.91      cube 	struct sys_extattrctl_args ua;
   2313       1.91      cube 
   2314       1.91      cube 	NETBSD32TOP_UAP(path, const char);
   2315       1.91      cube 	NETBSD32TO64_UAP(cmd);
   2316       1.91      cube 	NETBSD32TOP_UAP(filename, const char);
   2317       1.91      cube 	NETBSD32TO64_UAP(attrnamespace);
   2318       1.91      cube 	NETBSD32TOP_UAP(attrname, const char);
   2319       1.91      cube 	return sys_extattrctl(l, &ua, retval);
   2320       1.91      cube }
   2321       1.91      cube 
   2322       1.91      cube int
   2323       1.91      cube netbsd32_extattr_set_fd(struct lwp *l, void *v, register_t *retval)
   2324       1.91      cube {
   2325       1.91      cube 	struct netbsd32_extattr_set_fd_args /* {
   2326       1.91      cube 		syscallarg(int) fd;
   2327       1.91      cube 		syscallarg(int) attrnamespace;
   2328       1.91      cube 		syscallarg(const netbsd32_charp) attrname;
   2329       1.91      cube 		syscallarg(const netbsd32_voidp) data;
   2330       1.91      cube 		syscallarg(netbsd32_size_t) nbytes;
   2331       1.91      cube 	} */ *uap = v;
   2332       1.91      cube 	struct sys_extattr_set_fd_args ua;
   2333       1.91      cube 
   2334       1.91      cube 	NETBSD32TO64_UAP(fd);
   2335       1.91      cube 	NETBSD32TO64_UAP(attrnamespace);
   2336       1.91      cube 	NETBSD32TOP_UAP(attrname, const char);
   2337       1.91      cube 	NETBSD32TOP_UAP(data, const void);
   2338       1.91      cube 	NETBSD32TOX_UAP(nbytes, size_t);
   2339       1.91      cube 	return sys_extattr_set_fd(l, &ua, retval);
   2340       1.91      cube }
   2341       1.91      cube 
   2342       1.91      cube int
   2343       1.91      cube netbsd32_extattr_set_file(struct lwp *l, void *v, register_t *retval)
   2344       1.91      cube {
   2345       1.91      cube 	struct netbsd32_extattr_set_file_args /* {
   2346       1.91      cube 		syscallarg(const netbsd32_charp) path;
   2347       1.91      cube 		syscallarg(int) attrnamespace;
   2348       1.91      cube 		syscallarg(const netbsd32_charp) attrname;
   2349       1.91      cube 		syscallarg(const netbsd32_voidp) data;
   2350       1.91      cube 		syscallarg(netbsd32_size_t) nbytes;
   2351       1.91      cube 	} */ *uap = v;
   2352       1.91      cube 	struct sys_extattr_set_file_args ua;
   2353       1.91      cube 
   2354       1.91      cube 	NETBSD32TOP_UAP(path, const char);
   2355       1.91      cube 	NETBSD32TO64_UAP(attrnamespace);
   2356       1.91      cube 	NETBSD32TOP_UAP(attrname, const char);
   2357       1.91      cube 	NETBSD32TOP_UAP(data, const void);
   2358       1.91      cube 	NETBSD32TOX_UAP(nbytes, size_t);
   2359       1.91      cube 	return sys_extattr_set_file(l, &ua, retval);
   2360       1.91      cube }
   2361       1.91      cube 
   2362       1.91      cube int
   2363       1.91      cube netbsd32_extattr_set_link(struct lwp *l, void *v, register_t *retval)
   2364       1.91      cube {
   2365       1.91      cube 	struct netbsd32_extattr_set_link_args /* {
   2366       1.91      cube 		syscallarg(const netbsd32_charp) path;
   2367       1.91      cube 		syscallarg(int) attrnamespace;
   2368       1.91      cube 		syscallarg(const netbsd32_charp) attrname;
   2369       1.91      cube 		syscallarg(const netbsd32_voidp) data;
   2370       1.91      cube 		syscallarg(netbsd32_size_t) nbytes;
   2371       1.91      cube 	} */ *uap = v;
   2372       1.91      cube 	struct sys_extattr_set_link_args ua;
   2373       1.91      cube 
   2374       1.91      cube 	NETBSD32TOP_UAP(path, const char);
   2375       1.91      cube 	NETBSD32TO64_UAP(attrnamespace);
   2376       1.91      cube 	NETBSD32TOP_UAP(attrname, const char);
   2377       1.91      cube 	NETBSD32TOP_UAP(data, const void);
   2378       1.91      cube 	NETBSD32TOX_UAP(nbytes, size_t);
   2379       1.91      cube 	return sys_extattr_set_link(l, &ua, retval);
   2380       1.91      cube }
   2381       1.91      cube 
   2382       1.91      cube int
   2383       1.91      cube netbsd32_extattr_get_fd(struct lwp *l, void *v, register_t *retval)
   2384       1.91      cube {
   2385       1.91      cube 	struct netbsd32_extattr_get_fd_args /* {
   2386       1.91      cube 		syscallarg(int) fd;
   2387       1.91      cube 		syscallarg(int) attrnamespace;
   2388       1.91      cube 		syscallarg(const netbsd32_charp) attrname;
   2389       1.91      cube 		syscallarg(netbsd32_voidp) data;
   2390       1.91      cube 		syscallarg(netbsd32_size_t) nbytes;
   2391       1.91      cube 	} */ *uap = v;
   2392       1.91      cube 	struct sys_extattr_get_fd_args ua;
   2393       1.91      cube 
   2394       1.91      cube 	NETBSD32TO64_UAP(fd);
   2395       1.91      cube 	NETBSD32TO64_UAP(attrnamespace);
   2396       1.91      cube 	NETBSD32TOP_UAP(attrname, const char);
   2397       1.91      cube 	NETBSD32TOP_UAP(data, void);
   2398       1.91      cube 	NETBSD32TOX_UAP(nbytes, size_t);
   2399       1.91      cube 	return sys_extattr_get_fd(l, &ua, retval);
   2400       1.91      cube }
   2401       1.91      cube 
   2402       1.91      cube int
   2403       1.91      cube netbsd32_extattr_get_file(struct lwp *l, void *v, register_t *retval)
   2404       1.91      cube {
   2405       1.91      cube 	struct netbsd32_extattr_get_file_args /* {
   2406       1.91      cube 		syscallarg(const netbsd32_charp) path;
   2407       1.91      cube 		syscallarg(int) attrnamespace;
   2408       1.91      cube 		syscallarg(const netbsd32_charp) attrname;
   2409       1.91      cube 		syscallarg(netbsd32_voidp) data;
   2410       1.91      cube 		syscallarg(netbsd32_size_t) nbytes;
   2411       1.91      cube 	} */ *uap = v;
   2412       1.91      cube 	struct sys_extattr_get_file_args ua;
   2413       1.91      cube 
   2414       1.91      cube 	NETBSD32TOP_UAP(path, const char);
   2415       1.91      cube 	NETBSD32TO64_UAP(attrnamespace);
   2416       1.91      cube 	NETBSD32TOP_UAP(attrname, const char);
   2417       1.91      cube 	NETBSD32TOP_UAP(data, void);
   2418       1.91      cube 	NETBSD32TOX_UAP(nbytes, size_t);
   2419       1.91      cube 	return sys_extattr_get_file(l, &ua, retval);
   2420       1.91      cube }
   2421       1.91      cube 
   2422       1.91      cube int
   2423       1.91      cube netbsd32_extattr_get_link(struct lwp *l, void *v, register_t *retval)
   2424       1.91      cube {
   2425       1.91      cube 	struct netbsd32_extattr_get_link_args /* {
   2426       1.91      cube 		syscallarg(const netbsd32_charp) path;
   2427       1.91      cube 		syscallarg(int) attrnamespace;
   2428       1.91      cube 		syscallarg(const netbsd32_charp) attrname;
   2429       1.91      cube 		syscallarg(netbsd32_voidp) data;
   2430       1.91      cube 		syscallarg(netbsd32_size_t) nbytes;
   2431       1.91      cube 	} */ *uap = v;
   2432       1.91      cube 	struct sys_extattr_get_link_args ua;
   2433       1.91      cube 
   2434       1.91      cube 	NETBSD32TOP_UAP(path, const char);
   2435       1.91      cube 	NETBSD32TO64_UAP(attrnamespace);
   2436       1.91      cube 	NETBSD32TOP_UAP(attrname, const char);
   2437       1.91      cube 	NETBSD32TOP_UAP(data, void);
   2438       1.91      cube 	NETBSD32TOX_UAP(nbytes, size_t);
   2439       1.91      cube 	return sys_extattr_get_link(l, &ua, retval);
   2440       1.91      cube }
   2441       1.91      cube 
   2442       1.91      cube int
   2443       1.91      cube netbsd32_extattr_delete_fd(struct lwp *l, void *v, register_t *retval)
   2444       1.91      cube {
   2445       1.91      cube 	struct netbsd32_extattr_delete_fd_args /* {
   2446       1.91      cube 		syscallarg(int) fd;
   2447       1.91      cube 		syscallarg(int) attrnamespace;
   2448       1.91      cube 		syscallarg(const netbsd32_charp) attrname;
   2449       1.91      cube 	} */ *uap = v;
   2450       1.91      cube 	struct sys_extattr_delete_fd_args ua;
   2451       1.91      cube 
   2452       1.91      cube 	NETBSD32TO64_UAP(fd);
   2453       1.91      cube 	NETBSD32TO64_UAP(attrnamespace);
   2454       1.91      cube 	NETBSD32TOP_UAP(attrname, const char);
   2455       1.91      cube 	return sys_extattr_delete_fd(l, &ua, retval);
   2456       1.91      cube }
   2457       1.91      cube 
   2458       1.91      cube int
   2459       1.91      cube netbsd32_extattr_delete_file(struct lwp *l, void *v, register_t *retval)
   2460       1.91      cube {
   2461       1.91      cube 	struct netbsd32_extattr_delete_file_args /* {
   2462       1.91      cube 		syscallarg(const netbsd32_charp) path;
   2463       1.91      cube 		syscallarg(int) attrnamespace;
   2464       1.91      cube 		syscallarg(const netbsd32_charp) attrname;
   2465       1.91      cube 	} */ *uap = v;
   2466       1.91      cube 	struct sys_extattr_delete_file_args ua;
   2467       1.91      cube 
   2468       1.91      cube 	NETBSD32TOP_UAP(path, const char);
   2469       1.91      cube 	NETBSD32TO64_UAP(attrnamespace);
   2470       1.91      cube 	NETBSD32TOP_UAP(attrname, const char);
   2471       1.91      cube 	return sys_extattr_delete_file(l, &ua, retval);
   2472       1.91      cube }
   2473       1.91      cube 
   2474       1.91      cube int
   2475       1.91      cube netbsd32_extattr_delete_link(struct lwp *l, void *v, register_t *retval)
   2476       1.91      cube {
   2477       1.91      cube 	struct netbsd32_extattr_delete_link_args /* {
   2478       1.91      cube 		syscallarg(const netbsd32_charp) path;
   2479       1.91      cube 		syscallarg(int) attrnamespace;
   2480       1.91      cube 		syscallarg(const netbsd32_charp) attrname;
   2481       1.91      cube 	} */ *uap = v;
   2482       1.91      cube 	struct sys_extattr_delete_link_args ua;
   2483       1.91      cube 
   2484       1.91      cube 	NETBSD32TOP_UAP(path, const char);
   2485       1.91      cube 	NETBSD32TO64_UAP(attrnamespace);
   2486       1.91      cube 	NETBSD32TOP_UAP(attrname, const char);
   2487       1.91      cube 	return sys_extattr_delete_link(l, &ua, retval);
   2488       1.91      cube }
   2489       1.91      cube 
   2490       1.91      cube int
   2491       1.91      cube netbsd32_extattr_list_fd(struct lwp *l, void *v, register_t *retval)
   2492       1.91      cube {
   2493       1.91      cube 	struct netbsd32_extattr_list_fd_args /* {
   2494       1.91      cube 		syscallarg(int) fd;
   2495       1.91      cube 		syscallarg(int) attrnamespace;
   2496       1.91      cube 		syscallarg(netbsd32_voidp) data;
   2497       1.91      cube 		syscallarg(netbsd32_size_t) nbytes;
   2498       1.91      cube 	} */ *uap = v;
   2499       1.91      cube 	struct sys_extattr_list_fd_args ua;
   2500       1.91      cube 
   2501       1.91      cube 	NETBSD32TO64_UAP(fd);
   2502       1.91      cube 	NETBSD32TO64_UAP(attrnamespace);
   2503       1.91      cube 	NETBSD32TOP_UAP(data, void);
   2504       1.91      cube 	NETBSD32TOX_UAP(nbytes, size_t);
   2505       1.91      cube 	return sys_extattr_list_fd(l, &ua, retval);
   2506       1.91      cube }
   2507       1.91      cube 
   2508       1.91      cube int
   2509       1.91      cube netbsd32_extattr_list_file(struct lwp *l, void *v, register_t *retval)
   2510       1.91      cube {
   2511       1.91      cube 	struct netbsd32_extattr_list_file_args /* {
   2512       1.91      cube 		syscallarg(const netbsd32_charp) path;
   2513       1.91      cube 		syscallarg(int) attrnamespace;
   2514       1.91      cube 		syscallarg(netbsd32_voidp) data;
   2515       1.91      cube 		syscallarg(netbsd32_size_t) nbytes;
   2516       1.91      cube 	} */ *uap = v;
   2517       1.91      cube 	struct sys_extattr_list_file_args ua;
   2518       1.91      cube 
   2519       1.91      cube 	NETBSD32TOP_UAP(path, const char);
   2520       1.91      cube 	NETBSD32TO64_UAP(attrnamespace);
   2521       1.91      cube 	NETBSD32TOP_UAP(data, void);
   2522       1.91      cube 	NETBSD32TOX_UAP(nbytes, size_t);
   2523       1.91      cube 	return sys_extattr_list_file(l, &ua, retval);
   2524       1.91      cube }
   2525       1.91      cube 
   2526       1.91      cube int
   2527       1.91      cube netbsd32_extattr_list_link(struct lwp *l, void *v, register_t *retval)
   2528       1.91      cube {
   2529       1.91      cube 	struct netbsd32_extattr_list_link_args /* {
   2530       1.91      cube 		syscallarg(const netbsd32_charp) path;
   2531       1.91      cube 		syscallarg(int) attrnamespace;
   2532       1.91      cube 		syscallarg(netbsd32_voidp) data;
   2533       1.91      cube 		syscallarg(netbsd32_size_t) nbytes;
   2534       1.91      cube 	} */ *uap = v;
   2535       1.91      cube 	struct sys_extattr_list_link_args ua;
   2536       1.91      cube 
   2537       1.91      cube 	NETBSD32TOP_UAP(path, const char);
   2538       1.91      cube 	NETBSD32TO64_UAP(attrnamespace);
   2539       1.91      cube 	NETBSD32TOP_UAP(data, void);
   2540       1.91      cube 	NETBSD32TOX_UAP(nbytes, size_t);
   2541       1.91      cube 	return sys_extattr_list_link(l, &ua, retval);
   2542       1.91      cube }
   2543       1.92      cube 
   2544       1.92      cube int
   2545       1.92      cube netbsd32_mlockall(l, v, retval)
   2546       1.92      cube 	struct lwp *l;
   2547       1.92      cube 	void *v;
   2548       1.92      cube 	register_t *retval;
   2549       1.92      cube {
   2550       1.92      cube 	struct netbsd32_mlockall_args /* {
   2551       1.92      cube 		syscallarg(int) flags;
   2552       1.92      cube 	} */ *uap = v;
   2553       1.92      cube 	struct sys_mlockall_args ua;
   2554       1.92      cube 
   2555       1.92      cube 	NETBSD32TO64_UAP(flags);
   2556       1.92      cube 	return (sys_mlockall(l, &ua, retval));
   2557       1.92      cube }
   2558       1.93      cube 
   2559       1.93      cube int
   2560       1.93      cube netbsd32___clone(struct lwp *l, void *v, register_t *retval)
   2561       1.93      cube {
   2562       1.93      cube 	struct netbsd32___clone_args /*  {
   2563       1.93      cube 		syscallarg(int) flags;
   2564       1.93      cube 		syscallarg(netbsd32_voidp) stack;
   2565       1.93      cube 	} */ *uap = v;
   2566       1.93      cube 	struct sys___clone_args ua;
   2567       1.93      cube 
   2568       1.93      cube 	NETBSD32TO64_UAP(flags);
   2569       1.93      cube 	NETBSD32TOP_UAP(stack, void);
   2570       1.93      cube 	return sys___clone(l, &ua, retval);
   2571       1.93      cube }
   2572       1.94      cube 
   2573       1.94      cube int
   2574       1.94      cube netbsd32_fsync_range(struct lwp *l, void *v, register_t *retval)
   2575       1.94      cube {
   2576       1.94      cube 	struct netbsd32_fsync_range_args /* {
   2577       1.94      cube 		syscallarg(int) fd;
   2578       1.94      cube 		syscallarg(int) flags;
   2579       1.94      cube 		syscallarg(off_t) start;
   2580       1.94      cube 		syscallarg(off_t) length;
   2581       1.94      cube 	} */ *uap = v;
   2582       1.94      cube 	struct sys_fsync_range_args ua;
   2583       1.94      cube 
   2584       1.94      cube 	NETBSD32TO64_UAP(fd);
   2585       1.94      cube 	NETBSD32TO64_UAP(flags);
   2586       1.94      cube 	NETBSD32TO64_UAP(start);
   2587       1.94      cube 	NETBSD32TO64_UAP(length);
   2588       1.94      cube 	return (sys_fsync_range(l, &ua, retval));
   2589       1.94      cube }
   2590       1.95      cube 
   2591       1.95      cube int
   2592       1.95      cube netbsd32_rasctl(struct lwp *l, void *v, register_t *retval)
   2593       1.95      cube {
   2594       1.95      cube 	struct netbsd32_rasctl_args /* {
   2595       1.95      cube 		syscallarg(netbsd32_caddr_t) addr;
   2596       1.95      cube 		syscallarg(netbsd32_size_t) len;
   2597       1.95      cube 		syscallarg(int) op;
   2598       1.95      cube 	} */ *uap = v;
   2599       1.95      cube 	struct sys_rasctl_args ua;
   2600       1.95      cube 
   2601       1.95      cube 	NETBSD32TOX64_UAP(addr, caddr_t);
   2602       1.95      cube 	NETBSD32TOX_UAP(len, size_t);
   2603       1.95      cube 	NETBSD32TO64_UAP(op);
   2604       1.95      cube 	return sys_rasctl(l, &ua, retval);
   2605       1.95      cube }
   2606       1.96      cube 
   2607       1.96      cube int
   2608       1.96      cube netbsd32_setxattr(struct lwp *l, void *v, register_t *retval)
   2609       1.96      cube {
   2610       1.96      cube 	struct netbsd32_setxattr_args /* {
   2611       1.96      cube 		syscallarg(const netbsd32_charp) path;
   2612       1.96      cube 		syscallarg(const netbsd32_charp) name;
   2613       1.96      cube 		syscallarg(netbsd32_voidp) value;
   2614       1.96      cube 		syscallarg(netbsd32_size_t) size;
   2615       1.96      cube 		syscallarg(int) flags;
   2616       1.96      cube 	} */ *uap = v;
   2617       1.96      cube 	struct sys_setxattr_args ua;
   2618       1.96      cube 	NETBSD32TOP_UAP(path, const char);
   2619       1.96      cube 	NETBSD32TOP_UAP(name, const char);
   2620       1.96      cube 	NETBSD32TOP_UAP(value, void);
   2621       1.96      cube 	NETBSD32TOX_UAP(size, size_t);
   2622       1.96      cube 	NETBSD32TO64_UAP(flags);
   2623       1.96      cube 	return sys_setxattr(l, &ua, retval);
   2624       1.96      cube }
   2625       1.96      cube 
   2626       1.96      cube int
   2627       1.96      cube netbsd32_lsetxattr(struct lwp *l, void *v, register_t *retval)
   2628       1.96      cube {
   2629       1.96      cube 	struct netbsd32_lsetxattr_args /* {
   2630       1.96      cube 		syscallarg(const netbsd32_charp) path;
   2631       1.96      cube 		syscallarg(const netbsd32_charp) name;
   2632       1.96      cube 		syscallarg(netbsd32_voidp) value;
   2633       1.96      cube 		syscallarg(netbsd32_size_t) size;
   2634       1.96      cube 		syscallarg(int) flags;
   2635       1.96      cube 	} */ *uap = v;
   2636       1.96      cube 	struct sys_lsetxattr_args ua;
   2637       1.96      cube 	NETBSD32TOP_UAP(path, const char);
   2638       1.96      cube 	NETBSD32TOP_UAP(name, const char);
   2639       1.96      cube 	NETBSD32TOP_UAP(value, void);
   2640       1.96      cube 	NETBSD32TOX_UAP(size, size_t);
   2641       1.96      cube 	NETBSD32TO64_UAP(flags);
   2642       1.96      cube 	return sys_lsetxattr(l, &ua, retval);
   2643       1.96      cube }
   2644       1.96      cube 
   2645       1.96      cube int
   2646       1.96      cube netbsd32_fsetxattr(struct lwp *l, void *v, register_t *retval)
   2647       1.96      cube {
   2648       1.96      cube 	struct netbsd32_fsetxattr_args /* {
   2649       1.96      cube 		syscallarg(int) fd;
   2650       1.96      cube 		syscallarg(const netbsd32_charp) name;
   2651       1.96      cube 		syscallarg(netbsd32_voidp) value;
   2652       1.96      cube 		syscallarg(netbsd32_size_t) size;
   2653       1.96      cube 		syscallarg(int) flags;
   2654       1.96      cube 	} */ *uap = v;
   2655       1.96      cube 	struct sys_fsetxattr_args ua;
   2656       1.96      cube 	NETBSD32TO64_UAP(fd);
   2657       1.96      cube 	NETBSD32TOP_UAP(name, const char);
   2658       1.96      cube 	NETBSD32TOP_UAP(value, void);
   2659       1.96      cube 	NETBSD32TOX_UAP(size, size_t);
   2660       1.96      cube 	NETBSD32TO64_UAP(flags);
   2661       1.96      cube 	return sys_fsetxattr(l, &ua, retval);
   2662       1.96      cube }
   2663       1.96      cube 
   2664       1.96      cube int
   2665       1.96      cube netbsd32_getxattr(struct lwp *l, void *v, register_t *retval)
   2666       1.96      cube {
   2667       1.96      cube 	struct netbsd32_getxattr_args /* {
   2668       1.96      cube 		syscallarg(const netbsd32_charp) path;
   2669       1.96      cube 		syscallarg(const netbsd32_charp) name;
   2670       1.96      cube 		syscallarg(netbsd32_voidp) value;
   2671       1.96      cube 		syscallarg(netbsd32_size_t) size;
   2672       1.96      cube 	} */ *uap = v;
   2673       1.96      cube 	struct sys_getxattr_args ua;
   2674       1.96      cube 	NETBSD32TOP_UAP(path, const char);
   2675       1.96      cube 	NETBSD32TOP_UAP(name, const char);
   2676       1.96      cube 	NETBSD32TOP_UAP(value, void);
   2677       1.96      cube 	NETBSD32TOX_UAP(size, size_t);
   2678       1.96      cube 	return sys_getxattr(l, &ua, retval);
   2679       1.96      cube }
   2680       1.96      cube 
   2681       1.96      cube int
   2682       1.96      cube netbsd32_lgetxattr(struct lwp *l, void *v, register_t *retval)
   2683       1.96      cube {
   2684       1.96      cube 	struct netbsd32_lgetxattr_args /* {
   2685       1.96      cube 		syscallarg(const netbsd32_charp) path;
   2686       1.96      cube 		syscallarg(const netbsd32_charp) name;
   2687       1.96      cube 		syscallarg(netbsd32_voidp) value;
   2688       1.96      cube 		syscallarg(netbsd32_size_t) size;
   2689       1.96      cube 	} */ *uap = v;
   2690       1.96      cube 	struct sys_lgetxattr_args ua;
   2691       1.96      cube 	NETBSD32TOP_UAP(path, const char);
   2692       1.96      cube 	NETBSD32TOP_UAP(name, const char);
   2693       1.96      cube 	NETBSD32TOP_UAP(value, void);
   2694       1.96      cube 	NETBSD32TOX_UAP(size, size_t);
   2695       1.96      cube 	return sys_lgetxattr(l, &ua, retval);
   2696       1.96      cube }
   2697       1.96      cube 
   2698       1.96      cube int
   2699       1.96      cube netbsd32_fgetxattr(struct lwp *l, void *v, register_t *retval)
   2700       1.96      cube {
   2701       1.96      cube 	struct netbsd32_fgetxattr_args /* {
   2702       1.96      cube 		syscallarg(int) fd;
   2703       1.96      cube 		syscallarg(const netbsd32_charp) name;
   2704       1.96      cube 		syscallarg(netbsd32_voidp) value;
   2705       1.96      cube 		syscallarg(netbsd32_size_t) size;
   2706       1.96      cube 	} */ *uap = v;
   2707       1.96      cube 	struct sys_fgetxattr_args ua;
   2708       1.96      cube 	NETBSD32TO64_UAP(fd);
   2709       1.96      cube 	NETBSD32TOP_UAP(name, const char);
   2710       1.96      cube 	NETBSD32TOP_UAP(value, void);
   2711       1.96      cube 	NETBSD32TOX_UAP(size, size_t);
   2712       1.96      cube 	return sys_fgetxattr(l, &ua, retval);
   2713       1.96      cube }
   2714       1.96      cube 
   2715       1.96      cube int
   2716       1.96      cube netbsd32_listxattr(struct lwp *l, void *v, register_t *retval)
   2717       1.96      cube {
   2718       1.96      cube 	struct netbsd32_listxattr_args /* {
   2719       1.96      cube 		syscallarg(const netbsd32_charp) path;
   2720       1.96      cube 		syscallarg(netbsd32_charp) list;
   2721       1.96      cube 		syscallarg(netbsd32_size_t) size;
   2722       1.96      cube 	} */ *uap = v;
   2723       1.96      cube 	struct sys_listxattr_args ua;
   2724       1.96      cube 	NETBSD32TOP_UAP(path, const char);
   2725       1.96      cube 	NETBSD32TOP_UAP(list, char);
   2726       1.96      cube 	NETBSD32TOX_UAP(size, size_t);
   2727       1.96      cube 	return sys_listxattr(l, &ua, retval);
   2728       1.96      cube }
   2729       1.96      cube 
   2730       1.96      cube int
   2731       1.96      cube netbsd32_llistxattr(struct lwp *l, void *v, register_t *retval)
   2732       1.96      cube {
   2733       1.96      cube 	struct netbsd32_llistxattr_args /* {
   2734       1.96      cube 		syscallarg(const netbsd32_charp) path;
   2735       1.96      cube 		syscallarg(netbsd32_charp) list;
   2736       1.96      cube 		syscallarg(netbsd32_size_t) size;
   2737       1.96      cube 	} */ *uap = v;
   2738       1.96      cube 	struct sys_llistxattr_args ua;
   2739       1.96      cube 	NETBSD32TOP_UAP(path, const char);
   2740       1.96      cube 	NETBSD32TOP_UAP(list, char);
   2741       1.96      cube 	NETBSD32TOX_UAP(size, size_t);
   2742       1.96      cube 	return sys_llistxattr(l, &ua, retval);
   2743       1.96      cube }
   2744       1.96      cube 
   2745       1.96      cube int
   2746       1.96      cube netbsd32_flistxattr(struct lwp *l, void *v, register_t *retval)
   2747       1.96      cube {
   2748       1.96      cube 	struct netbsd32_flistxattr_args /* {
   2749       1.96      cube 		syscallarg(int) fd;
   2750       1.96      cube 		syscallarg(netbsd32_charp) list;
   2751       1.96      cube 		syscallarg(netbsd32_size_t) size;
   2752       1.96      cube 	} */ *uap = v;
   2753       1.96      cube 	struct sys_flistxattr_args ua;
   2754       1.96      cube 	NETBSD32TO64_UAP(fd);
   2755       1.96      cube 	NETBSD32TOP_UAP(list, char);
   2756       1.96      cube 	NETBSD32TOX_UAP(size, size_t);
   2757       1.96      cube 	return sys_flistxattr(l, &ua, retval);
   2758       1.96      cube }
   2759       1.96      cube 
   2760       1.96      cube int
   2761       1.96      cube netbsd32_removexattr(struct lwp *l, void *v, register_t *retval)
   2762       1.96      cube {
   2763       1.96      cube 	struct netbsd32_removexattr_args /* {
   2764       1.96      cube 		syscallarg(const netbsd32_charp) path;
   2765       1.96      cube 		syscallarg(const netbsd32_charp) name;
   2766       1.96      cube 	} */ *uap = v;
   2767       1.96      cube 	struct sys_removexattr_args ua;
   2768       1.96      cube 	NETBSD32TOP_UAP(path, const char);
   2769       1.96      cube 	NETBSD32TOP_UAP(name, const char);
   2770       1.96      cube 	return sys_removexattr(l, &ua, retval);
   2771       1.96      cube }
   2772       1.96      cube 
   2773       1.96      cube int
   2774       1.96      cube netbsd32_lremovexattr(struct lwp *l, void *v, register_t *retval)
   2775       1.96      cube {
   2776       1.96      cube 	struct netbsd32_lremovexattr_args /* {
   2777       1.96      cube 		syscallarg(const netbsd32_charp) path;
   2778       1.96      cube 		syscallarg(const netbsd32_charp) name;
   2779       1.96      cube 	} */ *uap = v;
   2780       1.96      cube 	struct sys_lremovexattr_args ua;
   2781       1.96      cube 	NETBSD32TOP_UAP(path, const char);
   2782       1.96      cube 	NETBSD32TOP_UAP(name, const char);
   2783       1.96      cube 	return sys_lremovexattr(l, &ua, retval);
   2784       1.96      cube }
   2785       1.96      cube 
   2786       1.96      cube int
   2787       1.96      cube netbsd32_fremovexattr(struct lwp *l, void *v, register_t *retval)
   2788       1.96      cube {
   2789       1.96      cube 	struct netbsd32_fremovexattr_args /* {
   2790       1.96      cube 		syscallarg(int) fd;
   2791       1.96      cube 		syscallarg(const netbsd32_charp) name;
   2792       1.96      cube 	} */ *uap = v;
   2793       1.96      cube 	struct sys_fremovexattr_args ua;
   2794       1.96      cube 	NETBSD32TO64_UAP(fd);
   2795       1.96      cube 	NETBSD32TOP_UAP(name, const char);
   2796       1.96      cube 	return sys_fremovexattr(l, &ua, retval);
   2797       1.96      cube }
   2798