Changeset View
Changeset View
Standalone View
Standalone View
sys/kern/imgact_elf.c
| Show First 20 Lines • Show All 225 Lines • ▼ Show 20 Lines | |||||
| SYSCTL_BOOL(ELF_NODE_OID, OID_AUTO, allow_wx, | SYSCTL_BOOL(ELF_NODE_OID, OID_AUTO, allow_wx, | ||||
| CTLFLAG_RWTUN, &__elfN(allow_wx), 0, | CTLFLAG_RWTUN, &__elfN(allow_wx), 0, | ||||
| "Allow pages to be mapped simultaneously writable and executable"); | "Allow pages to be mapped simultaneously writable and executable"); | ||||
| static const Elf_Brandinfo *elf_brand_list[MAX_BRANDS]; | static const Elf_Brandinfo *elf_brand_list[MAX_BRANDS]; | ||||
| #define aligned(a, t) (rounddown2((u_long)(a), sizeof(t)) == (u_long)(a)) | #define aligned(a, t) (rounddown2((u_long)(a), sizeof(t)) == (u_long)(a)) | ||||
| Elf_Brandnote __elfN(freebsd_brandnote) = { | const Elf_Brandnote __elfN(freebsd_brandnote) = { | ||||
| .hdr.n_namesz = sizeof(FREEBSD_ABI_VENDOR), | .hdr.n_namesz = sizeof(FREEBSD_ABI_VENDOR), | ||||
| .hdr.n_descsz = sizeof(int32_t), | .hdr.n_descsz = sizeof(int32_t), | ||||
| .hdr.n_type = NT_FREEBSD_ABI_TAG, | .hdr.n_type = NT_FREEBSD_ABI_TAG, | ||||
| .vendor = FREEBSD_ABI_VENDOR, | .vendor = FREEBSD_ABI_VENDOR, | ||||
| .flags = BN_TRANSLATE_OSREL, | .flags = BN_TRANSLATE_OSREL, | ||||
| .trans_osrel = __elfN(freebsd_trans_osrel) | .trans_osrel = __elfN(freebsd_trans_osrel) | ||||
| }; | }; | ||||
| static bool | static bool | ||||
| __elfN(freebsd_trans_osrel)(const Elf_Note *note, int32_t *osrel) | __elfN(freebsd_trans_osrel)(const Elf_Note *note, int32_t *osrel) | ||||
| { | { | ||||
| uintptr_t p; | uintptr_t p; | ||||
| p = (uintptr_t)(note + 1); | p = (uintptr_t)(note + 1); | ||||
| p += roundup2(note->n_namesz, ELF_NOTE_ROUNDSIZE); | p += roundup2(note->n_namesz, ELF_NOTE_ROUNDSIZE); | ||||
| *osrel = *(const int32_t *)(p); | *osrel = *(const int32_t *)(p); | ||||
| return (true); | return (true); | ||||
| } | } | ||||
| static int GNU_KFREEBSD_ABI_DESC = 3; | static int GNU_KFREEBSD_ABI_DESC = 3; | ||||
| Elf_Brandnote __elfN(kfreebsd_brandnote) = { | const Elf_Brandnote __elfN(kfreebsd_brandnote) = { | ||||
| .hdr.n_namesz = sizeof(GNU_ABI_VENDOR), | .hdr.n_namesz = sizeof(GNU_ABI_VENDOR), | ||||
| .hdr.n_descsz = 16, /* XXX at least 16 */ | .hdr.n_descsz = 16, /* XXX at least 16 */ | ||||
| .hdr.n_type = 1, | .hdr.n_type = 1, | ||||
| .vendor = GNU_ABI_VENDOR, | .vendor = GNU_ABI_VENDOR, | ||||
| .flags = BN_TRANSLATE_OSREL, | .flags = BN_TRANSLATE_OSREL, | ||||
| .trans_osrel = kfreebsd_trans_osrel | .trans_osrel = kfreebsd_trans_osrel | ||||
| }; | }; | ||||
| ▲ Show 20 Lines • Show All 2,731 Lines • Show Last 20 Lines | |||||