2 * Copyright 1996-1998 John D. Polstra.
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
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.
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.
25 * from: src/sys/i386/i386/elf_machdep.c,v 1.20 2004/08/11 02:35:05 marcel
28 #define __ELF_WORD_SIZE 64
30 #include <sys/cdefs.h>
31 __FBSDID("$FreeBSD$");
33 #include <sys/param.h>
34 #include <sys/kernel.h>
35 #include <sys/systm.h>
37 #include <sys/imgact.h>
38 #include <sys/linker.h>
39 #include <sys/sysent.h>
40 #include <sys/imgact_elf.h>
42 #include <sys/syscall.h>
43 #include <sys/signalvar.h>
44 #include <sys/vnode.h>
48 #include <vm/vm_param.h>
50 #include <machine/elf.h>
51 #include <machine/md_var.h>
53 struct sysentvec elf64_freebsd_sysvec = {
54 .sv_size = SYS_MAXSYSCALL,
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,
81 .sv_flags = SV_ABI_FREEBSD | SV_LP64,
82 .sv_set_syscall_retval = cpu_set_syscall_retval,
83 .sv_fetch_syscall_args = NULL, /* XXXKIB */
84 .sv_syscallnames = NULL,
87 static Elf64_Brandinfo freebsd_brand_gnutools_info64 = {
88 .brand = ELFOSABI_NONE,
90 .compat_3_brand = "Unix System V ABI",
92 .interp_path = "/libexec/ld-elf.so.1",
93 .sysvec = &elf64_freebsd_sysvec,
94 .interp_path = "/libexec/ld-elf.so.1",
95 .brand_note = &elf64_freebsd_brandnote,
96 .flags = BI_CAN_EXEC_DYN | BI_BRAND_NOTE
99 SYSINIT(gnu_mips_elf64, SI_SUB_EXEC, SI_ORDER_ANY,
100 (sysinit_cfunc_t) elf64_insert_brand_entry,
101 &freebsd_brand_gnutools_info64);
103 static Elf64_Brandinfo freebsd_brand_info64 = {
104 .brand = ELFOSABI_FREEBSD,
106 .compat_3_brand = "FreeBSD",
108 .interp_path = "/libexec/ld-elf.so.1",
109 .sysvec = &elf64_freebsd_sysvec,
110 .interp_newpath = NULL,
111 .brand_note = &elf64_freebsd_brandnote,
112 .flags = BI_BRAND_NOTE
115 SYSINIT(elf64, SI_SUB_EXEC, SI_ORDER_FIRST,
116 (sysinit_cfunc_t) elf64_insert_brand_entry,
117 &freebsd_brand_info64);
120 elf64_dump_thread(struct thread *td __unused, void *dst __unused,
121 size_t *off __unused)