xref: /netbsd-src/sys/compat/sunos32/sunos32_exec.c (revision 3cd7406ad812bfb15bb053c7704c765ee8780abd)
1*3cd7406aSpgoyette /*	$NetBSD: sunos32_exec.c,v 1.36 2018/08/10 21:44:59 pgoyette Exp $	 */
23fbaadb8Smrg 
33fbaadb8Smrg /*
43fbaadb8Smrg  * Copyright (c) 2001 Matthew R. Green
53fbaadb8Smrg  * All rights reserved.
63fbaadb8Smrg  *
73fbaadb8Smrg  * Redistribution and use in source and binary forms, with or without
83fbaadb8Smrg  * modification, are permitted provided that the following conditions
93fbaadb8Smrg  * are met:
103fbaadb8Smrg  * 1. Redistributions of source code must retain the above copyright
113fbaadb8Smrg  *    notice, this list of conditions and the following disclaimer.
123fbaadb8Smrg  * 2. Redistributions in binary form must reproduce the above copyright
133fbaadb8Smrg  *    notice, this list of conditions and the following disclaimer in the
143fbaadb8Smrg  *    documentation and/or other materials provided with the distribution.
153fbaadb8Smrg  *
163fbaadb8Smrg  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
173fbaadb8Smrg  * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
183fbaadb8Smrg  * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
193fbaadb8Smrg  * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
203fbaadb8Smrg  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
213fbaadb8Smrg  * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
223fbaadb8Smrg  * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
233fbaadb8Smrg  * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
243fbaadb8Smrg  * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
253fbaadb8Smrg  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
263fbaadb8Smrg  * SUCH DAMAGE.
273fbaadb8Smrg  */
283fbaadb8Smrg 
29dab6ef8bSlukem #include <sys/cdefs.h>
30*3cd7406aSpgoyette __KERNEL_RCSID(0, "$NetBSD: sunos32_exec.c,v 1.36 2018/08/10 21:44:59 pgoyette Exp $");
31dab6ef8bSlukem 
326a89288aSmrg #if defined(_KERNEL_OPT)
333fbaadb8Smrg #include "opt_syscall_debug.h"
343fbaadb8Smrg #endif
353fbaadb8Smrg 
363fbaadb8Smrg #include <sys/param.h>
373fbaadb8Smrg #include <sys/proc.h>
383fbaadb8Smrg #include <sys/mount.h>
3933fa5ccbSchs #include <sys/exec.h>
403fbaadb8Smrg 
41c487efe4Sfvdl #include <uvm/uvm_extern.h>
42c487efe4Sfvdl 
43a065e516Sdsl #include <compat/netbsd32/netbsd32.h>
44a065e516Sdsl #include <compat/netbsd32/netbsd32_syscallargs.h>
453fbaadb8Smrg #include <compat/sunos32/sunos32.h>
463fbaadb8Smrg #include <compat/sunos32/sunos32_syscall.h>
47bfaf142fSthorpej #include <compat/sunos32/sunos32_exec.h>
483fbaadb8Smrg 
4925e2fae9Schristos #include <machine/sunos_machdep.h>
5025e2fae9Schristos 
513fbaadb8Smrg extern int nsunos32_sysent;
523fbaadb8Smrg extern struct sysent sunos32_sysent[];
53*3cd7406aSpgoyette extern const uint32_t sunos32_sysent_nomodbits[];
543fbaadb8Smrg #ifdef SYSCALL_DEBUG
553fbaadb8Smrg extern const char * const sunos32_syscallnames[];
563fbaadb8Smrg #endif
573fbaadb8Smrg extern char sunos_sigcode[], sunos_esigcode[];
583fbaadb8Smrg 
59ecc4f712Schristos #ifndef __HAVE_SYSCALL_INTERN
60ecc4f712Schristos void	syscall(void);
61ecc4f712Schristos #endif
62ecc4f712Schristos 
63939df36eSchs struct uvm_object *emul_sunos32_object;
64939df36eSchs 
6592ce8c6aSad struct emul emul_sunos = {
6633fa5ccbSchs 	.e_name =		"sunos32",
6733fa5ccbSchs 	.e_path =		"/emul/sunos32",
68f5024696Sjdolecek #ifndef __HAVE_MINIMAL_EMUL
6933fa5ccbSchs 	.e_flags =		0,
7033fa5ccbSchs 	.e_errno =		NULL,
7133fa5ccbSchs 	.e_nosys =		SUNOS32_SYS_syscall,
7233fa5ccbSchs 	.e_nsysent =		SUNOS32_SYS_NSYSENT,
73f5024696Sjdolecek #endif
7433fa5ccbSchs 	.e_sysent =		sunos32_sysent,
75*3cd7406aSpgoyette 	.e_nomodbits =		sunos32_sysent_nomodbits,
763fbaadb8Smrg #ifdef SYSCALL_DEBUG
7733fa5ccbSchs 	.e_syscallnames =	sunos32_syscallnames,
783fbaadb8Smrg #else
7933fa5ccbSchs 	.e_syscallnames =	NULL,
803fbaadb8Smrg #endif
8133fa5ccbSchs 	.e_sendsig =		sunos32_sendsig,
8233fa5ccbSchs 	.e_trapsignal =		trapsignal,
8333fa5ccbSchs 	.e_sigcode =		sunos_sigcode,
8433fa5ccbSchs 	.e_esigcode =		sunos_esigcode,
8533fa5ccbSchs 	.e_sigobject =		&emul_sunos32_object,
8633fa5ccbSchs 	.e_setregs =		setregs,
8733fa5ccbSchs 	.e_proc_exec =		NULL,
8833fa5ccbSchs 	.e_proc_fork =		NULL,
8933fa5ccbSchs 	.e_proc_exit =		NULL,
9033fa5ccbSchs 	.e_lwp_fork =		NULL,
9133fa5ccbSchs 	.e_lwp_exit =		NULL,
926667cfbdSchristos #ifdef __HAVE_SYSCALL_INTERN
9333fa5ccbSchs 	.e_syscall_intern =	sunos_syscall_intern,
946667cfbdSchristos #else
9533fa5ccbSchs 	.e_syscall_intern =	syscall,
966667cfbdSchristos #endif
9733fa5ccbSchs 	.e_sysctlovly =		NULL,
9833fa5ccbSchs 	.e_vm_default_addr =	uvm_default_mapaddr,
9933fa5ccbSchs 	.e_usertrap =		NULL,
10033fa5ccbSchs 	.e_ucsize =		0,
10133fa5ccbSchs 	.e_startlwp =		NULL
1023fbaadb8Smrg };
103