Home | History | Annotate | Line # | Download | only in netbsd32
netbsd32_compat_40.c revision 1.4.4.2
      1  1.4.4.2  christos /*	$NetBSD: netbsd32_compat_40.c,v 1.4.4.2 2019/06/10 22:07:01 christos Exp $	*/
      2  1.4.4.2  christos 
      3  1.4.4.2  christos /*
      4  1.4.4.2  christos  * Copyright (c) 1998, 2001, 2008, 2018 Matthew R. Green
      5  1.4.4.2  christos  * All rights reserved.
      6  1.4.4.2  christos  *
      7  1.4.4.2  christos  * Redistribution and use in source and binary forms, with or without
      8  1.4.4.2  christos  * modification, are permitted provided that the following conditions
      9  1.4.4.2  christos  * are met:
     10  1.4.4.2  christos  * 1. Redistributions of source code must retain the above copyright
     11  1.4.4.2  christos  *    notice, this list of conditions and the following disclaimer.
     12  1.4.4.2  christos  * 2. Redistributions in binary form must reproduce the above copyright
     13  1.4.4.2  christos  *    notice, this list of conditions and the following disclaimer in the
     14  1.4.4.2  christos  *    documentation and/or other materials provided with the distribution.
     15  1.4.4.2  christos  *
     16  1.4.4.2  christos  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
     17  1.4.4.2  christos  * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
     18  1.4.4.2  christos  * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
     19  1.4.4.2  christos  * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
     20  1.4.4.2  christos  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
     21  1.4.4.2  christos  * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
     22  1.4.4.2  christos  * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
     23  1.4.4.2  christos  * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
     24  1.4.4.2  christos  * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
     25  1.4.4.2  christos  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
     26  1.4.4.2  christos  * SUCH DAMAGE.
     27  1.4.4.2  christos  *
     28  1.4.4.2  christos  * from: NetBSD: netbsd32_netbsd.c,v 1.221 2018/12/24 20:44:39 mrg Exp $
     29  1.4.4.2  christos  */
     30  1.4.4.2  christos 
     31  1.4.4.2  christos #include <sys/cdefs.h>
     32  1.4.4.2  christos __KERNEL_RCSID(0, "$NetBSD: netbsd32_compat_40.c,v 1.4.4.2 2019/06/10 22:07:01 christos Exp $");
     33  1.4.4.2  christos 
     34  1.4.4.2  christos #include <sys/param.h>
     35  1.4.4.2  christos #include <sys/systm.h>
     36  1.4.4.2  christos #include <sys/module.h>
     37  1.4.4.2  christos #include <sys/mount.h>
     38  1.4.4.2  christos #include <sys/syscallvar.h>
     39  1.4.4.2  christos #include <sys/syscallargs.h>
     40  1.4.4.2  christos 
     41  1.4.4.2  christos #include <compat/netbsd32/netbsd32.h>
     42  1.4.4.2  christos #include <compat/netbsd32/netbsd32_syscall.h>
     43  1.4.4.2  christos #include <compat/netbsd32/netbsd32_syscallargs.h>
     44  1.4.4.2  christos #include <compat/netbsd32/netbsd32_conv.h>
     45  1.4.4.2  christos 
     46  1.4.4.2  christos int
     47  1.4.4.2  christos compat_40_netbsd32_mount(struct lwp *l,
     48  1.4.4.2  christos 			 const struct compat_40_netbsd32_mount_args *uap,
     49  1.4.4.2  christos 			 register_t *retval)
     50  1.4.4.2  christos {
     51  1.4.4.2  christos 	/* {
     52  1.4.4.2  christos 		syscallarg(const netbsd32_charp) type;
     53  1.4.4.2  christos 		syscallarg(const netbsd32_charp) path;
     54  1.4.4.2  christos 		syscallarg(int) flags;
     55  1.4.4.2  christos 		syscallarg(netbsd32_voidp) data;
     56  1.4.4.2  christos 	} */
     57  1.4.4.2  christos 	struct compat_40_sys_mount_args ua;
     58  1.4.4.2  christos 
     59  1.4.4.2  christos 	NETBSD32TOP_UAP(type, const char);
     60  1.4.4.2  christos 	NETBSD32TOP_UAP(path, const char);
     61  1.4.4.2  christos 	NETBSD32TO64_UAP(flags);
     62  1.4.4.2  christos 	NETBSD32TOP_UAP(data, void);
     63  1.4.4.2  christos 
     64  1.4.4.2  christos 	return compat_40_sys_mount(l, &ua, retval);
     65  1.4.4.2  christos }
     66  1.4.4.2  christos 
     67  1.4.4.2  christos static struct syscall_package compat_netbsd32_40_syscalls[] = {
     68  1.4.4.2  christos 	{ NETBSD32_SYS_compat_40_netbsd32_mount, 0,
     69  1.4.4.2  christos 	    (sy_call_t *)compat_40_netbsd32_mount },
     70  1.4.4.2  christos 	{ 0, 0, NULL }
     71  1.4.4.2  christos };
     72  1.4.4.2  christos 
     73  1.4.4.2  christos MODULE(MODULE_CLASS_EXEC, compat_netbsd32_40, "compat_netbsd32_50,compat_40");
     74  1.4.4.2  christos 
     75  1.4.4.2  christos static int
     76  1.4.4.2  christos compat_netbsd32_40_modcmd(modcmd_t cmd, void *arg)
     77  1.4.4.2  christos {
     78  1.4.4.2  christos 
     79  1.4.4.2  christos 	switch (cmd) {
     80  1.4.4.2  christos 	case MODULE_CMD_INIT:
     81  1.4.4.2  christos 		return syscall_establish(&emul_netbsd32,
     82  1.4.4.2  christos 		    compat_netbsd32_40_syscalls);
     83  1.4.4.2  christos 
     84  1.4.4.2  christos 	case MODULE_CMD_FINI:
     85  1.4.4.2  christos 		return syscall_disestablish(&emul_netbsd32,
     86  1.4.4.2  christos 		    compat_netbsd32_40_syscalls);
     87  1.4.4.2  christos 
     88  1.4.4.2  christos 	default:
     89  1.4.4.2  christos 		return ENOTTY;
     90  1.4.4.2  christos 	}
     91  1.4.4.2  christos }
     92  1.4.4.2  christos 
     93