/Linux-v6.1/drivers/soc/qcom/ |
D | mdt_loader.c | 20 static bool mdt_phdr_valid(const struct elf32_phdr *phdr) in mdt_phdr_valid() argument 22 if (phdr->p_type != PT_LOAD) in mdt_phdr_valid() 25 if ((phdr->p_flags & QCOM_MDT_TYPE_MASK) == QCOM_MDT_TYPE_HASH) in mdt_phdr_valid() 28 if (!phdr->p_memsz) in mdt_phdr_valid() 38 const struct elf32_phdr *phdr = &phdrs[segment]; in mdt_load_split_segment() local 52 ptr, phdr->p_filesz); in mdt_load_split_segment() 59 if (seg_fw->size != phdr->p_filesz) { in mdt_load_split_segment() 81 const struct elf32_phdr *phdr; in qcom_mdt_get_size() local 91 phdr = &phdrs[i]; in qcom_mdt_get_size() 93 if (!mdt_phdr_valid(phdr)) in qcom_mdt_get_size() [all …]
|
D | smem.c | 291 phdr_to_last_uncached_entry(struct smem_partition_header *phdr) in phdr_to_last_uncached_entry() argument 293 void *p = phdr; in phdr_to_last_uncached_entry() 295 return p + le32_to_cpu(phdr->offset_free_uncached); in phdr_to_last_uncached_entry() 299 phdr_to_first_cached_entry(struct smem_partition_header *phdr, in phdr_to_first_cached_entry() argument 302 void *p = phdr; in phdr_to_first_cached_entry() 305 return p + le32_to_cpu(phdr->size) - ALIGN(sizeof(*e), cacheline); in phdr_to_first_cached_entry() 309 phdr_to_last_cached_entry(struct smem_partition_header *phdr) in phdr_to_last_cached_entry() argument 311 void *p = phdr; in phdr_to_last_cached_entry() 313 return p + le32_to_cpu(phdr->offset_free_cached); in phdr_to_last_cached_entry() 317 phdr_to_first_uncached_entry(struct smem_partition_header *phdr) in phdr_to_first_uncached_entry() argument [all …]
|
/Linux-v6.1/arch/s390/kernel/ |
D | kexec_elf.c | 21 const Elf_Phdr *phdr; in kexec_file_add_kernel_elf() local 34 phdr = (void *)ehdr + ehdr->e_phoff; in kexec_file_add_kernel_elf() 35 for (i = 0; i < ehdr->e_phnum; i++, phdr++) { in kexec_file_add_kernel_elf() 36 if (phdr->p_type != PT_LOAD) in kexec_file_add_kernel_elf() 39 buf.buffer = kernel + phdr->p_offset; in kexec_file_add_kernel_elf() 40 buf.bufsz = phdr->p_filesz; in kexec_file_add_kernel_elf() 42 buf.mem = ALIGN(phdr->p_paddr, phdr->p_align); in kexec_file_add_kernel_elf() 45 buf.memsz = phdr->p_memsz; in kexec_file_add_kernel_elf() 46 data->memsz = ALIGN(data->memsz, phdr->p_align) + buf.memsz; in kexec_file_add_kernel_elf() 48 if (entry - phdr->p_paddr < phdr->p_memsz) { in kexec_file_add_kernel_elf() [all …]
|
D | crash_dump.c | 501 static void loads_init(Elf64_Phdr *phdr, u64 loads_offset) in loads_init() argument 507 phdr->p_filesz = end - start; in loads_init() 508 phdr->p_type = PT_LOAD; in loads_init() 509 phdr->p_offset = start; in loads_init() 510 phdr->p_vaddr = start; in loads_init() 511 phdr->p_paddr = start; in loads_init() 512 phdr->p_memsz = end - start; in loads_init() 513 phdr->p_flags = PF_R | PF_W | PF_X; in loads_init() 514 phdr->p_align = PAGE_SIZE; in loads_init() 515 phdr++; in loads_init() [all …]
|
/Linux-v6.1/fs/ |
D | binfmt_elf_fdpic.c | 141 struct elf32_phdr *phdr; in elf_fdpic_fetch_phdrs() local 161 phdr = params->phdrs; in elf_fdpic_fetch_phdrs() 162 for (loop = 0; loop < params->hdr.e_phnum; loop++, phdr++) { in elf_fdpic_fetch_phdrs() 163 if (phdr->p_type != PT_GNU_STACK) in elf_fdpic_fetch_phdrs() 166 if (phdr->p_flags & PF_X) in elf_fdpic_fetch_phdrs() 171 params->stack_size = phdr->p_memsz; in elf_fdpic_fetch_phdrs() 186 struct elf_phdr *phdr; in load_elf_fdpic_binary() local 229 phdr = exec_params.phdrs; in load_elf_fdpic_binary() 231 for (i = 0; i < exec_params.hdr.e_phnum; i++, phdr++) { in load_elf_fdpic_binary() 232 switch (phdr->p_type) { in load_elf_fdpic_binary() [all …]
|
/Linux-v6.1/kernel/ |
D | kexec_elf.c | 185 static bool elf_is_phdr_sane(const struct elf_phdr *phdr, size_t buf_len) in elf_is_phdr_sane() argument 188 if (phdr->p_offset + phdr->p_filesz < phdr->p_offset) { in elf_is_phdr_sane() 191 } else if (phdr->p_offset + phdr->p_filesz > buf_len) { in elf_is_phdr_sane() 194 } else if (phdr->p_paddr + phdr->p_memsz < phdr->p_paddr) { in elf_is_phdr_sane() 207 struct elf_phdr *phdr = (struct elf_phdr *) &elf_info->proghdrs[idx]; in elf_read_phdr() local 215 phdr->p_type = elf32_to_cpu(elf_info->ehdr, buf_phdr->p_type); in elf_read_phdr() 216 phdr->p_flags = elf32_to_cpu(elf_info->ehdr, buf_phdr->p_flags); in elf_read_phdr() 220 phdr->p_offset = elf64_to_cpu(ehdr, buf_phdr->p_offset); in elf_read_phdr() 221 phdr->p_paddr = elf64_to_cpu(ehdr, buf_phdr->p_paddr); in elf_read_phdr() 222 phdr->p_vaddr = elf64_to_cpu(ehdr, buf_phdr->p_vaddr); in elf_read_phdr() [all …]
|
D | kexec_file.c | 1225 Elf64_Phdr *phdr; in crash_prepare_elf64_headers() local 1253 phdr = (Elf64_Phdr *)(ehdr + 1); in crash_prepare_elf64_headers() 1269 phdr->p_type = PT_NOTE; in crash_prepare_elf64_headers() 1271 phdr->p_offset = phdr->p_paddr = notes_addr; in crash_prepare_elf64_headers() 1272 phdr->p_filesz = phdr->p_memsz = sizeof(note_buf_t); in crash_prepare_elf64_headers() 1274 phdr++; in crash_prepare_elf64_headers() 1278 phdr->p_type = PT_NOTE; in crash_prepare_elf64_headers() 1279 phdr->p_offset = phdr->p_paddr = paddr_vmcoreinfo_note(); in crash_prepare_elf64_headers() 1280 phdr->p_filesz = phdr->p_memsz = VMCOREINFO_NOTE_SIZE; in crash_prepare_elf64_headers() 1282 phdr++; in crash_prepare_elf64_headers() [all …]
|
/Linux-v6.1/arch/ia64/kernel/ |
D | elfcore.c | 23 struct elf_phdr phdr = gate_phdrs[i]; in elf_core_write_extra_phdrs() local 25 if (phdr.p_type == PT_LOAD) { in elf_core_write_extra_phdrs() 26 phdr.p_memsz = PAGE_ALIGN(phdr.p_memsz); in elf_core_write_extra_phdrs() 27 phdr.p_filesz = phdr.p_memsz; in elf_core_write_extra_phdrs() 29 ofs = phdr.p_offset = offset; in elf_core_write_extra_phdrs() 30 offset += phdr.p_filesz; in elf_core_write_extra_phdrs() 32 phdr.p_offset = ofs; in elf_core_write_extra_phdrs() 35 phdr.p_offset += ofs; in elf_core_write_extra_phdrs() 37 phdr.p_paddr = 0; /* match other core phdrs */ in elf_core_write_extra_phdrs() 38 if (!dump_emit(cprm, &phdr, sizeof(phdr))) in elf_core_write_extra_phdrs()
|
/Linux-v6.1/tools/testing/selftests/kvm/lib/ |
D | elf.c | 147 Elf64_Phdr phdr; in kvm_vm_elf_load() local 148 test_read(fd, &phdr, sizeof(phdr)); in kvm_vm_elf_load() 151 if (phdr.p_type != PT_LOAD) in kvm_vm_elf_load() 155 TEST_ASSERT(phdr.p_memsz > 0, "Unexpected loadable segment " in kvm_vm_elf_load() 158 n1, (uint64_t) phdr.p_memsz); in kvm_vm_elf_load() 159 vm_vaddr_t seg_vstart = align_down(phdr.p_vaddr, vm->page_size); in kvm_vm_elf_load() 160 vm_vaddr_t seg_vend = phdr.p_vaddr + phdr.p_memsz - 1; in kvm_vm_elf_load() 179 if (phdr.p_filesz) { in kvm_vm_elf_load() 180 offset_rv = lseek(fd, phdr.p_offset, SEEK_SET); in kvm_vm_elf_load() 181 TEST_ASSERT(offset_rv == phdr.p_offset, in kvm_vm_elf_load() [all …]
|
/Linux-v6.1/arch/arm64/kernel/ |
D | elfcore.c | 98 struct elf_phdr phdr; in elf_core_write_extra_phdrs() local 100 phdr.p_type = PT_AARCH64_MEMTAG_MTE; in elf_core_write_extra_phdrs() 101 phdr.p_offset = offset; in elf_core_write_extra_phdrs() 102 phdr.p_vaddr = vma->vm_start; in elf_core_write_extra_phdrs() 103 phdr.p_paddr = 0; in elf_core_write_extra_phdrs() 104 phdr.p_filesz = mte_vma_tag_dump_size(vma); in elf_core_write_extra_phdrs() 105 phdr.p_memsz = vma->vm_end - vma->vm_start; in elf_core_write_extra_phdrs() 106 offset += phdr.p_filesz; in elf_core_write_extra_phdrs() 107 phdr.p_flags = 0; in elf_core_write_extra_phdrs() 108 phdr.p_align = 0; in elf_core_write_extra_phdrs() [all …]
|
/Linux-v6.1/tools/perf/util/ |
D | symbol-minimal.c | 117 Elf32_Phdr *phdr; in filename__read_build_id() local 137 for (i = 0, phdr = buf; i < ehdr.e_phnum; i++, phdr++) { in filename__read_build_id() 142 phdr->p_type = bswap_32(phdr->p_type); in filename__read_build_id() 143 phdr->p_offset = bswap_32(phdr->p_offset); in filename__read_build_id() 144 phdr->p_filesz = bswap_32(phdr->p_filesz); in filename__read_build_id() 147 if (phdr->p_type != PT_NOTE) in filename__read_build_id() 150 buf_size = phdr->p_filesz; in filename__read_build_id() 151 offset = phdr->p_offset; in filename__read_build_id() 168 Elf64_Phdr *phdr; in filename__read_build_id() local 188 for (i = 0, phdr = buf; i < ehdr.e_phnum; i++, phdr++) { in filename__read_build_id() [all …]
|
/Linux-v6.1/arch/x86/um/ |
D | elfcore.c | 26 struct elf_phdr phdr = phdrp[i]; in elf_core_write_extra_phdrs() local 28 if (phdr.p_type == PT_LOAD) { in elf_core_write_extra_phdrs() 29 ofs = phdr.p_offset = offset; in elf_core_write_extra_phdrs() 30 offset += phdr.p_filesz; in elf_core_write_extra_phdrs() 32 phdr.p_offset += ofs; in elf_core_write_extra_phdrs() 34 phdr.p_paddr = 0; /* match other core phdrs */ in elf_core_write_extra_phdrs() 35 if (!dump_emit(cprm, &phdr, sizeof(phdr))) in elf_core_write_extra_phdrs()
|
/Linux-v6.1/fs/proc/ |
D | vmcore.c | 851 Elf64_Phdr phdr; in merge_note_headers_elf64() local 874 phdr.p_type = PT_NOTE; in merge_note_headers_elf64() 875 phdr.p_flags = 0; in merge_note_headers_elf64() 878 phdr.p_offset = roundup(note_off, PAGE_SIZE); in merge_note_headers_elf64() 879 phdr.p_vaddr = phdr.p_paddr = 0; in merge_note_headers_elf64() 880 phdr.p_filesz = phdr.p_memsz = phdr_sz; in merge_note_headers_elf64() 881 phdr.p_align = 0; in merge_note_headers_elf64() 885 memcpy(tmp, &phdr, sizeof(phdr)); in merge_note_headers_elf64() 886 tmp += sizeof(phdr); in merge_note_headers_elf64() 901 elfnotes_orig_sz = phdr.p_memsz; in merge_note_headers_elf64() [all …]
|
/Linux-v6.1/drivers/media/common/siano/ |
D | smsendian.c | 85 struct sms_msg_hdr *phdr = (struct sms_msg_hdr *)msg; in smsendian_handle_message_header() local 87 phdr->msg_type = le16_to_cpu((__force __le16)phdr->msg_type); in smsendian_handle_message_header() 88 phdr->msg_length = le16_to_cpu((__force __le16)phdr->msg_length); in smsendian_handle_message_header() 89 phdr->msg_flags = le16_to_cpu((__force __le16)phdr->msg_flags); in smsendian_handle_message_header()
|
/Linux-v6.1/lib/ |
D | buildid.c | 73 Elf32_Phdr *phdr; in get_build_id_32() local 81 phdr = (Elf32_Phdr *)(page_addr + sizeof(Elf32_Ehdr)); in get_build_id_32() 84 if (phdr[i].p_type == PT_NOTE && in get_build_id_32() 86 page_addr + phdr[i].p_offset, in get_build_id_32() 87 phdr[i].p_filesz)) in get_build_id_32() 98 Elf64_Phdr *phdr; in get_build_id_64() local 106 phdr = (Elf64_Phdr *)(page_addr + sizeof(Elf64_Ehdr)); in get_build_id_64() 109 if (phdr[i].p_type == PT_NOTE && in get_build_id_64() 111 page_addr + phdr[i].p_offset, in get_build_id_64() 112 phdr[i].p_filesz)) in get_build_id_64()
|
/Linux-v6.1/drivers/media/usb/siano/ |
D | smsusb.c | 98 struct sms_msg_hdr *phdr = (struct sms_msg_hdr *)surb->cb->p; in smsusb_onresponse() local 100 smsendian_handle_message_header(phdr); in smsusb_onresponse() 101 if (urb->actual_length >= phdr->msg_length) { in smsusb_onresponse() 102 surb->cb->size = phdr->msg_length; in smsusb_onresponse() 105 (phdr->msg_flags & MSG_HDR_FLAG_SPLIT_MSG)) { in smsusb_onresponse() 109 ((phdr->msg_flags >> 8) & 3); in smsusb_onresponse() 112 if (((int) phdr->msg_length + in smsusb_onresponse() 115 phdr->msg_length, in smsusb_onresponse() 123 memcpy((char *) phdr + surb->cb->offset, in smsusb_onresponse() 124 phdr, sizeof(struct sms_msg_hdr)); in smsusb_onresponse() [all …]
|
/Linux-v6.1/drivers/remoteproc/ |
D | remoteproc_elf_helpers.h | 70 ELF_GEN_FIELD_GET_SET(phdr, p_paddr, u64) in ELF_GEN_FIELD_GET_SET() 71 ELF_GEN_FIELD_GET_SET(phdr, p_vaddr, u64) in ELF_GEN_FIELD_GET_SET() 72 ELF_GEN_FIELD_GET_SET(phdr, p_filesz, u64) in ELF_GEN_FIELD_GET_SET() 73 ELF_GEN_FIELD_GET_SET(phdr, p_memsz, u64) in ELF_GEN_FIELD_GET_SET() 74 ELF_GEN_FIELD_GET_SET(phdr, p_type, u32) in ELF_GEN_FIELD_GET_SET() 75 ELF_GEN_FIELD_GET_SET(phdr, p_offset, u64) in ELF_GEN_FIELD_GET_SET() 76 ELF_GEN_FIELD_GET_SET(phdr, p_flags, u32) in ELF_GEN_FIELD_GET_SET() 77 ELF_GEN_FIELD_GET_SET(phdr, p_align, u64) in ELF_GEN_FIELD_GET_SET() 97 ELF_STRUCT_SIZE(phdr)
|
D | remoteproc_coredump.c | 237 void *phdr; in rproc_coredump() local 289 phdr = data + elf_hdr_get_e_phoff(class, ehdr); in rproc_coredump() 294 memset(phdr, 0, elf_size_of_phdr(class)); in rproc_coredump() 295 elf_phdr_set_p_type(class, phdr, PT_LOAD); in rproc_coredump() 296 elf_phdr_set_p_offset(class, phdr, offset); in rproc_coredump() 297 elf_phdr_set_p_vaddr(class, phdr, segment->da); in rproc_coredump() 298 elf_phdr_set_p_paddr(class, phdr, segment->da); in rproc_coredump() 299 elf_phdr_set_p_filesz(class, phdr, segment->size); in rproc_coredump() 300 elf_phdr_set_p_memsz(class, phdr, segment->size); in rproc_coredump() 301 elf_phdr_set_p_flags(class, phdr, PF_R | PF_W | PF_X); in rproc_coredump() [all …]
|
/Linux-v6.1/arch/powerpc/kernel/ |
D | fadump.c | 769 struct elf_phdr *phdr; in fadump_update_elfcore_header() local 774 phdr = (struct elf_phdr *)bufp; in fadump_update_elfcore_header() 776 if (phdr->p_type == PT_NOTE) { in fadump_update_elfcore_header() 777 phdr->p_paddr = __pa(fw_dump.cpu_notes_buf_vaddr); in fadump_update_elfcore_header() 778 phdr->p_offset = phdr->p_paddr; in fadump_update_elfcore_header() 779 phdr->p_filesz = fw_dump.cpu_notes_buf_size; in fadump_update_elfcore_header() 780 phdr->p_memsz = fw_dump.cpu_notes_buf_size; in fadump_update_elfcore_header() 1078 struct elf_phdr *phdr; in fadump_create_elfcore_headers() local 1093 phdr = (struct elf_phdr *)bufp; in fadump_create_elfcore_headers() 1095 phdr->p_type = PT_NOTE; in fadump_create_elfcore_headers() [all …]
|
/Linux-v6.1/arch/riscv/kernel/ |
D | elf_kexec.c | 32 const struct elf_phdr *phdr; in riscv_kexec_elf_load() local 37 phdr = &elf_info->proghdrs[i]; in riscv_kexec_elf_load() 38 if (phdr->p_type != PT_LOAD) in riscv_kexec_elf_load() 41 size = phdr->p_filesz; in riscv_kexec_elf_load() 42 if (size > phdr->p_memsz) in riscv_kexec_elf_load() 43 size = phdr->p_memsz; in riscv_kexec_elf_load() 45 kbuf.buffer = (void *) elf_info->buffer + phdr->p_offset; in riscv_kexec_elf_load() 47 kbuf.buf_align = phdr->p_align; in riscv_kexec_elf_load() 48 kbuf.mem = phdr->p_paddr - old_pbase + new_pbase; in riscv_kexec_elf_load() 49 kbuf.memsz = phdr->p_memsz; in riscv_kexec_elf_load() [all …]
|
/Linux-v6.1/tools/testing/selftests/sgx/ |
D | load.c | 232 Elf64_Phdr *phdr = &phdr_tbl[i]; in encl_load() local 234 if (phdr->p_type == PT_LOAD) in encl_load() 244 Elf64_Phdr *phdr = &phdr_tbl[i]; in encl_load() local 245 unsigned int flags = phdr->p_flags; in encl_load() 247 if (phdr->p_type != PT_LOAD) in encl_load() 255 phdr->p_flags); in encl_load() 262 phdr->p_flags); in encl_load() 267 src_offset = phdr->p_offset & PAGE_MASK; in encl_load() 273 seg->prot = (phdr->p_flags & PF_R) ? PROT_READ : 0; in encl_load() 274 seg->prot |= (phdr->p_flags & PF_W) ? PROT_WRITE : 0; in encl_load() [all …]
|
/Linux-v6.1/arch/powerpc/platforms/powernv/ |
D | opal-core.c | 307 Elf64_Phdr *phdr; in create_opalcore() local 380 phdr = (Elf64_Phdr *)bufp; in create_opalcore() 382 phdr->p_type = cpu_to_be32(PT_NOTE); in create_opalcore() 383 phdr->p_flags = 0; in create_opalcore() 384 phdr->p_align = 0; in create_opalcore() 385 phdr->p_paddr = phdr->p_vaddr = 0; in create_opalcore() 386 phdr->p_offset = cpu_to_be64(hdr_size); in create_opalcore() 387 phdr->p_filesz = phdr->p_memsz = cpu_to_be64(cpu_notes_size); in create_opalcore() 394 phdr = (Elf64_Phdr *)bufp; in create_opalcore() 396 phdr->p_type = cpu_to_be32(PT_LOAD); in create_opalcore() [all …]
|
/Linux-v6.1/net/dsa/ |
D | tag_qca.c | 16 __be16 *phdr; in qca_tag_xmit() local 22 phdr = dsa_etype_header_pos_tx(skb); in qca_tag_xmit() 29 *phdr = htons(hdr); in qca_tag_xmit() 40 __be16 *phdr; in qca_tag_rcv() local 51 phdr = dsa_etype_header_pos_rx(skb); in qca_tag_rcv() 52 hdr = ntohs(*phdr); in qca_tag_rcv()
|
/Linux-v6.1/tools/testing/selftests/powerpc/ptrace/ |
D | core-pkey.c | 199 Elf64_Phdr *phdr; in check_core_file() local 216 phdr_size = sizeof(*phdr) * ehdr->e_phnum; in check_core_file() 223 for (phdr = p + ehdr->e_phoff; in check_core_file() 224 (void *) phdr < p + ehdr->e_phoff + phdr_size; in check_core_file() 225 phdr += ehdr->e_phentsize) in check_core_file() 226 if (phdr->p_type == PT_NOTE) in check_core_file() 229 FAIL_IF((void *) phdr >= p + ehdr->e_phoff + phdr_size); in check_core_file() 232 for (nhdr = p + phdr->p_offset; in check_core_file() 233 (void *) nhdr < p + phdr->p_offset + phdr->p_filesz; in check_core_file() 238 FAIL_IF((void *) nhdr >= p + phdr->p_offset + phdr->p_filesz); in check_core_file()
|
/Linux-v6.1/arch/x86/boot/compressed/ |
D | misc.c | 284 Elf64_Phdr *phdrs, *phdr; in parse_elf() local 287 Elf32_Phdr *phdrs, *phdr; in parse_elf() 310 phdr = &phdrs[i]; in parse_elf() 312 switch (phdr->p_type) { in parse_elf() 315 if ((phdr->p_align % 0x200000) != 0) in parse_elf() 320 dest += (phdr->p_paddr - LOAD_PHYSICAL_ADDR); in parse_elf() 322 dest = (void *)(phdr->p_paddr); in parse_elf() 324 memmove(dest, output + phdr->p_offset, phdr->p_filesz); in parse_elf()
|