netbsd32_machdep_13.c revision 1.2
11.2Spgoyette/*-
21.2Spgoyette * Copyright (c) 2012 The NetBSD Foundation, Inc.
31.2Spgoyette * All rights reserved.
41.2Spgoyette *
51.2Spgoyette * This code is derived from software contributed to The NetBSD Foundation
61.2Spgoyette * by Matt Thomas of 3am Software Foundry.
71.2Spgoyette *
81.2Spgoyette * Redistribution and use in source and binary forms, with or without
91.2Spgoyette * modification, are permitted provided that the following conditions
101.2Spgoyette * are met:
111.2Spgoyette * 1. Redistributions of source code must retain the above copyright
121.2Spgoyette *    notice, this list of conditions and the following disclaimer.
131.2Spgoyette * 2. Redistributions in binary form must reproduce the above copyright
141.2Spgoyette *    notice, this list of conditions and the following disclaimer in the
151.2Spgoyette *    documentation and/or other materials provided with the distribution.
161.2Spgoyette *
171.2Spgoyette * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
181.2Spgoyette * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
191.2Spgoyette * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
201.2Spgoyette * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
211.2Spgoyette * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
221.2Spgoyette * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
231.2Spgoyette * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
241.2Spgoyette * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
251.2Spgoyette * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
261.2Spgoyette * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
271.2Spgoyette * POSSIBILITY OF SUCH DAMAGE.
281.2Spgoyette */
291.2Spgoyette
301.2Spgoyette#include <sys/cdefs.h>
311.2Spgoyette
321.2Spgoyette__KERNEL_RCSID(1, "$NetBSD: netbsd32_machdep_13.c,v 1.2 2019/01/27 02:08:37 pgoyette Exp $");
331.2Spgoyette
341.2Spgoyette#ifdef _KERNEL_OPT
351.2Spgoyette#include "opt_compat_netbsd.h"
361.2Spgoyette#include "opt_compat_netbsd32.h"
371.2Spgoyette#include "opt_coredump.h"
381.2Spgoyette#endif
391.2Spgoyette
401.2Spgoyette#include <sys/param.h>
411.2Spgoyette#include <sys/core.h>
421.2Spgoyette#include <sys/exec.h>
431.2Spgoyette#include <sys/lwp.h>
441.2Spgoyette#include <sys/signalvar.h>
451.2Spgoyette#include <sys/syscallvar.h>
461.2Spgoyette#include <sys/syscallargs.h>
471.2Spgoyette
481.2Spgoyette#include <uvm/uvm_extern.h>
491.2Spgoyette
501.2Spgoyette#include <compat/netbsd32/netbsd32.h>
511.2Spgoyette#include <compat/netbsd32/netbsd32_exec.h>
521.2Spgoyette#include <compat/netbsd32/netbsd32_syscall.h>
531.2Spgoyette#include <compat/netbsd32/netbsd32_syscallargs.h>
541.2Spgoyette
551.2Spgoyette#ifdef COMPAT_13
561.2Spgoyetteint
571.2Spgoyettecompat_13_netbsd32_sigreturn(struct lwp *l,
581.2Spgoyette	const struct compat_13_netbsd32_sigreturn_args *uap,
591.2Spgoyette	register_t *retval)
601.2Spgoyette{
611.2Spgoyette	struct compat_13_sys_sigreturn_args ua;
621.2Spgoyette
631.2Spgoyette	NETBSD32TOP_UAP(sigcntxp, struct sigcontext13 *);
641.2Spgoyette
651.2Spgoyette	return compat_13_sys_sigreturn(l, &ua, retval);
661.2Spgoyette}
671.2Spgoyette
681.2Spgoyettestatic struct syscall_package compat_arm32_netbsd32_13_syscalls[] = {
691.2Spgoyette	{ NETBSD32_SYS_compat_13_sigreturn13, 0,
701.2Spgoyette	    (sy_call_t *)compat_13_netbsd32_sigreturn },
711.2Spgoyette	{ 0, 0, NULL }
721.2Spgoyette};
731.2Spgoyette
741.2Spgoyettevoid
751.2Spgoyettenetbsd32_machdep_md_13_init(void)
761.2Spgoyette{
771.2Spgoyette
781.2Spgoyette	(void)syscall_establish(&emul_netbsd32,
791.2Spgoyette	    compat_arm32_netbsd32_13_syscalls);
801.2Spgoyette}
811.2Spgoyette
821.2Spgoyettevoid
831.2Spgoyettenetbsd32_machdep_md_13_fini(void)
841.2Spgoyette{
851.2Spgoyette
861.2Spgoyette	(void)syscall_disestablish(&emul_netbsd32,
871.2Spgoyette	    compat_arm32_netbsd32_13_syscalls);
881.2Spgoyette}
891.2Spgoyette#endif
90