1*d7f6b3d1Sjmcneill /* $NetBSD: syscallemu.h,v 1.1 2012/01/05 13:26:51 jmcneill Exp $ */ 2*d7f6b3d1Sjmcneill 3*d7f6b3d1Sjmcneill /*- 4*d7f6b3d1Sjmcneill * Copyright (c) 2012 Jared D. McNeill <jmcneill@invisible.ca> 5*d7f6b3d1Sjmcneill * All rights reserved. 6*d7f6b3d1Sjmcneill * 7*d7f6b3d1Sjmcneill * Redistribution and use in source and binary forms, with or without 8*d7f6b3d1Sjmcneill * modification, are permitted provided that the following conditions 9*d7f6b3d1Sjmcneill * are met: 10*d7f6b3d1Sjmcneill * 1. Redistributions of source code must retain the above copyright 11*d7f6b3d1Sjmcneill * notice, this list of conditions and the following disclaimer. 12*d7f6b3d1Sjmcneill * 2. Redistributions in binary form must reproduce the above copyright 13*d7f6b3d1Sjmcneill * notice, this list of conditions and the following disclaimer in the 14*d7f6b3d1Sjmcneill * documentation and/or other materials provided with the distribution. 15*d7f6b3d1Sjmcneill * 16*d7f6b3d1Sjmcneill * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS 17*d7f6b3d1Sjmcneill * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED 18*d7f6b3d1Sjmcneill * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 19*d7f6b3d1Sjmcneill * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS 20*d7f6b3d1Sjmcneill * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 21*d7f6b3d1Sjmcneill * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 22*d7f6b3d1Sjmcneill * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 23*d7f6b3d1Sjmcneill * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 24*d7f6b3d1Sjmcneill * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 25*d7f6b3d1Sjmcneill * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 26*d7f6b3d1Sjmcneill * POSSIBILITY OF SUCH DAMAGE. 27*d7f6b3d1Sjmcneill */ 28*d7f6b3d1Sjmcneill 29*d7f6b3d1Sjmcneill #ifndef _HAVE_SYSCALLEMU_H 30*d7f6b3d1Sjmcneill #define _HAVE_SYSCALLEMU_H 31*d7f6b3d1Sjmcneill 32*d7f6b3d1Sjmcneill #include <sys/cdefs.h> 33*d7f6b3d1Sjmcneill #include <sys/syscall.h> 34*d7f6b3d1Sjmcneill #include <sys/syscallargs.h> 35*d7f6b3d1Sjmcneill 36*d7f6b3d1Sjmcneill struct proc; 37*d7f6b3d1Sjmcneill 38*d7f6b3d1Sjmcneill /* 39*d7f6b3d1Sjmcneill * Process specific syscallemu configuration 40*d7f6b3d1Sjmcneill */ 41*d7f6b3d1Sjmcneill struct syscallemu_data { 42*d7f6b3d1Sjmcneill vaddr_t sce_user_start; 43*d7f6b3d1Sjmcneill vaddr_t sce_user_end; 44*d7f6b3d1Sjmcneill void *sce_md_syscall; 45*d7f6b3d1Sjmcneill }; 46*d7f6b3d1Sjmcneill 47*d7f6b3d1Sjmcneill /* 48*d7f6b3d1Sjmcneill * Get process specific syscallemu data 49*d7f6b3d1Sjmcneill */ 50*d7f6b3d1Sjmcneill struct syscallemu_data * syscallemu_getsce(struct proc *); 51*d7f6b3d1Sjmcneill 52*d7f6b3d1Sjmcneill /* 53*d7f6b3d1Sjmcneill * Set process specific syscallemu data 54*d7f6b3d1Sjmcneill */ 55*d7f6b3d1Sjmcneill void syscallemu_setsce(struct proc *, struct syscallemu_data *); 56*d7f6b3d1Sjmcneill 57*d7f6b3d1Sjmcneill /* 58*d7f6b3d1Sjmcneill * MD specific syscallemu syscall setup (in syscallemu_${MACHINE_ARCH}.c) 59*d7f6b3d1Sjmcneill */ 60*d7f6b3d1Sjmcneill void * md_syscallemu(struct proc *); 61*d7f6b3d1Sjmcneill 62*d7f6b3d1Sjmcneill /* syscall: "syscallemu" ret: "int" args: "uintptr_t" "uintptr_t" */ 63*d7f6b3d1Sjmcneill #define SYS_syscallemu 511 64*d7f6b3d1Sjmcneill 65*d7f6b3d1Sjmcneill struct sys_syscallemu_args { 66*d7f6b3d1Sjmcneill syscallarg(uintptr_t) user_start; 67*d7f6b3d1Sjmcneill syscallarg(uintptr_t) user_end; 68*d7f6b3d1Sjmcneill }; 69*d7f6b3d1Sjmcneill check_syscall_args(sys_syscallemu); 70*d7f6b3d1Sjmcneill 71*d7f6b3d1Sjmcneill int sys_syscallemu(struct lwp *, const struct sys_syscallemu_args *, 72*d7f6b3d1Sjmcneill register_t *); 73*d7f6b3d1Sjmcneill 74*d7f6b3d1Sjmcneill __CTASSERT(SYS_syscallemu >= SYS_MAXSYSCALL); 75*d7f6b3d1Sjmcneill __CTASSERT(SYS_syscallemu < SYS_NSYSENT); 76*d7f6b3d1Sjmcneill 77*d7f6b3d1Sjmcneill #endif /* !_HAVE_SYSCALLEMU_H */ 78