Function report

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

Source Code:kernel\kexec_elf.c Create Date:2022-07-28 11:04:59
Last Modify:2020-03-12 14:18:49 Copyright©Brick
home page Tree
Annotation kernel can get tool activityDownload SCCTChinese

Name:elf_read_phdr

Proto:static int elf_read_phdr(const char *buf, size_t len, struct kexec_elf_info *elf_info, int idx)

Type:int

Parameter:

TypeParameterName
const char *buf
size_tlen
struct kexec_elf_info *elf_info
intidx
207  struct elf64_phdr * phdr = (struct elf_phdr * ) & proghdrs[idx]
208  ehdr = ehdr
212  pbuf = buf + e_phoff + idx * size of buf_phdr
213  buf_phdr = pbuf
215  p_type = elf32_to_cpu(ehdr, p_type)
216  p_flags = elf32_to_cpu(ehdr, p_flags)
219  Case ELF "magic number" [EI_CLASS] == ELFCLASS64
220  Segment file offset = elf64_to_cpu(ehdr, Segment file offset )
221  Segment physical address = elf64_to_cpu(ehdr, Segment physical address )
222  Segment virtual address = elf64_to_cpu(ehdr, Segment virtual address )
223  Segment size in file = elf64_to_cpu(ehdr, Segment size in file )
224  Segment size in memory = elf64_to_cpu(ehdr, Segment size in memory )
225  Segment alignment, file & memory = elf64_to_cpu(ehdr, Segment alignment, file & memory )
226  Break
228  Case ELF "magic number" [EI_CLASS] == ELFCLASS32
229  Segment file offset = elf32_to_cpu(ehdr, Segment file offset )
230  Segment physical address = elf32_to_cpu(ehdr, Segment physical address )
231  Segment virtual address = elf32_to_cpu(ehdr, Segment virtual address )
232  Segment size in file = elf32_to_cpu(ehdr, Segment size in file )
233  Segment size in memory = elf32_to_cpu(ehdr, Segment size in memory )
234  Segment alignment, file & memory = elf32_to_cpu(ehdr, Segment alignment, file & memory )
235  Break
237  Default
238  pr_debug("Unknown ELF class.\n")
239  Return -EINVAL
242  Return If lf_is_phdr_sane - check that it is safe to use the program header*@buf_len: size of the buffer in which the ELF file is loaded. Then 0 Else -ENOEXEC
Caller
NameDescribe
elf_read_phdrslf_read_phdrs - read the program headers from the buffer* This function assumes that the program header table was checked for sanity.* Use elf_is_ehdr_sane() if it wasn't.