1 | /* $NetBSD: linux32_exec.c,v 1.21 2012/02/19 21:06:38 rmind Exp $ */ |
2 | |
3 | /*- |
4 | * Copyright (c) 1994-2007 The NetBSD Foundation, Inc. |
5 | * All rights reserved. |
6 | * |
7 | * This code is derived from software contributed to The NetBSD Foundation |
8 | * by Christos Zoulas, Frank van der Linden, Eric Haszlakiewicz, |
9 | * Thor Lancelot Simon, and Emmanuel Dreyfus. |
10 | * |
11 | * Redistribution and use in source and binary forms, with or without |
12 | * modification, are permitted provided that the following conditions |
13 | * are met: |
14 | * 1. Redistributions of source code must retain the above copyright |
15 | * notice, this list of conditions and the following disclaimer. |
16 | * 2. Redistributions in binary form must reproduce the above copyright |
17 | * notice, this list of conditions and the following disclaimer in the |
18 | * documentation and/or other materials provided with the distribution. |
19 | * |
20 | * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS |
21 | * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED |
22 | * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR |
23 | * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS |
24 | * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR |
25 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF |
26 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS |
27 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN |
28 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) |
29 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE |
30 | * POSSIBILITY OF SUCH DAMAGE. |
31 | */ |
32 | |
33 | #include <sys/cdefs.h> |
34 | __KERNEL_RCSID(0, "$NetBSD: linux32_exec.c,v 1.21 2012/02/19 21:06:38 rmind Exp $" ); |
35 | |
36 | #include <sys/param.h> |
37 | #include <sys/systm.h> |
38 | #include <sys/kernel.h> |
39 | #include <sys/proc.h> |
40 | #include <sys/exec.h> |
41 | #include <sys/exec_elf.h> |
42 | |
43 | #include <sys/mman.h> |
44 | #include <sys/syscallargs.h> |
45 | |
46 | #include <compat/linux/common/linux_types.h> |
47 | #include <compat/linux/common/linux_exec.h> |
48 | |
49 | #include <compat/linux32/common/linux32_exec.h> |
50 | #include <compat/linux32/common/linux32_types.h> |
51 | #include <compat/linux32/common/linux32_signal.h> |
52 | #include <compat/linux32/common/linux32_machdep.h> |
53 | |
54 | #include <compat/linux32/linux32_syscallargs.h> |
55 | #include <compat/linux32/linux32_syscall.h> |
56 | |
57 | extern struct sysent linux32_sysent[]; |
58 | extern const char * const linux32_syscallnames[]; |
59 | extern char linux32_sigcode[], linux32_esigcode[]; |
60 | |
61 | /* |
62 | * Emulation switch. |
63 | */ |
64 | |
65 | struct uvm_object *emul_linux32_object; |
66 | |
67 | struct emul emul_linux32 = { |
68 | .e_name = "linux32" , |
69 | .e_path = "/emul/linux32" , |
70 | #ifndef __HAVE_MINIMAL_EMUL |
71 | .e_flags = 0, |
72 | .e_errno = NULL, |
73 | .e_nosys = LINUX32_SYS_syscall, |
74 | .e_nsysent = LINUX32_SYS_NSYSENT, |
75 | #endif |
76 | .e_sysent = linux32_sysent, |
77 | .e_syscallnames = linux32_syscallnames, |
78 | .e_sendsig = linux32_sendsig, |
79 | .e_trapsignal = linux_trapsignal, |
80 | .e_tracesig = NULL, |
81 | .e_sigcode = linux32_sigcode, |
82 | .e_esigcode = linux32_esigcode, |
83 | .e_sigobject = &emul_linux32_object, |
84 | .e_setregs = linux32_setregs, |
85 | .e_proc_exec = linux_e_proc_exec, |
86 | .e_proc_fork = linux_e_proc_fork, |
87 | .e_proc_exit = linux_e_proc_exit, |
88 | .e_lwp_fork = linux_e_lwp_fork, |
89 | .e_lwp_exit = linux_e_lwp_exit, |
90 | .e_syscall_intern = linux32_syscall_intern, |
91 | .e_sysctlovly = NULL, |
92 | .e_fault = NULL, |
93 | .e_vm_default_addr = netbsd32_vm_default_addr, |
94 | .e_usertrap = NULL, |
95 | .e_ucsize = 0, |
96 | .e_startlwp = NULL |
97 | }; |
98 | |