]> CyberLeo.Net >> Repos - FreeBSD/releng/9.2.git/blob - sys/mips/mips/elf64_machdep.c
- Copy stable/9 to releng/9.2 as part of the 9.2-RELEASE cycle.
[FreeBSD/releng/9.2.git] / sys / mips / mips / elf64_machdep.c
1 /*-
2  * Copyright 1996-1998 John D. Polstra.
3  * All rights reserved.
4  *
5  * Redistribution and use in source and binary forms, with or without
6  * modification, are permitted provided that the following conditions
7  * are met:
8  * 1. Redistributions of source code must retain the above copyright
9  *    notice, this list of conditions and the following disclaimer.
10  * 2. Redistributions in binary form must reproduce the above copyright
11  *    notice, this list of conditions and the following disclaimer in the
12  *    documentation and/or other materials provided with the distribution.
13  *
14  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
15  * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
16  * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
17  * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
18  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
19  * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
20  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
21  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
22  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
23  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
24  *
25  *      from: src/sys/i386/i386/elf_machdep.c,v 1.20 2004/08/11 02:35:05 marcel
26  */
27
28 #define __ELF_WORD_SIZE 64
29
30 #include <sys/cdefs.h>
31 __FBSDID("$FreeBSD$");
32
33 #include <sys/param.h>
34 #include <sys/kernel.h>
35 #include <sys/systm.h>
36 #include <sys/exec.h>
37 #include <sys/imgact.h>
38 #include <sys/linker.h>
39 #include <sys/sysent.h>
40 #include <sys/imgact_elf.h>
41 #include <sys/proc.h>
42 #include <sys/syscall.h>
43 #include <sys/signalvar.h>
44 #include <sys/vnode.h>
45
46 #include <vm/vm.h>
47 #include <vm/pmap.h>
48 #include <vm/vm_param.h>
49
50 #include <machine/elf.h>
51 #include <machine/md_var.h>
52
53 struct sysentvec elf64_freebsd_sysvec = {
54         .sv_size        = SYS_MAXSYSCALL,
55         .sv_table       = sysent,
56         .sv_mask        = 0,
57         .sv_sigsize     = 0,
58         .sv_sigtbl      = NULL,
59         .sv_errsize     = 0,
60         .sv_errtbl      = NULL,
61         .sv_transtrap   = NULL,
62         .sv_fixup       = __elfN(freebsd_fixup),
63         .sv_sendsig     = sendsig,
64         .sv_sigcode     = sigcode,
65         .sv_szsigcode   = &szsigcode,
66         .sv_prepsyscall = NULL,
67         .sv_name        = "FreeBSD ELF64",
68         .sv_coredump    = __elfN(coredump),
69         .sv_imgact_try  = NULL,
70         .sv_minsigstksz = MINSIGSTKSZ,
71         .sv_pagesize    = PAGE_SIZE,
72         .sv_minuser     = VM_MIN_ADDRESS,
73         .sv_maxuser     = VM_MAXUSER_ADDRESS,
74         .sv_usrstack    = USRSTACK,
75         .sv_psstrings   = PS_STRINGS,
76         .sv_stackprot   = VM_PROT_ALL,
77         .sv_copyout_strings = exec_copyout_strings,
78         .sv_setregs     = exec_setregs,
79         .sv_fixlimit    = NULL,
80         .sv_maxssiz     = NULL,
81         .sv_flags       = SV_ABI_FREEBSD | SV_LP64,
82         .sv_set_syscall_retval = cpu_set_syscall_retval,
83         .sv_fetch_syscall_args = cpu_fetch_syscall_args,
84         .sv_syscallnames = syscallnames,
85         .sv_schedtail   = NULL,
86 };
87
88 static Elf64_Brandinfo freebsd_brand_gnutools_info64 = {
89         .brand          = ELFOSABI_NONE,
90         .machine        = EM_MIPS,
91         .compat_3_brand = "Unix System V ABI",
92         .emul_path      = NULL,
93         .interp_path    = "/libexec/ld-elf.so.1",
94         .sysvec         = &elf64_freebsd_sysvec,
95         .interp_path    = "/libexec/ld-elf.so.1",
96         .brand_note     = &elf64_freebsd_brandnote,
97         .flags          = BI_CAN_EXEC_DYN | BI_BRAND_NOTE
98 };
99
100 SYSINIT(gnu_mips_elf64, SI_SUB_EXEC, SI_ORDER_ANY,
101     (sysinit_cfunc_t) elf64_insert_brand_entry,
102     &freebsd_brand_gnutools_info64);
103
104 static Elf64_Brandinfo freebsd_brand_info64 = {
105         .brand          = ELFOSABI_FREEBSD,
106         .machine        = EM_MIPS,
107         .compat_3_brand = "FreeBSD",
108         .emul_path      = NULL,
109         .interp_path    = "/libexec/ld-elf.so.1",
110         .sysvec         = &elf64_freebsd_sysvec,
111         .interp_newpath = NULL,
112         .brand_note     = &elf64_freebsd_brandnote,
113         .flags          = BI_BRAND_NOTE
114 };
115
116 SYSINIT(elf64, SI_SUB_EXEC, SI_ORDER_FIRST,
117     (sysinit_cfunc_t) elf64_insert_brand_entry,
118     &freebsd_brand_info64);
119
120 void
121 elf64_dump_thread(struct thread *td __unused, void *dst __unused,
122     size_t *off __unused)
123 {
124 }