⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 elf.h

📁 qemu虚拟机代码
💻 H
📖 第 1 页 / 共 3 页
字号:
#ifndef _QEMU_ELF_H#define _QEMU_ELF_H#include <inttypes.h>/* 32-bit ELF base types. */typedef uint32_t Elf32_Addr;typedef uint16_t Elf32_Half;typedef uint32_t Elf32_Off;typedef int32_t  Elf32_Sword;typedef uint32_t Elf32_Word;/* 64-bit ELF base types. */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;/* These constants are for the segment types stored in the image headers */#define PT_NULL    0#define PT_LOAD    1#define PT_DYNAMIC 2#define PT_INTERP  3#define PT_NOTE    4#define PT_SHLIB   5#define PT_PHDR    6#define PT_LOPROC  0x70000000#define PT_HIPROC  0x7fffffff#define PT_MIPS_REGINFO		0x70000000#define PT_MIPS_OPTIONS		0x70000001/* Flags in the e_flags field of the header *//* MIPS architecture level. */#define EF_MIPS_ARCH_1		0x00000000	/* -mips1 code.  */#define EF_MIPS_ARCH_2		0x10000000	/* -mips2 code.  */#define EF_MIPS_ARCH_3		0x20000000	/* -mips3 code.  */#define EF_MIPS_ARCH_4		0x30000000	/* -mips4 code.  */#define EF_MIPS_ARCH_5		0x40000000	/* -mips5 code.  */#define EF_MIPS_ARCH_32		0x50000000	/* MIPS32 code.  */#define EF_MIPS_ARCH_64		0x60000000	/* MIPS64 code.  *//* The ABI of a file. */#define EF_MIPS_ABI_O32		0x00001000	/* O32 ABI.  */#define EF_MIPS_ABI_O64		0x00002000	/* O32 extended for 64 bit.  */#define EF_MIPS_NOREORDER 0x00000001#define EF_MIPS_PIC       0x00000002#define EF_MIPS_CPIC      0x00000004#define EF_MIPS_ABI2		0x00000020#define EF_MIPS_OPTIONS_FIRST	0x00000080#define EF_MIPS_32BITMODE	0x00000100#define EF_MIPS_ABI		0x0000f000#define EF_MIPS_ARCH      0xf0000000/* These constants define the different elf file types */#define ET_NONE   0#define ET_REL    1#define ET_EXEC   2#define ET_DYN    3#define ET_CORE   4#define ET_LOPROC 0xff00#define ET_HIPROC 0xffff/* These constants define the various ELF target machines */#define EM_NONE  0#define EM_M32   1#define EM_SPARC 2#define EM_386   3#define EM_68K   4#define EM_88K   5#define EM_486   6   /* Perhaps disused */#define EM_860   7#define EM_MIPS		8	/* MIPS R3000 (officially, big-endian only) */#define EM_MIPS_RS4_BE 10	/* MIPS R4000 big-endian */#define EM_PARISC      15	/* HPPA */#define EM_SPARC32PLUS 18	/* Sun's "v8plus" */#define EM_PPC	       20	/* PowerPC */#define EM_PPC64       21       /* PowerPC64 */#define EM_ARM		40		/* ARM */#define EM_SH	       42	/* SuperH */#define EM_SPARCV9     43	/* SPARC v9 64-bit */#define EM_IA_64	50	/* HP/Intel IA-64 */#define EM_X86_64	62	/* AMD x86-64 */#define EM_S390		22	/* IBM S/390 */#define EM_CRIS         76      /* Axis Communications 32-bit embedded processor */#define EM_V850		87	/* NEC v850 */#define EM_H8_300H      47      /* Hitachi H8/300H */#define EM_H8S          48      /* Hitachi H8S     *//* * This is an interim value that we will use until the committee comes * up with a final number. */#define EM_ALPHA	0x9026/* Bogus old v850 magic number, used by old tools.  */#define EM_CYGNUS_V850	0x9080/* * This is the old interim value for S/390 architecture */#define EM_S390_OLD     0xA390/* This is the info that is needed to parse the dynamic section of the file */#define DT_NULL		0#define DT_NEEDED	1#define DT_PLTRELSZ	2#define DT_PLTGOT	3#define DT_HASH		4#define DT_STRTAB	5#define DT_SYMTAB	6#define DT_RELA		7#define DT_RELASZ	8#define DT_RELAENT	9#define DT_STRSZ	10#define DT_SYMENT	11#define DT_INIT		12#define DT_FINI		13#define DT_SONAME	14#define DT_RPATH 	15#define DT_SYMBOLIC	16#define DT_REL	        17#define DT_RELSZ	18#define DT_RELENT	19#define DT_PLTREL	20#define DT_DEBUG	21#define DT_TEXTREL	22#define DT_JMPREL	23#define DT_LOPROC	0x70000000#define DT_HIPROC	0x7fffffff#define DT_MIPS_RLD_VERSION	0x70000001#define DT_MIPS_TIME_STAMP	0x70000002#define DT_MIPS_ICHECKSUM	0x70000003#define DT_MIPS_IVERSION	0x70000004#define DT_MIPS_FLAGS		0x70000005  #define RHF_NONE		  0  #define RHF_HARDWAY		  1  #define RHF_NOTPOT		  2#define DT_MIPS_BASE_ADDRESS	0x70000006#define DT_MIPS_CONFLICT	0x70000008#define DT_MIPS_LIBLIST		0x70000009#define DT_MIPS_LOCAL_GOTNO	0x7000000a#define DT_MIPS_CONFLICTNO	0x7000000b#define DT_MIPS_LIBLISTNO	0x70000010#define DT_MIPS_SYMTABNO	0x70000011#define DT_MIPS_UNREFEXTNO	0x70000012#define DT_MIPS_GOTSYM		0x70000013#define DT_MIPS_HIPAGENO	0x70000014#define DT_MIPS_RLD_MAP		0x70000016/* This info is needed when parsing the symbol table */#define STB_LOCAL  0#define STB_GLOBAL 1#define STB_WEAK   2#define STT_NOTYPE  0#define STT_OBJECT  1#define STT_FUNC    2#define STT_SECTION 3#define STT_FILE    4#define ELF_ST_BIND(x)		((x) >> 4)#define ELF_ST_TYPE(x)		(((unsigned int) x) & 0xf)#define ELF32_ST_BIND(x)	ELF_ST_BIND(x)#define ELF32_ST_TYPE(x)	ELF_ST_TYPE(x)#define ELF64_ST_BIND(x)	ELF_ST_BIND(x)#define ELF64_ST_TYPE(x)	ELF_ST_TYPE(x)/* Symbolic values for the entries in the auxiliary table   put on the initial stack */#define AT_NULL   0	/* end of vector */#define AT_IGNORE 1	/* entry should be ignored */#define AT_EXECFD 2	/* file descriptor of program */#define AT_PHDR   3	/* program headers for program */#define AT_PHENT  4	/* size of program header entry */#define AT_PHNUM  5	/* number of program headers */#define AT_PAGESZ 6	/* system page size */#define AT_BASE   7	/* base address of interpreter */#define AT_FLAGS  8	/* flags */#define AT_ENTRY  9	/* entry point of program */#define AT_NOTELF 10	/* program is not ELF */#define AT_UID    11	/* real uid */#define AT_EUID   12	/* effective uid */#define AT_GID    13	/* real gid */#define AT_EGID   14	/* effective gid */#define AT_PLATFORM 15  /* string identifying CPU for optimizations */#define AT_HWCAP  16    /* arch dependent hints at CPU capabilities */#define AT_CLKTCK 17	/* frequency at which times() increments */typedef struct dynamic{  Elf32_Sword d_tag;  union{    Elf32_Sword	d_val;    Elf32_Addr	d_ptr;  } d_un;} Elf32_Dyn;typedef struct {  Elf64_Sxword d_tag;		/* entry tag value */  union {    Elf64_Xword d_val;    Elf64_Addr d_ptr;  } d_un;} Elf64_Dyn;/* The following are used with relocations */#define ELF32_R_SYM(x) ((x) >> 8)#define ELF32_R_TYPE(x) ((x) & 0xff)#define ELF64_R_SYM(i)			((i) >> 32)#define ELF64_R_TYPE(i)			((i) & 0xffffffff)#define R_386_NONE	0#define R_386_32	1#define R_386_PC32	2#define R_386_GOT32	3#define R_386_PLT32	4#define R_386_COPY	5#define R_386_GLOB_DAT	6#define R_386_JMP_SLOT	7#define R_386_RELATIVE	8#define R_386_GOTOFF	9#define R_386_GOTPC	10#define R_386_NUM	11#define R_MIPS_NONE		0#define R_MIPS_16		1#define R_MIPS_32		2#define R_MIPS_REL32		3#define R_MIPS_26		4#define R_MIPS_HI16		5#define R_MIPS_LO16		6#define R_MIPS_GPREL16		7#define R_MIPS_LITERAL		8#define R_MIPS_GOT16		9#define R_MIPS_PC16		10#define R_MIPS_CALL16		11#define R_MIPS_GPREL32		12/* The remaining relocs are defined on Irix, although they are not   in the MIPS ELF ABI.  */#define R_MIPS_UNUSED1		13#define R_MIPS_UNUSED2		14#define R_MIPS_UNUSED3		15#define R_MIPS_SHIFT5		16#define R_MIPS_SHIFT6		17#define R_MIPS_64		18#define R_MIPS_GOT_DISP		19#define R_MIPS_GOT_PAGE		20#define R_MIPS_GOT_OFST		21/* * The following two relocation types are specified in the MIPS ABI * conformance guide version 1.2 but not yet in the psABI. */#define R_MIPS_GOTHI16		22#define R_MIPS_GOTLO16		23#define R_MIPS_SUB		24#define R_MIPS_INSERT_A		25#define R_MIPS_INSERT_B		26#define R_MIPS_DELETE		27#define R_MIPS_HIGHER		28#define R_MIPS_HIGHEST		29/* * The following two relocation types are specified in the MIPS ABI * conformance guide version 1.2 but not yet in the psABI. */#define R_MIPS_CALLHI16		30#define R_MIPS_CALLLO16		31/* * This range is reserved for vendor specific relocations. */#define R_MIPS_LOVENDOR		100#define R_MIPS_HIVENDOR		127/* * Sparc ELF relocation types */#define	R_SPARC_NONE		0#define	R_SPARC_8		1#define	R_SPARC_16		2#define	R_SPARC_32		3#define	R_SPARC_DISP8		4#define	R_SPARC_DISP16		5#define	R_SPARC_DISP32		6#define	R_SPARC_WDISP30		7#define	R_SPARC_WDISP22		8#define	R_SPARC_HI22		9#define	R_SPARC_22		10#define	R_SPARC_13		11#define	R_SPARC_LO10		12#define	R_SPARC_GOT10		13#define	R_SPARC_GOT13		14#define	R_SPARC_GOT22		15#define	R_SPARC_PC10		16#define	R_SPARC_PC22		17#define	R_SPARC_WPLT30		18#define	R_SPARC_COPY		19#define	R_SPARC_GLOB_DAT	20#define	R_SPARC_JMP_SLOT	21#define	R_SPARC_RELATIVE	22#define	R_SPARC_UA32		23#define R_SPARC_PLT32		24#define R_SPARC_HIPLT22		25#define R_SPARC_LOPLT10		26#define R_SPARC_PCPLT32		27#define R_SPARC_PCPLT22		28#define R_SPARC_PCPLT10		29#define R_SPARC_10		30#define R_SPARC_11		31#define R_SPARC_64		32#define R_SPARC_WDISP16		40#define R_SPARC_WDISP19		41#define R_SPARC_7		43#define R_SPARC_5		44#define R_SPARC_6		45/* Bits present in AT_HWCAP, primarily for Sparc32.  */#define HWCAP_SPARC_FLUSH       1    /* CPU supports flush instruction. */#define HWCAP_SPARC_STBAR       2#define HWCAP_SPARC_SWAP        4#define HWCAP_SPARC_MULDIV      8#define HWCAP_SPARC_V9		16#define HWCAP_SPARC_ULTRA3	32/* * 68k ELF relocation types */#define R_68K_NONE	0#define R_68K_32	1#define R_68K_16	2#define R_68K_8		3#define R_68K_PC32	4#define R_68K_PC16	5#define R_68K_PC8	6#define R_68K_GOT32	7#define R_68K_GOT16	8#define R_68K_GOT8	9#define R_68K_GOT32O	10#define R_68K_GOT16O	11#define R_68K_GOT8O	12#define R_68K_PLT32	13#define R_68K_PLT16	14#define R_68K_PLT8	15#define R_68K_PLT32O	16#define R_68K_PLT16O	17#define R_68K_PLT8O	18#define R_68K_COPY	19#define R_68K_GLOB_DAT	20#define R_68K_JMP_SLOT	21#define R_68K_RELATIVE	22/* * Alpha ELF relocation types */#define R_ALPHA_NONE            0       /* No reloc */#define R_ALPHA_REFLONG         1       /* Direct 32 bit */#define R_ALPHA_REFQUAD         2       /* Direct 64 bit */#define R_ALPHA_GPREL32         3       /* GP relative 32 bit */#define R_ALPHA_LITERAL         4       /* GP relative 16 bit w/optimization */#define R_ALPHA_LITUSE          5       /* Optimization hint for LITERAL */#define R_ALPHA_GPDISP          6       /* Add displacement to GP */#define R_ALPHA_BRADDR          7       /* PC+4 relative 23 bit shifted */#define R_ALPHA_HINT            8       /* PC+4 relative 16 bit shifted */#define R_ALPHA_SREL16          9       /* PC relative 16 bit */#define R_ALPHA_SREL32          10      /* PC relative 32 bit */#define R_ALPHA_SREL64          11      /* PC relative 64 bit */#define R_ALPHA_GPRELHIGH       17      /* GP relative 32 bit, high 16 bits */#define R_ALPHA_GPRELLOW        18      /* GP relative 32 bit, low 16 bits */

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -