Changeset View
Changeset View
Standalone View
Standalone View
sys/arm/arm/elf_machdep.c
Show All 40 Lines | |||||
#include <vm/vm.h> | #include <vm/vm.h> | ||||
#include <vm/pmap.h> | #include <vm/pmap.h> | ||||
#include <vm/vm_param.h> | #include <vm/vm_param.h> | ||||
#include <machine/elf.h> | #include <machine/elf.h> | ||||
#include <machine/md_var.h> | #include <machine/md_var.h> | ||||
static boolean_t elf32_arm_abi_supported(struct image_params *); | |||||
struct sysentvec elf32_freebsd_sysvec = { | struct sysentvec elf32_freebsd_sysvec = { | ||||
.sv_size = SYS_MAXSYSCALL, | .sv_size = SYS_MAXSYSCALL, | ||||
.sv_table = sysent, | .sv_table = sysent, | ||||
.sv_mask = 0, | .sv_mask = 0, | ||||
.sv_sigsize = 0, | .sv_sigsize = 0, | ||||
.sv_sigtbl = NULL, | .sv_sigtbl = NULL, | ||||
.sv_errsize = 0, | .sv_errsize = 0, | ||||
.sv_errtbl = NULL, | .sv_errtbl = NULL, | ||||
Show All 28 Lines | static Elf32_Brandinfo freebsd_brand_info = { | ||||
.brand = ELFOSABI_FREEBSD, | .brand = ELFOSABI_FREEBSD, | ||||
.machine = EM_ARM, | .machine = EM_ARM, | ||||
.compat_3_brand = "FreeBSD", | .compat_3_brand = "FreeBSD", | ||||
.emul_path = NULL, | .emul_path = NULL, | ||||
.interp_path = "/libexec/ld-elf.so.1", | .interp_path = "/libexec/ld-elf.so.1", | ||||
.sysvec = &elf32_freebsd_sysvec, | .sysvec = &elf32_freebsd_sysvec, | ||||
.interp_newpath = NULL, | .interp_newpath = NULL, | ||||
.brand_note = &elf32_freebsd_brandnote, | .brand_note = &elf32_freebsd_brandnote, | ||||
.flags = BI_CAN_EXEC_DYN | BI_BRAND_NOTE | .flags = BI_CAN_EXEC_DYN | BI_BRAND_NOTE, | ||||
.header_supported= elf32_arm_abi_supported, | |||||
}; | }; | ||||
SYSINIT(elf32, SI_SUB_EXEC, SI_ORDER_FIRST, | SYSINIT(elf32, SI_SUB_EXEC, SI_ORDER_FIRST, | ||||
(sysinit_cfunc_t) elf32_insert_brand_entry, | (sysinit_cfunc_t) elf32_insert_brand_entry, | ||||
&freebsd_brand_info); | &freebsd_brand_info); | ||||
static Elf32_Brandinfo freebsd_brand_oinfo = { | static Elf32_Brandinfo freebsd_brand_oinfo = { | ||||
.brand = ELFOSABI_FREEBSD, | .brand = ELFOSABI_FREEBSD, | ||||
.machine = EM_ARM, | .machine = EM_ARM, | ||||
.compat_3_brand = "FreeBSD", | .compat_3_brand = "FreeBSD", | ||||
.emul_path = NULL, | .emul_path = NULL, | ||||
.interp_path = "/usr/libexec/ld-elf.so.1", | .interp_path = "/usr/libexec/ld-elf.so.1", | ||||
.sysvec = &elf32_freebsd_sysvec, | .sysvec = &elf32_freebsd_sysvec, | ||||
.interp_newpath = NULL, | .interp_newpath = NULL, | ||||
.brand_note = &elf32_freebsd_brandnote, | .brand_note = &elf32_freebsd_brandnote, | ||||
.flags = BI_CAN_EXEC_DYN | BI_BRAND_NOTE | .flags = BI_CAN_EXEC_DYN | BI_BRAND_NOTE, | ||||
.header_supported= elf32_arm_abi_supported, | |||||
}; | }; | ||||
SYSINIT(oelf32, SI_SUB_EXEC, SI_ORDER_ANY, | SYSINIT(oelf32, SI_SUB_EXEC, SI_ORDER_ANY, | ||||
(sysinit_cfunc_t) elf32_insert_brand_entry, | (sysinit_cfunc_t) elf32_insert_brand_entry, | ||||
&freebsd_brand_oinfo); | &freebsd_brand_oinfo); | ||||
static boolean_t | |||||
elf32_arm_abi_supported(struct image_params *imgp) | |||||
{ | |||||
const Elf_Ehdr *hdr = (const Elf_Ehdr *)imgp->image_header; | |||||
#ifdef __ARM_EABI__ | |||||
/* | |||||
* When configured for EABI, FreeBSD supports EABI vesions 4 and 5. | |||||
*/ | |||||
if (EF_ARM_EABI_VERSION(hdr->e_flags) < EF_ARM_EABI_FREEBSD_MIN) { | |||||
if (bootverbose) | |||||
uprintf("Attempting to execute non EABI binary (rev %d) image %s", | |||||
EF_ARM_EABI_VERSION(hdr->e_flags), imgp->args->fname); | |||||
return (FALSE); | |||||
} | |||||
#else | |||||
/* | |||||
* When configured for OABI, that's all we do, so reject EABI binaries. | |||||
*/ | |||||
if (EF_ARM_EABI_VERSION(hdr->e_flags) != EF_ARM_EABI_VERSION_UNKNOWN) { | |||||
if (bootverbose) | |||||
uprintf("Attempting to execute EABI binary (rev %d) image %s", | |||||
EF_ARM_EABI_VERSION(hdr->e_flags), imgp->args->fname); | |||||
return (FALSE); | |||||
} | |||||
#endif | |||||
return (TRUE); | |||||
} | |||||
void | void | ||||
elf32_dump_thread(struct thread *td __unused, void *dst __unused, | elf32_dump_thread(struct thread *td __unused, void *dst __unused, | ||||
size_t *off __unused) | size_t *off __unused) | ||||
{ | { | ||||
} | } | ||||
/* | /* | ||||
* It is possible for the compiler to emit relocations for unaligned data. | * It is possible for the compiler to emit relocations for unaligned data. | ||||
* We handle this situation with these inlines. | * We handle this situation with these inlines. | ||||
*/ | */ | ||||
#define RELOC_ALIGNED_P(x) \ | #define RELOC_ALIGNED_P(x) \ | ||||
(((uintptr_t)(x) & (sizeof(void *) - 1)) == 0) | (((uintptr_t)(x) & (sizeof(void *) - 1)) == 0) | ||||
imp: based on private correspondence, I'm going to make these printfs only on bootverbose for the… | |||||
static __inline Elf_Addr | static __inline Elf_Addr | ||||
load_ptr(Elf_Addr *where) | load_ptr(Elf_Addr *where) | ||||
{ | { | ||||
Elf_Addr res; | Elf_Addr res; | ||||
if (RELOC_ALIGNED_P(where)) | if (RELOC_ALIGNED_P(where)) | ||||
return *where; | return *where; | ||||
▲ Show 20 Lines • Show All 136 Lines • Show Last 20 Lines |
based on private correspondence, I'm going to make these printfs only on bootverbose for the commit. They are too vague (no binary name, no UID, prints just on the console not to the terminal, etc).