xref: /netbsd-src/sys/arch/arm/arm32/netbsd32_machdep.c (revision 6d322f2f4598f0d8a138f10ea648ec4fabe41f8b)
1 /*-
2  * Copyright (c) 2012 The NetBSD Foundation, Inc.
3  * All rights reserved.
4  *
5  * This code is derived from software contributed to The NetBSD Foundation
6  * by Matt Thomas of 3am Software Foundry.
7  *
8  * Redistribution and use in source and binary forms, with or without
9  * modification, are permitted provided that the following conditions
10  * are met:
11  * 1. Redistributions of source code must retain the above copyright
12  *    notice, this list of conditions and the following disclaimer.
13  * 2. Redistributions in binary form must reproduce the above copyright
14  *    notice, this list of conditions and the following disclaimer in the
15  *    documentation and/or other materials provided with the distribution.
16  *
17  * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
18  * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
19  * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
20  * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
21  * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
22  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
23  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
24  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
25  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
26  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
27  * POSSIBILITY OF SUCH DAMAGE.
28  */
29 
30 #include <sys/cdefs.h>
31 
32 __KERNEL_RCSID(1, "$NetBSD: netbsd32_machdep.c,v 1.2 2014/01/01 18:57:15 dsl Exp $");
33 
34 #include <sys/param.h>
35 #include <sys/core.h>
36 #include <sys/exec.h>
37 #include <sys/lwp.h>
38 #include <sys/signalvar.h>
39 #include <sys/syscallargs.h>
40 
41 #include <uvm/uvm_extern.h>
42 
43 #include <compat/netbsd32/netbsd32.h>
44 #include <compat/netbsd32/netbsd32_exec.h>
45 #include <compat/netbsd32/netbsd32_syscallargs.h>
46 
47 const char machine32[] = MACHINE;
48 const char machine_arch32[] = MACHINE_ARCH;
49 
50 int
51 cpu_coredump32(struct lwp *l, struct coredump_iostate *iocookie,
52     struct core32 *chdr)
53 {
54 	return cpu_coredump(l, iocookie, (struct core *)chdr);
55 }
56 
57 void
58 netbsd32_sendsig (const ksiginfo_t *ksi, const sigset_t *ss)
59 {
60 	sendsig(ksi, ss);
61 }
62 
63 void
64 startlwp32(void *arg)
65 {
66 	startlwp(arg);
67 }
68 
69 int
70 cpu_mcontext32_validate(struct lwp *l, const mcontext32_t *mcp)
71 {
72 	return cpu_mcontext_validate(l, mcp);
73 }
74 void
75 cpu_getmcontext32(struct lwp *l, mcontext32_t *mcp, unsigned int *flagsp)
76 {
77 	cpu_getmcontext(l, mcp, flagsp);
78 }
79 
80 int
81 cpu_setmcontext32(struct lwp *l, const mcontext32_t *mcp, unsigned int flags)
82 {
83 	return cpu_setmcontext(l, mcp, flags);
84 }
85 
86 int
87 netbsd32_sysarch(struct lwp *l, const struct netbsd32_sysarch_args *uap,
88 	register_t *retval)
89 {
90 	return sys_sysarch(l, (const struct sys_sysarch_args *)uap, retval);
91 }
92 
93 vaddr_t
94 netbsd32_vm_default_addr(struct proc *p, vaddr_t base, vsize_t size)
95 {
96 	return VM_DEFAULT_ADDRESS(base, size);
97 }
98