Home | History | Annotate | Line # | Download | only in arm32
netbsd32_machdep_16.c revision 1.1.2.2
      1  1.1.2.1  pgoyette /*-
      2  1.1.2.1  pgoyette  * Copyright (c) 2012 The NetBSD Foundation, Inc.
      3  1.1.2.1  pgoyette  * All rights reserved.
      4  1.1.2.1  pgoyette  *
      5  1.1.2.1  pgoyette  * This code is derived from software contributed to The NetBSD Foundation
      6  1.1.2.1  pgoyette  * by Matt Thomas of 3am Software Foundry.
      7  1.1.2.1  pgoyette  *
      8  1.1.2.1  pgoyette  * Redistribution and use in source and binary forms, with or without
      9  1.1.2.1  pgoyette  * modification, are permitted provided that the following conditions
     10  1.1.2.1  pgoyette  * are met:
     11  1.1.2.1  pgoyette  * 1. Redistributions of source code must retain the above copyright
     12  1.1.2.1  pgoyette  *    notice, this list of conditions and the following disclaimer.
     13  1.1.2.1  pgoyette  * 2. Redistributions in binary form must reproduce the above copyright
     14  1.1.2.1  pgoyette  *    notice, this list of conditions and the following disclaimer in the
     15  1.1.2.1  pgoyette  *    documentation and/or other materials provided with the distribution.
     16  1.1.2.1  pgoyette  *
     17  1.1.2.1  pgoyette  * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
     18  1.1.2.1  pgoyette  * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
     19  1.1.2.1  pgoyette  * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
     20  1.1.2.1  pgoyette  * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
     21  1.1.2.1  pgoyette  * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
     22  1.1.2.1  pgoyette  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
     23  1.1.2.1  pgoyette  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
     24  1.1.2.1  pgoyette  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
     25  1.1.2.1  pgoyette  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
     26  1.1.2.1  pgoyette  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
     27  1.1.2.1  pgoyette  * POSSIBILITY OF SUCH DAMAGE.
     28  1.1.2.1  pgoyette  */
     29  1.1.2.1  pgoyette 
     30  1.1.2.1  pgoyette #include <sys/cdefs.h>
     31  1.1.2.1  pgoyette 
     32  1.1.2.2  pgoyette __KERNEL_RCSID(1, "$NetBSD: netbsd32_machdep_16.c,v 1.1.2.2 2018/09/27 02:41:20 pgoyette Exp $");
     33  1.1.2.1  pgoyette 
     34  1.1.2.1  pgoyette #ifdef _KERNEL_OPT
     35  1.1.2.1  pgoyette #include "opt_compat_netbsd.h"
     36  1.1.2.1  pgoyette #include "opt_compat_netbsd32.h"
     37  1.1.2.2  pgoyette #include "opt_coredump.h"
     38  1.1.2.1  pgoyette #endif
     39  1.1.2.1  pgoyette 
     40  1.1.2.1  pgoyette #include <sys/param.h>
     41  1.1.2.1  pgoyette #include <sys/core.h>
     42  1.1.2.1  pgoyette #include <sys/exec.h>
     43  1.1.2.1  pgoyette #include <sys/lwp.h>
     44  1.1.2.1  pgoyette #include <sys/signalvar.h>
     45  1.1.2.1  pgoyette #include <sys/syscallargs.h>
     46  1.1.2.1  pgoyette 
     47  1.1.2.1  pgoyette #include <uvm/uvm_extern.h>
     48  1.1.2.1  pgoyette 
     49  1.1.2.1  pgoyette #include <compat/netbsd32/netbsd32.h>
     50  1.1.2.1  pgoyette #include <compat/netbsd32/netbsd32_exec.h>
     51  1.1.2.1  pgoyette #include <compat/netbsd32/netbsd32_syscallargs.h>
     52  1.1.2.1  pgoyette 
     53  1.1.2.1  pgoyette const char machine32[] = MACHINE;
     54  1.1.2.1  pgoyette const char machine_arch32[] = MACHINE_ARCH;
     55  1.1.2.1  pgoyette 
     56  1.1.2.1  pgoyette int
     57  1.1.2.1  pgoyette cpu_coredump32(struct lwp *l, struct coredump_iostate *iocookie,
     58  1.1.2.1  pgoyette     struct core32 *chdr)
     59  1.1.2.1  pgoyette {
     60  1.1.2.1  pgoyette 	return cpu_coredump(l, iocookie, (struct core *)chdr);
     61  1.1.2.1  pgoyette }
     62  1.1.2.1  pgoyette 
     63  1.1.2.1  pgoyette void
     64  1.1.2.1  pgoyette netbsd32_sendsig (const ksiginfo_t *ksi, const sigset_t *ss)
     65  1.1.2.1  pgoyette {
     66  1.1.2.1  pgoyette 	sendsig(ksi, ss);
     67  1.1.2.1  pgoyette }
     68  1.1.2.1  pgoyette 
     69  1.1.2.1  pgoyette void
     70  1.1.2.1  pgoyette startlwp32(void *arg)
     71  1.1.2.1  pgoyette {
     72  1.1.2.1  pgoyette 	startlwp(arg);
     73  1.1.2.1  pgoyette }
     74  1.1.2.1  pgoyette 
     75  1.1.2.1  pgoyette int
     76  1.1.2.1  pgoyette cpu_mcontext32_validate(struct lwp *l, const mcontext32_t *mcp)
     77  1.1.2.1  pgoyette {
     78  1.1.2.1  pgoyette 	return cpu_mcontext_validate(l, mcp);
     79  1.1.2.1  pgoyette }
     80  1.1.2.1  pgoyette void
     81  1.1.2.1  pgoyette cpu_getmcontext32(struct lwp *l, mcontext32_t *mcp, unsigned int *flagsp)
     82  1.1.2.1  pgoyette {
     83  1.1.2.1  pgoyette 	cpu_getmcontext(l, mcp, flagsp);
     84  1.1.2.1  pgoyette }
     85  1.1.2.1  pgoyette 
     86  1.1.2.1  pgoyette int
     87  1.1.2.1  pgoyette cpu_setmcontext32(struct lwp *l, const mcontext32_t *mcp, unsigned int flags)
     88  1.1.2.1  pgoyette {
     89  1.1.2.1  pgoyette 	return cpu_setmcontext(l, mcp, flags);
     90  1.1.2.1  pgoyette }
     91  1.1.2.1  pgoyette 
     92  1.1.2.1  pgoyette int
     93  1.1.2.1  pgoyette netbsd32_sysarch(struct lwp *l, const struct netbsd32_sysarch_args *uap,
     94  1.1.2.1  pgoyette 	register_t *retval)
     95  1.1.2.1  pgoyette {
     96  1.1.2.1  pgoyette 	return sys_sysarch(l, (const struct sys_sysarch_args *)uap, retval);
     97  1.1.2.1  pgoyette }
     98  1.1.2.1  pgoyette 
     99  1.1.2.1  pgoyette vaddr_t
    100  1.1.2.1  pgoyette netbsd32_vm_default_addr(struct proc *p, vaddr_t base, vsize_t sz,
    101  1.1.2.1  pgoyette     int topdown)
    102  1.1.2.1  pgoyette {
    103  1.1.2.1  pgoyette 	if (topdown)
    104  1.1.2.1  pgoyette 		return VM_DEFAULT_ADDRESS_TOPDOWN(base, sz);
    105  1.1.2.1  pgoyette 	else
    106  1.1.2.1  pgoyette 		return VM_DEFAULT_ADDRESS_BOTTOMUP(base, sz);
    107  1.1.2.1  pgoyette }
    108  1.1.2.1  pgoyette 
    109  1.1.2.1  pgoyette 
    110  1.1.2.1  pgoyette #ifdef COMPAT_13
    111  1.1.2.1  pgoyette int
    112  1.1.2.1  pgoyette compat_13_netbsd32_sigreturn(struct lwp *l,
    113  1.1.2.1  pgoyette 	const struct compat_13_netbsd32_sigreturn_args *uap,
    114  1.1.2.1  pgoyette 	register_t *retval)
    115  1.1.2.1  pgoyette {
    116  1.1.2.1  pgoyette 	struct compat_13_sys_sigreturn_args ua;
    117  1.1.2.1  pgoyette 
    118  1.1.2.1  pgoyette 	NETBSD32TOP_UAP(sigcntxp, struct sigcontext13 *);
    119  1.1.2.1  pgoyette 
    120  1.1.2.1  pgoyette 	return compat_13_sys_sigreturn(l, &ua, retval);
    121  1.1.2.1  pgoyette }
    122  1.1.2.1  pgoyette #endif
    123  1.1.2.1  pgoyette 
    124  1.1.2.1  pgoyette #ifdef COMPAT_16
    125  1.1.2.1  pgoyette int
    126  1.1.2.1  pgoyette compat_16_netbsd32___sigreturn14(struct lwp *l,
    127  1.1.2.1  pgoyette 	const struct compat_16_netbsd32___sigreturn14_args *uap,
    128  1.1.2.1  pgoyette 	register_t *retval)
    129  1.1.2.1  pgoyette {
    130  1.1.2.1  pgoyette 	struct compat_16_sys___sigreturn14_args ua;
    131  1.1.2.1  pgoyette 
    132  1.1.2.1  pgoyette 	NETBSD32TOP_UAP(sigcntxp, struct sigcontext *);
    133  1.1.2.1  pgoyette 
    134  1.1.2.1  pgoyette 	return compat_16_sys___sigreturn14(l, &ua, retval);
    135  1.1.2.1  pgoyette }
    136  1.1.2.1  pgoyette #endif
    137