Function report |
Source Code:fs\binfmt_elf_fdpic.c |
Create Date:2022-07-28 20:29:04 |
Last Modify:2020-03-12 14:18:49 | Copyright©Brick |
home page | Tree |
Annotation kernel can get tool activity | Download SCCT | Chinese |
Name:load the appropriate binary image (executable or interpreter) into memory* - we assume no MMU is available* - if no other PIC bits are set in params->hdr->e_flags* - we assume that the LOADable segments in the binary are independently relocatable* - we
Proto:static int elf_fdpic_map_file(struct elf_fdpic_params *params, struct file *file, struct mm_struct *mm, const char *what)
Type:int
Parameter:
Type | Parameter | Name |
---|---|---|
struct elf_fdpic_params * | params | |
struct file * | file | |
struct mm_struct * | mm | |
const char * | what |
745 | nloads = 0 |
748 | nloads++ |
754 | loadmap = kzalloc - allocate memory. The memory is set to zero.*@size: how many bytes of memory are required.*@flags: the type of memory to allocate (see kmalloc). |
761 | number of segments = nloads |
768 | Case & == PT_LOADs require constant* displacement |
769 | Case & == PT_LOADs should be contiguous |
776 | Default |
780 | Break |
784 | If e_entry Then |
787 | If e_entry >= VMA recorded in file && e_entry < VMA recorded in file + allocation size recorded in file Then |
792 | Break |
800 | phdr = copy of PT_PHDR table |
812 | If p_vaddr >= VMA recorded in file && p_vaddr + p_filesz <= VMA recorded in file + allocation size recorded in file Then |
815 | mapped PT_PHDR user address = p_vaddr - VMA recorded in file + core address to which mapped + e_phoff - p_offset |
819 | Break |
822 | Break |
826 | phdr = copy of PT_PHDR table |
828 | If p_type != PT_DYNAMIC Then Continue |
833 | If p_vaddr >= VMA recorded in file && p_vaddr + p_memsz <= VMA recorded in file + allocation size recorded in file Then |
846 | If p_memsz == 0 || p_memsz % sizeof(Elf32_Dyn) != 0 Then Go to dynamic_error |
853 | If d_tag != 0 Then Go to dynamic_error |
855 | Break |
858 | Break |
866 | nloads = number of segments |
872 | load_addr = align the pointer to the (next) page boundary (core address to which mapped + allocation size recorded in file ) |
873 | If load_addr == (core address to which mapped & PAGE_MASK) Then |
874 | allocation size recorded in file += load_addr - core address to which mapped + allocation size recorded in file |
879 | number of segments -- |
880 | Continue |
884 | mseg++ |
891 | kdebug("- elfhdr : %lx", mapped ELF header user address ) |
892 | kdebug("- entry : %lx", mapped entry user address ) |
893 | kdebug("- PHDR[] : %lx", mapped PT_PHDR user address ) |
894 | kdebug("- DYNAMIC[]: %lx", mapped PT_DYNAMIC user address ) |
896 | When loop < number of segments cycle kdebug("- LOAD[%d] : %08x-%08x [va=%x ms=%x]", loop, core address to which mapped , core address to which mapped + allocation size recorded in file - 1, VMA recorded in file , allocation size recorded in file ) |
902 | Return 0 |
904 | dynamic_error : |
907 | Return -ELIBBAD |
Name | Describe |
---|---|
load_elf_fdpic_binary | load an fdpic binary into various bits of memory |
Source code conversion tool public plug-in interface | X |
---|---|
Support c/c++/esqlc/java Oracle/Informix/Mysql Plug-in can realize: logical Report Code generation and batch code conversion |