]> CyberLeo.Net >> Repos - FreeBSD/releng/8.1.git/blob - sys/mips/mips/elf64_machdep.c
Copy stable/8 to releng/8.1 in preparation for 8.1-RC1.
[FreeBSD/releng/8.1.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/syscall.h>
42 #include <sys/signalvar.h>
43 #include <sys/vnode.h>
44
45 #include <vm/vm.h>
46 #include <vm/pmap.h>
47 #include <vm/vm_param.h>
48
49 #include <machine/elf.h>
50 #include <machine/md_var.h>
51
52 struct sysentvec elf64_freebsd_sysvec = {
53         .sv_size        = SYS_MAXSYSCALL,
54         .sv_table       = sysent,
55         .sv_mask        = 0,
56         .sv_sigsize     = 0,
57         .sv_sigtbl      = NULL,
58         .sv_errsize     = 0,
59         .sv_errtbl      = NULL,
60         .sv_transtrap   = NULL,
61         .sv_fixup       = __elfN(freebsd_fixup),
62         .sv_sendsig     = sendsig,
63         .sv_sigcode     = sigcode,
64         .sv_szsigcode   = &szsigcode,
65         .sv_prepsyscall = NULL,
66         .sv_name        = "FreeBSD ELF64",
67         .sv_coredump    = __elfN(coredump),
68         .sv_imgact_try  = NULL,
69         .sv_minsigstksz = MINSIGSTKSZ,
70         .sv_pagesize    = PAGE_SIZE,
71         .sv_minuser     = VM_MIN_ADDRESS,
72         .sv_maxuser     = VM_MAXUSER_ADDRESS,
73         .sv_usrstack    = USRSTACK,
74         .sv_psstrings   = PS_STRINGS,
75         .sv_stackprot   = VM_PROT_ALL,
76         .sv_copyout_strings = exec_copyout_strings,
77         .sv_setregs     = exec_setregs,
78         .sv_fixlimit    = NULL,
79         .sv_maxssiz     = NULL,
80         .sv_flags       = SV_ABI_FREEBSD | SV_LP64
81 };
82
83 static Elf64_Brandinfo freebsd_brand_gnutools_info64 = {
84         .brand          = ELFOSABI_NONE,
85         .machine        = EM_MIPS,
86         .compat_3_brand = "Unix System V ABI",
87         .emul_path      = NULL,
88         .interp_path    = "/libexec/ld-elf.so.1",
89         .sysvec         = &elf64_freebsd_sysvec,
90         .interp_path    = "/libexec/ld-elf.so.1",
91         .brand_note     = &elf64_freebsd_brandnote,
92         .flags          = BI_CAN_EXEC_DYN | BI_BRAND_NOTE
93 };
94
95 SYSINIT(gnu_mips_elf64, SI_SUB_EXEC, SI_ORDER_ANY,
96     (sysinit_cfunc_t) elf64_insert_brand_entry,
97     &freebsd_brand_gnutools_info64);
98
99 static Elf64_Brandinfo freebsd_brand_info64 = {
100         .brand          = ELFOSABI_FREEBSD,
101         .machine        = EM_MIPS,
102         .compat_3_brand = "FreeBSD",
103         .emul_path      = NULL,
104         .interp_path    = "/libexec/ld-elf.so.1",
105         .sysvec         = &elf64_freebsd_sysvec,
106         .interp_newpath = NULL,
107         .brand_note     = &elf64_freebsd_brandnote,
108         .flags          = BI_BRAND_NOTE
109 };
110
111 SYSINIT(elf64, SI_SUB_EXEC, SI_ORDER_FIRST,
112     (sysinit_cfunc_t) elf64_insert_brand_entry,
113     &freebsd_brand_info64);
114
115 void
116 elf64_dump_thread(struct thread *td __unused, void *dst __unused,
117     size_t *off __unused)
118 {
119 }