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