/freebsd/sys/arm/arm/ |
H A D | dump_machdep.c | 84 Elf_Phdr phdr; in dumpsys_write_aux_headers() local 87 bzero(&phdr, sizeof(phdr)); in dumpsys_write_aux_headers() 88 phdr.p_type = PT_DUMP_DELTA; in dumpsys_write_aux_headers() 89 phdr.p_flags = PF_R; /* XXX */ in dumpsys_write_aux_headers() 90 phdr.p_offset = 0; in dumpsys_write_aux_headers() 91 phdr.p_vaddr = KERNVIRTADDR; in dumpsys_write_aux_headers() 92 phdr.p_paddr = pmap_kextract(KERNVIRTADDR); in dumpsys_write_aux_headers() 93 phdr.p_filesz = 0; in dumpsys_write_aux_headers() 94 phdr.p_memsz = 0; in dumpsys_write_aux_headers() 95 phdr.p_align = PAGE_SIZE; in dumpsys_write_aux_headers() [all …]
|
/freebsd/libexec/rtld-elf/ |
H A D | map_object.c | 43 Elf_Phdr **phdr); 68 Elf_Phdr *phdr; in map_object() local 104 hdr = get_elf_header(fd, path, sb, &phdr); in map_object() 112 phsize = hdr->e_phnum * sizeof(phdr[0]); in map_object() 113 phlimit = phdr + hdr->e_phnum; in map_object() 126 while (phdr < phlimit) { in map_object() 127 switch (phdr->p_type) { in map_object() 130 phinterp = phdr; in map_object() 134 segs[++nsegs] = phdr; in map_object() 148 phdr_vaddr = phdr->p_vaddr; in map_object() [all …]
|
/freebsd/contrib/llvm-project/compiler-rt/lib/hwasan/ |
H A D | hwasan_globals.cpp | 29 static void CheckCodeModel(ElfW(Addr) base, const ElfW(Phdr) * phdr, in CheckCodeModel() argument 33 if (phdr[i].p_type != PT_LOAD) in CheckCodeModel() 35 ElfW(Addr) lo = base + phdr[i].p_vaddr, hi = lo + phdr[i].p_memsz; in CheckCodeModel() 53 const ElfW(Phdr) * phdr, in HwasanGlobalsFor() 57 if (phdr[i].p_type != PT_NOTE) in HwasanGlobalsFor() 60 const char *note = reinterpret_cast<const char *>(base + phdr[i].p_vaddr); in HwasanGlobalsFor() 61 const char *nend = note + phdr[i].p_memsz; in HwasanGlobalsFor() 78 CheckCodeModel(base, phdr, phnum); in HwasanGlobalsFor()
|
/freebsd/contrib/elftoolchain/size/ |
H A D | size.c | 292 handle_core_note(Elf *elf, GElf_Ehdr *elfhdr, GElf_Phdr *phdr, in handle_core_note() argument 304 if (elf == NULL || elfhdr == NULL || phdr == NULL) in handle_core_note() 308 offset = phdr->p_offset; in handle_core_note() 309 if (offset >= max_size || phdr->p_filesz > max_size - offset) { in handle_core_note() 313 segment_end = phdr->p_offset + phdr->p_filesz; in handle_core_note() 480 handle_phdr(Elf *elf, GElf_Ehdr *elfhdr, GElf_Phdr *phdr, in handle_phdr() argument 487 if (elf == NULL || elfhdr == NULL || phdr == NULL) in handle_phdr() 490 split = (phdr->p_memsz > 0) && (phdr->p_filesz > 0) && in handle_phdr() 491 (phdr->p_memsz > phdr->p_filesz); in handle_phdr() 498 tbl_print_num(phdr->p_filesz, radix, 1); in handle_phdr() [all …]
|
/freebsd/contrib/wpa/src/eap_peer/ |
H A D | ikev2.c | 844 struct ikev2_payload_hdr *phdr; in ikev2_build_sar1() local 852 phdr = wpabuf_put(msg, sizeof(*phdr)); in ikev2_build_sar1() 853 phdr->next_payload = next_payload; in ikev2_build_sar1() 854 phdr->flags = 0; in ikev2_build_sar1() 893 plen = (u8 *) wpabuf_put(msg, 0) - (u8 *) phdr; in ikev2_build_sar1() 894 WPA_PUT_BE16(phdr->payload_length, plen); in ikev2_build_sar1() 903 struct ikev2_payload_hdr *phdr; in ikev2_build_ker() local 916 phdr = wpabuf_put(msg, sizeof(*phdr)); in ikev2_build_ker() 917 phdr->next_payload = next_payload; in ikev2_build_ker() 918 phdr->flags = 0; in ikev2_build_ker() [all …]
|
/freebsd/stand/common/ |
H A D | load_elf.c | 162 static int elf_program_header_convert(const Elf_Ehdr *ehdr, Elf_Phdr *phdr) in elf_program_header_convert() argument 174 CONVERT_SWITCH(ehdr, phdr, PROGRAM_HEADER_FIELDS); in elf_program_header_convert() 209 static int elf_program_header_convert(const Elf_Ehdr *ehdr, Elf_Phdr *phdr) in elf_program_header_convert() argument 536 Elf_Phdr *phdr, *php; local 630 if ((ehdr->e_phoff + ehdr->e_phnum * sizeof(*phdr)) > ef->firstlen) { 635 phdr = (Elf_Phdr *)(ef->firstpage + ehdr->e_phoff); 638 if (elf_program_header_convert(ehdr, phdr)) 642 if (phdr[i].p_type != PT_LOAD) 647 (long)phdr[i].p_filesz, (long)phdr[i].p_offset, 648 (long)(phdr[i].p_vaddr + off), [all …]
|
H A D | part.c | 231 struct gpt_hdr *phdr, hdr; in ptable_gptread() local 254 phdr = gpt_checkhdr((struct gpt_hdr *)buf, 1, table->sectors - 1, in ptable_gptread() 256 if (phdr != NULL) { in ptable_gptread() 259 howmany(phdr->hdr_entries * phdr->hdr_entsz, in ptable_gptread() 261 if (dread(dev, tbl, size, phdr->hdr_lba_table) == 0 && in ptable_gptread() 262 gpt_checktbl(phdr, tbl, size * table->sectorsize, in ptable_gptread() 264 memcpy(&hdr, phdr, sizeof(hdr)); in ptable_gptread() 271 phdr = NULL; in ptable_gptread() 273 phdr = gpt_checkhdr((struct gpt_hdr *)buf, offset, in ptable_gptread() 275 if (phdr != NULL) { in ptable_gptread() [all …]
|
/freebsd/lib/libprocstat/ |
H A D | core.c | 91 GElf_Phdr phdr; in procstat_core_open() local 126 if (gelf_getphdr(e, i, &phdr) != &phdr) { in procstat_core_open() 130 if (phdr.p_type == PT_NOTE) in procstat_core_open() 146 core->pc_phdr = phdr; in procstat_core_open() 303 GElf_Phdr phdr; in core_read_mem() local 310 if (gelf_getphdr(core->pc_elf, i, &phdr) != &phdr) { in core_read_mem() 314 if (phdr.p_type != PT_LOAD) in core_read_mem() 316 if (addr < phdr.p_vaddr || addr > phdr.p_vaddr + phdr.p_memsz) in core_read_mem() 318 offset = phdr.p_offset + (addr - phdr.p_vaddr); in core_read_mem() 319 if ((phdr.p_vaddr + phdr.p_memsz) - addr < len) { in core_read_mem() [all …]
|
/freebsd/sys/kern/ |
H A D | kern_dump.c | 250 Elf_Phdr phdr; in cb_dumphdr() local 255 bzero(&phdr, sizeof(phdr)); in cb_dumphdr() 256 phdr.p_type = PT_LOAD; in cb_dumphdr() 257 phdr.p_flags = PF_R; /* XXX */ in cb_dumphdr() 258 phdr.p_offset = fileofs; in cb_dumphdr() 260 phdr.p_vaddr = (do_minidump? mdp->pa_start : ~0L); in cb_dumphdr() 261 phdr.p_paddr = (do_minidump? ~0L : mdp->pa_start); in cb_dumphdr() 263 phdr.p_vaddr = mdp->pa_start; in cb_dumphdr() 264 phdr.p_paddr = mdp->pa_start; in cb_dumphdr() 266 phdr.p_filesz = size; in cb_dumphdr() [all …]
|
H A D | imgact_elf.c | 726 const Elf_Phdr *phdr, u_long rbase, u_long *base_addrp) in __elfN() 739 if (phdr[i].p_type != PT_LOAD || phdr[i].p_memsz == 0) in __elfN() 743 prot = __elfN(trans_prot)(phdr[i].p_flags); in __elfN() 744 error = __elfN(load_section)(imgp, phdr[i].p_offset, in __elfN() 745 (caddr_t)(uintptr_t)phdr[i].p_vaddr + rbase, in __elfN() 746 phdr[i].p_memsz, phdr[i].p_filesz, prot); in __elfN() 754 base_addr = trunc_page(phdr[i].p_vaddr + rbase); in __elfN() 787 const Elf_Phdr *phdr = NULL; in __elfN() local 855 phdr = (const Elf_Phdr *)(imgp->image_header + hdr->e_phoff); in __elfN() 856 if (!aligned(phdr, Elf_Addr)) { in __elfN() [all …]
|
/freebsd/usr.bin/gcore/ |
H A D | elfcore.c | 74 Elf_Phdr *phdr; /* Program header to fill in */ member 282 Elf_Phdr *phdr = phc->phdr; in cb_put_phdr() local 288 phdr->p_type = PT_LOAD; in cb_put_phdr() 289 phdr->p_offset = phc->offset; in cb_put_phdr() 290 phdr->p_vaddr = entry->start; in cb_put_phdr() 291 phdr->p_paddr = 0; in cb_put_phdr() 292 phdr->p_filesz = phdr->p_memsz = entry->end - entry->start; in cb_put_phdr() 293 phdr->p_align = page_size; in cb_put_phdr() 294 phdr->p_flags = 0; in cb_put_phdr() 296 phdr->p_flags |= PF_R; in cb_put_phdr() [all …]
|
/freebsd/contrib/wpa/src/eap_server/ |
H A D | ikev2.c | 906 struct ikev2_payload_hdr *phdr; in ikev2_build_sai() local 914 phdr = wpabuf_put(msg, sizeof(*phdr)); in ikev2_build_sai() 915 phdr->next_payload = next_payload; in ikev2_build_sai() 916 phdr->flags = 0; in ikev2_build_sai() 956 plen = (u8 *) wpabuf_put(msg, 0) - (u8 *) phdr; in ikev2_build_sai() 957 WPA_PUT_BE16(phdr->payload_length, plen); in ikev2_build_sai() 966 struct ikev2_payload_hdr *phdr; in ikev2_build_kei() local 980 phdr = wpabuf_put(msg, sizeof(*phdr)); in ikev2_build_kei() 981 phdr->next_payload = next_payload; in ikev2_build_kei() 982 phdr->flags = 0; in ikev2_build_kei() [all …]
|
/freebsd/contrib/elftoolchain/libelf/ |
H A D | libelf_phdr.c | 44 void *ehdr, *phdr; in _libelf_getphdr() local 54 if ((phdr = (ec == ELFCLASS32 ? in _libelf_getphdr() 57 return (phdr); in _libelf_getphdr() 93 if ((phdr = calloc(phnum, msz)) == NULL) { in _libelf_getphdr() 99 e->e_u.e_elf.e_phdr.e_phdr32 = phdr; in _libelf_getphdr() 101 e->e_u.e_elf.e_phdr.e_phdr64 = phdr; in _libelf_getphdr() 106 (*xlator)(phdr, phnum * msz, e->e_rawfile + phoff, phnum, in _libelf_getphdr() 109 return (phdr); in _libelf_getphdr()
|
/freebsd/contrib/netbsd-tests/fs/common/ |
H A D | fstest_puffs.c | 103 struct putter_hdr *phdr; in readshovel() local 113 phdr = (void *)buf; in readshovel() 119 n = rump_sys_read(puffsfd, buf, sizeof(*phdr)); in readshovel() 125 assert(phdr->pth_framelen < BUFSIZE); in readshovel() 126 n = rump_sys_read(puffsfd, buf+sizeof(*phdr), in readshovel() 127 phdr->pth_framelen - sizeof(*phdr)); in readshovel() 142 n = phdr->pth_framelen; in readshovel() 158 struct putter_hdr *phdr; in writeshovel() local 170 phdr = (struct putter_hdr *)buf; in writeshovel() 192 toread = phdr->pth_framelen - off; in writeshovel() [all …]
|
/freebsd/contrib/llvm-project/compiler-rt/lib/lsan/ |
H A D | lsan_common_linux.cpp | 83 const ElfW(Phdr) *phdr = &(info->dlpi_phdr[j]); in ProcessGlobalRegionsCallback() 86 if (!(phdr->p_flags & PF_W) || (phdr->p_type != PT_LOAD) || in ProcessGlobalRegionsCallback() 87 (phdr->p_memsz == 0)) in ProcessGlobalRegionsCallback() 89 uptr begin = info->dlpi_addr + phdr->p_vaddr; in ProcessGlobalRegionsCallback() 90 uptr end = begin + phdr->p_memsz; in ProcessGlobalRegionsCallback()
|
/freebsd/contrib/wpa/src/eap_common/ |
H A D | ikev2_common.c | 248 const struct ikev2_payload_hdr *phdr; in ikev2_parse_payloads() local 260 if (left < sizeof(*phdr)) { in ikev2_parse_payloads() 266 phdr = (const struct ikev2_payload_hdr *) pos; in ikev2_parse_payloads() 267 plen = WPA_GET_BE16(phdr->payload_length); in ikev2_parse_payloads() 268 if (plen < sizeof(*phdr) || plen > left) { in ikev2_parse_payloads() 276 phdr->next_payload, phdr->flags, plen); in ikev2_parse_payloads() 278 pdata = (const u8 *) (phdr + 1); in ikev2_parse_payloads() 279 pdatalen = plen - sizeof(*phdr); in ikev2_parse_payloads() 332 if (phdr->flags & IKEV2_PAYLOAD_FLAGS_CRITICAL) { in ikev2_parse_payloads() 351 payloads->encr_next_payload = phdr->next_payload; in ikev2_parse_payloads() [all …]
|
/freebsd/lib/libc/gen/ |
H A D | tls.c | 407 Elf_Phdr *phdr; in _init_tls() local 416 phdr = NULL; in _init_tls() 421 phdr = auxp->a_un.a_ptr; in _init_tls() 433 if (phdr == NULL || phent != sizeof(Elf_Phdr) || phnum == 0) in _init_tls() 437 if (phdr[i].p_type == PT_TLS) { in _init_tls() 438 libc_tls_static_space = roundup2(phdr[i].p_memsz, in _init_tls() 439 phdr[i].p_align); in _init_tls() 440 libc_tls_init_size = phdr[i].p_filesz; in _init_tls() 441 libc_tls_init_align = phdr[i].p_align; in _init_tls() 442 libc_tls_init = (void *)phdr[i].p_vaddr; in _init_tls()
|
/freebsd/lib/libkldelf/ |
H A D | ef.c | 96 ef_print_phdr(GElf_Phdr *phdr) in ef_print_phdr() argument 99 if ((phdr->p_flags & PF_W) == 0) { in ef_print_phdr() 100 printf("text=0x%jx ", (uintmax_t)phdr->p_filesz); in ef_print_phdr() 102 printf("data=0x%jx", (uintmax_t)phdr->p_filesz); in ef_print_phdr() 103 if (phdr->p_filesz < phdr->p_memsz) in ef_print_phdr() 105 (uintmax_t)(phdr->p_memsz - phdr->p_filesz)); in ef_print_phdr() 570 GElf_Phdr *phdr, *phdyn; in ef_open() local 593 phdr = NULL; in ef_open() 600 phdr = ef->ef_ph; in ef_open() 601 for (i = 0; i < nphdr; i++, phdr++) { in ef_open() [all …]
|
/freebsd/contrib/llvm-project/libunwind/src/ |
H A D | AddressSpace.hpp | 394 static bool checkAddrInSegment(const Elf_Phdr *phdr, size_t image_base, in checkAddrInSegment() argument 396 if (phdr->p_type == PT_LOAD) { in checkAddrInSegment() 397 uintptr_t begin = image_base + phdr->p_vaddr; in checkAddrInSegment() 398 uintptr_t end = begin + phdr->p_memsz; in checkAddrInSegment() 401 cbdata->sects->text_segment_length = phdr->p_memsz; in checkAddrInSegment() 408 static bool checkForUnwindInfoSegment(const Elf_Phdr *phdr, size_t image_base, in checkForUnwindInfoSegment() argument 411 if (phdr->p_type == PT_GNU_EH_FRAME) { in checkForUnwindInfoSegment() 413 uintptr_t eh_frame_hdr_start = image_base + phdr->p_vaddr; in checkForUnwindInfoSegment() 415 cbdata->sects->dwarf_index_section_length = phdr->p_memsz; in checkForUnwindInfoSegment() 418 eh_frame_hdr_start + phdr in checkForUnwindInfoSegment() 472 const Elf_Phdr *phdr = &pinfo->dlpi_phdr[i - 1]; findUnwindSectionsByPhdr() local [all...] |
/freebsd/lib/libkvm/ |
H A D | kvm_arm.c | 58 GElf_Phdr *phdr; member 71 p = vm->phdr; in _kvm_pa2off() 89 free(vm->phdr); in _arm_freevtop() 126 if (_kvm_read_core_phdrs(kd, &vm->phnum, &vm->phdr) == -1) in _arm_initvtop() 131 if (vm->phdr[i].p_type == PT_DUMP_DELTA) { in _arm_initvtop() 132 kernbase = vm->phdr[i].p_vaddr; in _arm_initvtop() 133 physaddr = vm->phdr[i].p_paddr; in _arm_initvtop()
|
/freebsd/sys/net/ |
H A D | if_infiniband.c | 229 const struct sockaddr *dst, struct route *ro, uint8_t *phdr, in infiniband_resolve_addr() argument 233 struct infiniband_header *ih = (struct infiniband_header *)phdr; in infiniband_resolve_addr() 245 error = arpresolve(ifp, 0, m, dst, phdr, &lleflags, plle); in infiniband_resolve_addr() 264 error = nd6_resolve(ifp, LLE_SF(af, 0), m, dst, phdr, in infiniband_resolve_addr() 305 uint8_t *phdr; in infiniband_output() local 316 phdr = NULL; in infiniband_output() 321 phdr = ro->ro_prepend; in infiniband_output() 344 phdr = lle->r_linkdata; in infiniband_output() 368 if (phdr == NULL) { in infiniband_output() 370 phdr = linkhdr; in infiniband_output() [all …]
|
/freebsd/sys/arm64/arm64/ |
H A D | elf_machdep.c | 354 const Elf_Phdr *phdr; in arm64_exec_protect() local 364 phdr = (const Elf_Phdr *)(imgp->image_header + hdr->e_phoff); in arm64_exec_protect() 368 if (phdr[i].p_type == PT_NOTE && __elfN(parse_notes)(imgp, in arm64_exec_protect() 369 &gnu_property_note, GNU_ABI_VENDOR, &phdr[i], in arm64_exec_protect() 379 if (phdr[i].p_type != PT_LOAD || phdr[i].p_memsz == 0) in arm64_exec_protect() 382 sva = phdr[i].p_vaddr + imgp->et_dyn_addr; in arm64_exec_protect() 383 eva = sva + phdr[i].p_memsz; in arm64_exec_protect()
|
/freebsd/sys/netinet/ |
H A D | sctp_auth.c | 1362 struct sctp_paramhdr *phdr, tmp_param; in sctp_auth_get_cookie_params() local 1379 phdr = (struct sctp_paramhdr *)sctp_m_getptr(m, offset, in sctp_auth_get_cookie_params() 1381 while (phdr != NULL) { in sctp_auth_get_cookie_params() 1382 ptype = ntohs(phdr->param_type); in sctp_auth_get_cookie_params() 1383 plen = ntohs(phdr->param_length); in sctp_auth_get_cookie_params() 1392 phdr = sctp_get_next_param(m, offset, in sctp_auth_get_cookie_params() 1394 if (phdr == NULL) in sctp_auth_get_cookie_params() 1397 p_random = (struct sctp_auth_random *)phdr; in sctp_auth_get_cookie_params() 1405 phdr = sctp_get_next_param(m, offset, in sctp_auth_get_cookie_params() 1407 if (phdr == NULL) in sctp_auth_get_cookie_params() [all …]
|
/freebsd/sys/dev/qlxgbe/ |
H A D | ql_misc.c | 935 q8_poll_hdr_t *phdr; in qla_poll_list() local 939 phdr = (q8_poll_hdr_t *)((uint8_t *)ce_hdr + sizeof (q8_ce_hdr_t)); in qla_poll_list() 940 pe = (q8_poll_e_t *)((uint8_t *)phdr + sizeof(q8_poll_hdr_t)); in qla_poll_list() 950 if ((data & phdr->tmask) == phdr->tvalue) in qla_poll_list() 953 phdr->tmask, phdr->tvalue)) { in qla_poll_list() 978 q8_poll_hdr_t *phdr; in qla_poll_write_list() local 981 phdr = (q8_poll_hdr_t *)((uint8_t *)ce_hdr + sizeof (q8_ce_hdr_t)); in qla_poll_write_list() 982 wr_e = (q8_poll_wr_e_t *)((uint8_t *)phdr + sizeof(q8_poll_hdr_t)); in qla_poll_write_list() 999 phdr->tmask, phdr->tvalue)) in qla_poll_write_list() 1005 ce_hdr->delay_to, phdr->tmask, in qla_poll_write_list() [all …]
|
/freebsd/contrib/llvm-project/compiler-rt/lib/cfi/ |
H A D | cfi.cpp | 245 const Elf_Phdr *phdr = &info->dlpi_phdr[phdr_idx]; in find_cfi_check_in_dso() 246 if (phdr->p_type == PT_LOAD) { in find_cfi_check_in_dso() 247 uptr beg = info->dlpi_addr + phdr->p_vaddr; in find_cfi_check_in_dso() 248 uptr end = beg + phdr->p_memsz; in find_cfi_check_in_dso() 286 const Elf_Phdr *phdr = &info->dlpi_phdr[i]; in dl_iterate_phdr_cb() 287 if (phdr->p_type == PT_LOAD) { in dl_iterate_phdr_cb() 293 uptr cur_beg = info->dlpi_addr + phdr->p_vaddr; in dl_iterate_phdr_cb() 294 uptr cur_end = cur_beg + phdr->p_memsz; in dl_iterate_phdr_cb() 241 const Elf_Phdr *phdr = &info->dlpi_phdr[phdr_idx]; find_cfi_check_in_dso() local 282 const Elf_Phdr *phdr = &info->dlpi_phdr[i]; dl_iterate_phdr_cb() local
|