550W Document
550W, a high-end OS
elf.h 文件参考
#include <asm/pgtable.h>
#include <common/types.h>
#include <lib/string.h>
elf.h 的引用(Include)关系图:
此图展示该文件直接或间接的被哪些文件引用了:

浏览源代码.

struct  elf64_hdr
 
struct  elf64_phdr
 
struct  ELF_info
 

宏定义

#define EI_MAG0   0 /* e_ident[] indexes */
 
#define EI_MAG1   1
 
#define EI_MAG2   2
 
#define EI_MAG3   3
 
#define EI_CLASS   4
 
#define EI_DATA   5
 
#define EI_VERSION   6
 
#define EI_OSABI   7
 
#define EI_PAD   8
 
#define ELFMAG0   0x7f /* EI_MAG */
 
#define ELFMAG1   'E'
 
#define ELFMAG2   'L'
 
#define ELFMAG3   'F'
 
#define ELFMAG   "\177ELF"
 
#define SELFMAG   4
 
#define ELFCLASSNONE   0 /* EI_CLASS */
 
#define ELFCLASS32   1
 
#define ELFCLASS64   2
 
#define ELFCLASSNUM   3
 
#define ELFDATANONE   0 /* e_ident[EI_DATA] */
 
#define ELFDATA2LSB   1
 
#define ELFDATA2MSB   2
 
#define EV_NONE   0 /* e_version, EI_VERSION */
 
#define EV_CURRENT   1
 
#define EV_NUM   2
 
#define ELFOSABI_NONE   0
 
#define ELFOSABI_LINUX   3
 
#define ELF_OSABI   ELFOSABI_NONE
 
#define EI_NIDENT   16
 
#define PF_X   (1 << 0) /* Segment is executable */
 
#define PF_W   (1 << 1) /* Segment is writable */
 
#define PF_R   (1 << 2) /* Segment is readable */
 
#define PF_MASKOS   0x0ff00000 /* OS-specific */
 
#define PF_MASKPROC   0xf0000000 /* Processor-specific */
 
#define PT_NULL   0 /* Program header table entry unused */
 
#define PT_LOAD   1 /* Loadable program segment */
 
#define PT_DYNAMIC   2 /* Dynamic linking information */
 
#define PT_INTERP   3 /* Program interpreter */
 
#define PT_NOTE   4 /* Auxiliary information */
 
#define PT_SHLIB   5 /* Reserved */
 
#define PT_PHDR   6 /* Entry for header table itself */
 
#define PT_TLS   7 /* Thread-local storage segment */
 
#define PT_NUM   8 /* Number of defined types */
 
#define PT_LOOS   0x60000000 /* Start of OS-specific */
 
#define PT_GNU_EH_FRAME   0x6474e550 /* GCC .eh_frame_hdr segment */
 
#define PT_GNU_STACK   0x6474e551 /* Indicates stack executability */
 
#define PT_GNU_RELRO   0x6474e552 /* Read-only after relocation */
 
#define PT_LOSUNW   0x6ffffffa
 
#define PT_SUNWBSS   0x6ffffffa /* Sun Specific segment */
 
#define PT_SUNWSTACK   0x6ffffffb /* Stack segment */
 
#define PT_HISUNW   0x6fffffff
 
#define PT_HIOS   0x6fffffff /* End of OS-specific */
 
#define PT_LOPROC   0x70000000 /* Start of processor-specific */
 
#define PT_HIPROC   0x7fffffff /* End of processor-specific */
 
#define MIN(a, b)   ((a) < (b) ? (a) : (b))
 

类型定义

typedef uint64_t Elf64_Addr
 
typedef uint16_t Elf64_Half
 
typedef int16_t Elf64_SHalf
 
typedef uint64_t Elf64_Off
 
typedef int32_t Elf64_Sword
 
typedef uint32_t Elf64_Word
 
typedef uint64_t Elf64_Xword
 
typedef int64_t Elf64_Sxword
 
typedef uint16_t Elf64_Section
 
typedef Elf64_Half Elf64_Versym
 
typedef struct elf64_hdr Elf64_Ehdr
 
typedef struct elf64_phdr Elf64_Phdr
 
typedef struct ELF_info ELF_info_t
 

函数

uintptr_t load_elf (unsigned char elf_binary[], unsigned length, uintptr_t pgdir, uintptr_t(*prepare_page_for_va)(uintptr_t va, uintptr_t pgdir))
 

宏定义说明

◆ EI_CLASS

#define EI_CLASS   4

◆ EI_DATA

#define EI_DATA   5

◆ EI_MAG0

#define EI_MAG0   0 /* e_ident[] indexes */

◆ EI_MAG1

#define EI_MAG1   1

◆ EI_MAG2

#define EI_MAG2   2

◆ EI_MAG3

#define EI_MAG3   3

◆ EI_NIDENT

#define EI_NIDENT   16

◆ EI_OSABI

#define EI_OSABI   7

◆ EI_PAD

#define EI_PAD   8

◆ EI_VERSION

#define EI_VERSION   6

◆ ELF_OSABI

#define ELF_OSABI   ELFOSABI_NONE

◆ ELFCLASS32

#define ELFCLASS32   1

◆ ELFCLASS64

#define ELFCLASS64   2

◆ ELFCLASSNONE

#define ELFCLASSNONE   0 /* EI_CLASS */

◆ ELFCLASSNUM

#define ELFCLASSNUM   3

◆ ELFDATA2LSB

#define ELFDATA2LSB   1

◆ ELFDATA2MSB

#define ELFDATA2MSB   2

◆ ELFDATANONE

#define ELFDATANONE   0 /* e_ident[EI_DATA] */

◆ ELFMAG

#define ELFMAG   "\177ELF"

◆ ELFMAG0

#define ELFMAG0   0x7f /* EI_MAG */

◆ ELFMAG1

#define ELFMAG1   'E'

◆ ELFMAG2

#define ELFMAG2   'L'

◆ ELFMAG3

#define ELFMAG3   'F'

◆ ELFOSABI_LINUX

#define ELFOSABI_LINUX   3

◆ ELFOSABI_NONE

#define ELFOSABI_NONE   0

◆ EV_CURRENT

#define EV_CURRENT   1

◆ EV_NONE

#define EV_NONE   0 /* e_version, EI_VERSION */

◆ EV_NUM

#define EV_NUM   2

◆ MIN

#define MIN (   a,
 
)    ((a) < (b) ? (a) : (b))

◆ PF_MASKOS

#define PF_MASKOS   0x0ff00000 /* OS-specific */

◆ PF_MASKPROC

#define PF_MASKPROC   0xf0000000 /* Processor-specific */

◆ PF_R

#define PF_R   (1 << 2) /* Segment is readable */

◆ PF_W

#define PF_W   (1 << 1) /* Segment is writable */

◆ PF_X

#define PF_X   (1 << 0) /* Segment is executable */

◆ PT_DYNAMIC

#define PT_DYNAMIC   2 /* Dynamic linking information */

◆ PT_GNU_EH_FRAME

#define PT_GNU_EH_FRAME   0x6474e550 /* GCC .eh_frame_hdr segment */

◆ PT_GNU_RELRO

#define PT_GNU_RELRO   0x6474e552 /* Read-only after relocation */

◆ PT_GNU_STACK

#define PT_GNU_STACK   0x6474e551 /* Indicates stack executability */

◆ PT_HIOS

#define PT_HIOS   0x6fffffff /* End of OS-specific */

◆ PT_HIPROC

#define PT_HIPROC   0x7fffffff /* End of processor-specific */

◆ PT_HISUNW

#define PT_HISUNW   0x6fffffff

◆ PT_INTERP

#define PT_INTERP   3 /* Program interpreter */

◆ PT_LOAD

#define PT_LOAD   1 /* Loadable program segment */

◆ PT_LOOS

#define PT_LOOS   0x60000000 /* Start of OS-specific */

◆ PT_LOPROC

#define PT_LOPROC   0x70000000 /* Start of processor-specific */

◆ PT_LOSUNW

#define PT_LOSUNW   0x6ffffffa

◆ PT_NOTE

#define PT_NOTE   4 /* Auxiliary information */

◆ PT_NULL

#define PT_NULL   0 /* Program header table entry unused */

◆ PT_NUM

#define PT_NUM   8 /* Number of defined types */

◆ PT_PHDR

#define PT_PHDR   6 /* Entry for header table itself */

◆ PT_SHLIB

#define PT_SHLIB   5 /* Reserved */

◆ PT_SUNWBSS

#define PT_SUNWBSS   0x6ffffffa /* Sun Specific segment */

◆ PT_SUNWSTACK

#define PT_SUNWSTACK   0x6ffffffb /* Stack segment */

◆ PT_TLS

#define PT_TLS   7 /* Thread-local storage segment */

◆ SELFMAG

#define SELFMAG   4

类型定义说明

◆ Elf64_Addr

typedef uint64_t Elf64_Addr

◆ Elf64_Ehdr

typedef struct elf64_hdr Elf64_Ehdr

◆ Elf64_Half

typedef uint16_t Elf64_Half

◆ Elf64_Off

typedef uint64_t Elf64_Off

◆ Elf64_Phdr

typedef struct elf64_phdr Elf64_Phdr

◆ Elf64_Section

typedef uint16_t Elf64_Section

◆ Elf64_SHalf

typedef int16_t Elf64_SHalf

◆ Elf64_Sword

typedef int32_t Elf64_Sword

◆ Elf64_Sxword

typedef int64_t Elf64_Sxword

◆ Elf64_Versym

◆ Elf64_Word

typedef uint32_t Elf64_Word

◆ Elf64_Xword

typedef uint64_t Elf64_Xword

◆ ELF_info_t

typedef struct ELF_info ELF_info_t

函数说明

◆ load_elf()

uintptr_t load_elf ( unsigned char  elf_binary[],
unsigned  length,
uintptr_t  pgdir,
uintptr_t(*)(uintptr_t va, uintptr_t pgdir)  prepare_page_for_va 
)