函数逻辑报告

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

Source Code:kernel\kexec_elf.c Create Date:2022-07-27 12:06:41
Last Modify:2020-03-12 14:18:49 Copyright©Brick
首页 函数Tree
注解内核,赢得工具下载SCCTEnglish

函数名称:kexec_elf_load - load ELF executable image*@lowest_load_addr: On return, will be the address where the first PT_LOAD* section will be loaded in memory.* Return:* 0 on success, negative value on failure.

函数原型:int kexec_elf_load(struct kimage *image, struct elf64_hdr *ehdr, struct kexec_elf_info *elf_info, struct kexec_buf *kbuf, unsigned long *lowest_load_addr)

返回类型:int

参数:

类型参数名称
struct kimage *image
struct elf64_hdr *ehdr
struct kexec_elf_info *elf_info
struct kexec_buf *kbuf
unsigned long *lowest_load_addr
393  lowest_addr等于UINT_MAX
398 i小于e_phnum循环
403  phdr等于proghdrs[i]
404  如果p_type不等于PT_LOAD则继续下一循环
407  size等于 Segment size in file
408  如果size大于 Segment size in memory size等于 Segment size in memory
411  buffer等于buffer Segment file offset
412  bufsz等于size
413  memsz等于 Segment size in memory
414  buf_align等于 Segment alignment, file & memory
415  buf_min等于 Segment physical address
416  mem等于If kexec_buf.mem is set to this value, kexec_locate_mem_hole()* will try to allocate free memory. Arch may overwrite it.
417  ret等于kexec_add_buffer - place a buffer in a kexec segment*@kbuf: Buffer contents and memory parameters.* This function assumes that kexec_mutex is held.* On successful return, @kbuf->mem will have the physical address of* the buffer in memory.
418  如果ret则转到:out
420  load_addr等于mem
422  如果load_addr小于lowest_addrlowest_addr等于load_addr
426  lowest_load_addr等于lowest_addr
427  ret等于0
428  out :
429  返回:ret