11.36Spgoyette/*	$NetBSD: sunos32_exec.c,v 1.36 2018/08/10 21:44:59 pgoyette Exp $	 */
21.1Smrg
31.1Smrg/*
41.1Smrg * Copyright (c) 2001 Matthew R. Green
51.1Smrg * All rights reserved.
61.1Smrg *
71.1Smrg * Redistribution and use in source and binary forms, with or without
81.1Smrg * modification, are permitted provided that the following conditions
91.1Smrg * are met:
101.1Smrg * 1. Redistributions of source code must retain the above copyright
111.1Smrg *    notice, this list of conditions and the following disclaimer.
121.1Smrg * 2. Redistributions in binary form must reproduce the above copyright
131.1Smrg *    notice, this list of conditions and the following disclaimer in the
141.1Smrg *    documentation and/or other materials provided with the distribution.
151.1Smrg *
161.1Smrg * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
171.1Smrg * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
181.1Smrg * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
191.1Smrg * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
201.1Smrg * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
211.1Smrg * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
221.1Smrg * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
231.1Smrg * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
241.1Smrg * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
251.1Smrg * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
261.1Smrg * SUCH DAMAGE.
271.1Smrg */
281.10Slukem
291.10Slukem#include <sys/cdefs.h>
301.36Spgoyette__KERNEL_RCSID(0, "$NetBSD: sunos32_exec.c,v 1.36 2018/08/10 21:44:59 pgoyette Exp $");
311.1Smrg
321.5Smrg#if defined(_KERNEL_OPT)
331.1Smrg#include "opt_syscall_debug.h"
341.1Smrg#endif
351.1Smrg
361.1Smrg#include <sys/param.h>
371.1Smrg#include <sys/proc.h>
381.1Smrg#include <sys/mount.h>
391.32Schs#include <sys/exec.h>
401.1Smrg
411.20Sfvdl#include <uvm/uvm_extern.h>
421.20Sfvdl
431.28Sdsl#include <compat/netbsd32/netbsd32.h>
441.28Sdsl#include <compat/netbsd32/netbsd32_syscallargs.h>
451.1Smrg#include <compat/sunos32/sunos32.h>
461.1Smrg#include <compat/sunos32/sunos32_syscall.h>
471.9Sthorpej#include <compat/sunos32/sunos32_exec.h>
481.1Smrg
491.23Schristos#include <machine/sunos_machdep.h>
501.23Schristos
511.1Smrgextern int nsunos32_sysent;
521.1Smrgextern struct sysent sunos32_sysent[];
531.36Spgoyetteextern const uint32_t sunos32_sysent_nomodbits[];
541.1Smrg#ifdef SYSCALL_DEBUG
551.1Smrgextern const char * const sunos32_syscallnames[];
561.1Smrg#endif
571.1Smrgextern char sunos_sigcode[], sunos_esigcode[];
581.1Smrg
591.22Schristos#ifndef __HAVE_SYSCALL_INTERN
601.22Schristosvoid	syscall(void);
611.22Schristos#endif
621.22Schristos
631.15Schsstruct uvm_object *emul_sunos32_object;
641.15Schs
651.31Sadstruct emul emul_sunos = {
661.32Schs	.e_name =		"sunos32",
671.32Schs	.e_path =		"/emul/sunos32",
681.14Sjdolecek#ifndef __HAVE_MINIMAL_EMUL
691.32Schs	.e_flags =		0,
701.32Schs	.e_errno =		NULL,
711.32Schs	.e_nosys =		SUNOS32_SYS_syscall,
721.32Schs	.e_nsysent =		SUNOS32_SYS_NSYSENT,
731.14Sjdolecek#endif
741.32Schs	.e_sysent =		sunos32_sysent,
751.36Spgoyette	.e_nomodbits =		sunos32_sysent_nomodbits,
761.1Smrg#ifdef SYSCALL_DEBUG
771.32Schs	.e_syscallnames =	sunos32_syscallnames,
781.1Smrg#else
791.32Schs	.e_syscallnames =	NULL,
801.1Smrg#endif
811.32Schs	.e_sendsig =		sunos32_sendsig,
821.32Schs	.e_trapsignal =		trapsignal,
831.32Schs	.e_sigcode =		sunos_sigcode,
841.32Schs	.e_esigcode =		sunos_esigcode,
851.32Schs	.e_sigobject =		&emul_sunos32_object,
861.32Schs	.e_setregs =		setregs,
871.32Schs	.e_proc_exec =		NULL,
881.32Schs	.e_proc_fork =		NULL,
891.32Schs	.e_proc_exit =		NULL,
901.32Schs	.e_lwp_fork =		NULL,
911.32Schs	.e_lwp_exit =		NULL,
921.21Schristos#ifdef __HAVE_SYSCALL_INTERN
931.32Schs	.e_syscall_intern =	sunos_syscall_intern,
941.21Schristos#else
951.32Schs	.e_syscall_intern =	syscall,
961.21Schristos#endif
971.32Schs	.e_sysctlovly =		NULL,
981.32Schs	.e_vm_default_addr =	uvm_default_mapaddr,
991.32Schs	.e_usertrap =		NULL,
1001.32Schs	.e_ucsize =		0,
1011.32Schs	.e_startlwp =		NULL
1021.1Smrg};
103