netbsd32_machdep_13.c revision 1.4
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.4Sskrll__KERNEL_RCSID(1, "$NetBSD: netbsd32_machdep_13.c,v 1.4 2020/06/20 07:01:16 skrll Exp $");
331.2Spgoyette
341.2Spgoyette#ifdef _KERNEL_OPT
351.2Spgoyette#include "opt_compat_netbsd.h"
361.2Spgoyette#include "opt_compat_netbsd32.h"
371.2Spgoyette#endif
381.2Spgoyette
391.2Spgoyette#include <sys/param.h>
401.2Spgoyette#include <sys/core.h>
411.2Spgoyette#include <sys/exec.h>
421.2Spgoyette#include <sys/lwp.h>
431.2Spgoyette#include <sys/signalvar.h>
441.2Spgoyette#include <sys/syscallvar.h>
451.2Spgoyette#include <sys/syscallargs.h>
461.2Spgoyette
471.2Spgoyette#include <uvm/uvm_extern.h>
481.2Spgoyette
491.2Spgoyette#include <compat/netbsd32/netbsd32.h>
501.2Spgoyette#include <compat/netbsd32/netbsd32_exec.h>
511.2Spgoyette#include <compat/netbsd32/netbsd32_syscall.h>
521.2Spgoyette#include <compat/netbsd32/netbsd32_syscallargs.h>
531.2Spgoyette
541.2Spgoyette#ifdef COMPAT_13
551.2Spgoyetteint
561.2Spgoyettecompat_13_netbsd32_sigreturn(struct lwp *l,
571.2Spgoyette	const struct compat_13_netbsd32_sigreturn_args *uap,
581.2Spgoyette	register_t *retval)
591.2Spgoyette{
601.2Spgoyette	struct compat_13_sys_sigreturn_args ua;
611.2Spgoyette
621.2Spgoyette	NETBSD32TOP_UAP(sigcntxp, struct sigcontext13 *);
631.2Spgoyette
641.2Spgoyette	return compat_13_sys_sigreturn(l, &ua, retval);
651.2Spgoyette}
661.2Spgoyette
671.4Sskrllstatic struct syscall_package compat_arm32_netbsd32_13_syscalls[] = {
681.2Spgoyette	{ NETBSD32_SYS_compat_13_sigreturn13, 0,
691.2Spgoyette	    (sy_call_t *)compat_13_netbsd32_sigreturn },
701.2Spgoyette	{ 0, 0, NULL }
711.4Sskrll};
721.4Sskrll
731.2Spgoyettevoid
741.2Spgoyettenetbsd32_machdep_md_13_init(void)
751.2Spgoyette{
761.4Sskrll
771.2Spgoyette	(void)syscall_establish(&emul_netbsd32,
781.2Spgoyette	    compat_arm32_netbsd32_13_syscalls);
791.2Spgoyette}
801.4Sskrll
811.2Spgoyettevoid
821.2Spgoyettenetbsd32_machdep_md_13_fini(void)
831.2Spgoyette{
841.2Spgoyette
851.2Spgoyette	(void)syscall_disestablish(&emul_netbsd32,
861.2Spgoyette	    compat_arm32_netbsd32_13_syscalls);
871.2Spgoyette}
881.2Spgoyette#endif
89