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