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

📄 elf.h

📁 qemu虚拟机代码
💻 H
📖 第 1 页 / 共 3 页
字号:
/* Legal values for p_flags field of Elf32_Phdr/Elf64_Phdr.  */#define PF_PARISC_SBP		0x08000000#define PF_HP_PAGE_SIZE		0x00100000#define PF_HP_FAR_SHARED	0x00200000#define PF_HP_NEAR_SHARED	0x00400000#define PF_HP_CODE		0x01000000#define PF_HP_MODIFY		0x02000000#define PF_HP_LAZYSWAP		0x04000000#define PF_HP_SBP		0x08000000/* IA-64 specific declarations.  *//* Processor specific flags for the Ehdr e_flags field.  */#define EF_IA_64_MASKOS		0x0000000f	/* os-specific flags */#define EF_IA_64_ABI64		0x00000010	/* 64-bit ABI */#define EF_IA_64_ARCH		0xff000000	/* arch. version mask *//* Processor specific values for the Phdr p_type field.  */#define PT_IA_64_ARCHEXT	(PT_LOPROC + 0)	/* arch extension bits */#define PT_IA_64_UNWIND		(PT_LOPROC + 1)	/* ia64 unwind bits *//* Processor specific flags for the Phdr p_flags field.  */#define PF_IA_64_NORECOV	0x80000000	/* spec insns w/o recovery *//* Processor specific values for the Shdr sh_type field.  */#define SHT_IA_64_EXT		(SHT_LOPROC + 0) /* extension bits */#define SHT_IA_64_UNWIND	(SHT_LOPROC + 1) /* unwind bits *//* Processor specific flags for the Shdr sh_flags field.  */#define SHF_IA_64_SHORT		0x10000000	/* section near gp */#define SHF_IA_64_NORECOV	0x20000000	/* spec insns w/o recovery *//* Processor specific values for the Dyn d_tag field.  */#define DT_IA_64_PLT_RESERVE	(DT_LOPROC + 0)#define DT_IA_64_NUM		1/* IA-64 relocations.  */#define R_IA64_NONE		0x00	/* none */#define R_IA64_IMM14		0x21	/* symbol + addend, add imm14 */#define R_IA64_IMM22		0x22	/* symbol + addend, add imm22 */#define R_IA64_IMM64		0x23	/* symbol + addend, mov imm64 */#define R_IA64_DIR32MSB		0x24	/* symbol + addend, data4 MSB */#define R_IA64_DIR32LSB		0x25	/* symbol + addend, data4 LSB */#define R_IA64_DIR64MSB		0x26	/* symbol + addend, data8 MSB */#define R_IA64_DIR64LSB		0x27	/* symbol + addend, data8 LSB */#define R_IA64_GPREL22		0x2a	/* @gprel(sym + add), add imm22 */#define R_IA64_GPREL64I		0x2b	/* @gprel(sym + add), mov imm64 */#define R_IA64_GPREL32MSB	0x2c	/* @gprel(sym + add), data4 MSB */#define R_IA64_GPREL32LSB	0x2d	/* @gprel(sym + add), data4 LSB */#define R_IA64_GPREL64MSB	0x2e	/* @gprel(sym + add), data8 MSB */#define R_IA64_GPREL64LSB	0x2f	/* @gprel(sym + add), data8 LSB */#define R_IA64_LTOFF22		0x32	/* @ltoff(sym + add), add imm22 */#define R_IA64_LTOFF64I		0x33	/* @ltoff(sym + add), mov imm64 */#define R_IA64_PLTOFF22		0x3a	/* @pltoff(sym + add), add imm22 */#define R_IA64_PLTOFF64I	0x3b	/* @pltoff(sym + add), mov imm64 */#define R_IA64_PLTOFF64MSB	0x3e	/* @pltoff(sym + add), data8 MSB */#define R_IA64_PLTOFF64LSB	0x3f	/* @pltoff(sym + add), data8 LSB */#define R_IA64_FPTR64I		0x43	/* @fptr(sym + add), mov imm64 */#define R_IA64_FPTR32MSB	0x44	/* @fptr(sym + add), data4 MSB */#define R_IA64_FPTR32LSB	0x45	/* @fptr(sym + add), data4 LSB */#define R_IA64_FPTR64MSB	0x46	/* @fptr(sym + add), data8 MSB */#define R_IA64_FPTR64LSB	0x47	/* @fptr(sym + add), data8 LSB */#define R_IA64_PCREL60B		0x48	/* @pcrel(sym + add), brl */#define R_IA64_PCREL21B		0x49	/* @pcrel(sym + add), ptb, call */#define R_IA64_PCREL21M		0x4a	/* @pcrel(sym + add), chk.s */#define R_IA64_PCREL21F		0x4b	/* @pcrel(sym + add), fchkf */#define R_IA64_PCREL32MSB	0x4c	/* @pcrel(sym + add), data4 MSB */#define R_IA64_PCREL32LSB	0x4d	/* @pcrel(sym + add), data4 LSB */#define R_IA64_PCREL64MSB	0x4e	/* @pcrel(sym + add), data8 MSB */#define R_IA64_PCREL64LSB	0x4f	/* @pcrel(sym + add), data8 LSB */#define R_IA64_LTOFF_FPTR22	0x52	/* @ltoff(@fptr(s+a)), imm22 */#define R_IA64_LTOFF_FPTR64I	0x53	/* @ltoff(@fptr(s+a)), imm64 */#define R_IA64_LTOFF_FPTR32MSB	0x54	/* @ltoff(@fptr(s+a)), data4 MSB */#define R_IA64_LTOFF_FPTR32LSB	0x55	/* @ltoff(@fptr(s+a)), data4 LSB */#define R_IA64_LTOFF_FPTR64MSB	0x56	/* @ltoff(@fptr(s+a)), data8 MSB */#define R_IA64_LTOFF_FPTR64LSB	0x57	/* @ltoff(@fptr(s+a)), data8 LSB */#define R_IA64_SEGREL32MSB	0x5c	/* @segrel(sym + add), data4 MSB */#define R_IA64_SEGREL32LSB	0x5d	/* @segrel(sym + add), data4 LSB */#define R_IA64_SEGREL64MSB	0x5e	/* @segrel(sym + add), data8 MSB */#define R_IA64_SEGREL64LSB	0x5f	/* @segrel(sym + add), data8 LSB */#define R_IA64_SECREL32MSB	0x64	/* @secrel(sym + add), data4 MSB */#define R_IA64_SECREL32LSB	0x65	/* @secrel(sym + add), data4 LSB */#define R_IA64_SECREL64MSB	0x66	/* @secrel(sym + add), data8 MSB */#define R_IA64_SECREL64LSB	0x67	/* @secrel(sym + add), data8 LSB */#define R_IA64_REL32MSB		0x6c	/* data 4 + REL */#define R_IA64_REL32LSB		0x6d	/* data 4 + REL */#define R_IA64_REL64MSB		0x6e	/* data 8 + REL */#define R_IA64_REL64LSB		0x6f	/* data 8 + REL */#define R_IA64_LTV32MSB		0x74	/* symbol + addend, data4 MSB */#define R_IA64_LTV32LSB		0x75	/* symbol + addend, data4 LSB */#define R_IA64_LTV64MSB		0x76	/* symbol + addend, data8 MSB */#define R_IA64_LTV64LSB		0x77	/* symbol + addend, data8 LSB */#define R_IA64_PCREL21BI	0x79	/* @pcrel(sym + add), 21bit inst */#define R_IA64_PCREL22		0x7a	/* @pcrel(sym + add), 22bit inst */#define R_IA64_PCREL64I		0x7b	/* @pcrel(sym + add), 64bit inst */#define R_IA64_IPLTMSB		0x80	/* dynamic reloc, imported PLT, MSB */#define R_IA64_IPLTLSB		0x81	/* dynamic reloc, imported PLT, LSB */#define R_IA64_COPY		0x84	/* copy relocation */#define R_IA64_SUB		0x85	/* Addend and symbol difference */#define R_IA64_LTOFF22X		0x86	/* LTOFF22, relaxable.  */#define R_IA64_LDXMOV		0x87	/* Use of LTOFF22X.  */#define R_IA64_TPREL14		0x91	/* @tprel(sym + add), imm14 */#define R_IA64_TPREL22		0x92	/* @tprel(sym + add), imm22 */#define R_IA64_TPREL64I		0x93	/* @tprel(sym + add), imm64 */#define R_IA64_TPREL64MSB	0x96	/* @tprel(sym + add), data8 MSB */#define R_IA64_TPREL64LSB	0x97	/* @tprel(sym + add), data8 LSB */#define R_IA64_LTOFF_TPREL22	0x9a	/* @ltoff(@tprel(s+a)), imm2 */#define R_IA64_DTPMOD64MSB	0xa6	/* @dtpmod(sym + add), data8 MSB */#define R_IA64_DTPMOD64LSB	0xa7	/* @dtpmod(sym + add), data8 LSB */#define R_IA64_LTOFF_DTPMOD22	0xaa	/* @ltoff(@dtpmod(sym + add)), imm22 */#define R_IA64_DTPREL14		0xb1	/* @dtprel(sym + add), imm14 */#define R_IA64_DTPREL22		0xb2	/* @dtprel(sym + add), imm22 */#define R_IA64_DTPREL64I	0xb3	/* @dtprel(sym + add), imm64 */#define R_IA64_DTPREL32MSB	0xb4	/* @dtprel(sym + add), data4 MSB */#define R_IA64_DTPREL32LSB	0xb5	/* @dtprel(sym + add), data4 LSB */#define R_IA64_DTPREL64MSB	0xb6	/* @dtprel(sym + add), data8 MSB */#define R_IA64_DTPREL64LSB	0xb7	/* @dtprel(sym + add), data8 LSB */#define R_IA64_LTOFF_DTPREL22	0xba	/* @ltoff(@dtprel(s+a)), imm22 */typedef struct elf32_rel {  Elf32_Addr	r_offset;  Elf32_Word	r_info;} Elf32_Rel;typedef struct elf64_rel {  Elf64_Addr r_offset;	/* Location at which to apply the action */  Elf64_Xword r_info;	/* index and type of relocation */} Elf64_Rel;typedef struct elf32_rela{  Elf32_Addr	r_offset;  Elf32_Word	r_info;  Elf32_Sword	r_addend;} Elf32_Rela;typedef struct elf64_rela {  Elf64_Addr r_offset;	/* Location at which to apply the action */  Elf64_Xword r_info;	/* index and type of relocation */  Elf64_Sxword r_addend;	/* Constant addend used to compute value */} Elf64_Rela;typedef struct elf32_sym{  Elf32_Word	st_name;  Elf32_Addr	st_value;  Elf32_Word	st_size;  unsigned char	st_info;  unsigned char	st_other;  Elf32_Half	st_shndx;} Elf32_Sym;typedef struct elf64_sym {  Elf64_Word st_name;		/* Symbol name, index in string tbl */  unsigned char	st_info;	/* Type and binding attributes */  unsigned char	st_other;	/* No defined meaning, 0 */  Elf64_Half st_shndx;		/* Associated section index */  Elf64_Addr st_value;		/* Value of the symbol */  Elf64_Xword st_size;		/* Associated symbol size */} Elf64_Sym;#define EI_NIDENT	16typedef struct elf32_hdr{  unsigned char	e_ident[EI_NIDENT];  Elf32_Half	e_type;  Elf32_Half	e_machine;  Elf32_Word	e_version;  Elf32_Addr	e_entry;  /* Entry point */  Elf32_Off	e_phoff;  Elf32_Off	e_shoff;  Elf32_Word	e_flags;  Elf32_Half	e_ehsize;  Elf32_Half	e_phentsize;  Elf32_Half	e_phnum;  Elf32_Half	e_shentsize;  Elf32_Half	e_shnum;  Elf32_Half	e_shstrndx;} Elf32_Ehdr;typedef struct elf64_hdr {  unsigned char	e_ident[16];		/* ELF "magic number" */  Elf64_Half e_type;  Elf64_Half e_machine;  Elf64_Word e_version;  Elf64_Addr e_entry;		/* Entry point virtual address */  Elf64_Off e_phoff;		/* Program header table file offset */  Elf64_Off e_shoff;		/* Section header table file offset */  Elf64_Word e_flags;  Elf64_Half e_ehsize;  Elf64_Half e_phentsize;  Elf64_Half e_phnum;  Elf64_Half e_shentsize;  Elf64_Half e_shnum;  Elf64_Half e_shstrndx;} Elf64_Ehdr;/* These constants define the permissions on sections in the program   header, p_flags. */#define PF_R		0x4#define PF_W		0x2#define PF_X		0x1typedef struct elf32_phdr{  Elf32_Word	p_type;  Elf32_Off	p_offset;  Elf32_Addr	p_vaddr;  Elf32_Addr	p_paddr;  Elf32_Word	p_filesz;  Elf32_Word	p_memsz;  Elf32_Word	p_flags;  Elf32_Word	p_align;} Elf32_Phdr;typedef struct elf64_phdr {  Elf64_Word p_type;  Elf64_Word p_flags;  Elf64_Off p_offset;		/* Segment file offset */  Elf64_Addr p_vaddr;		/* Segment virtual address */  Elf64_Addr p_paddr;		/* Segment physical address */  Elf64_Xword p_filesz;		/* Segment size in file */  Elf64_Xword p_memsz;		/* Segment size in memory */  Elf64_Xword p_align;		/* Segment alignment, file & memory */} Elf64_Phdr;/* sh_type */#define SHT_NULL	0#define SHT_PROGBITS	1#define SHT_SYMTAB	2#define SHT_STRTAB	3#define SHT_RELA	4#define SHT_HASH	5#define SHT_DYNAMIC	6#define SHT_NOTE	7#define SHT_NOBITS	8#define SHT_REL		9#define SHT_SHLIB	10#define SHT_DYNSYM	11#define SHT_NUM		12#define SHT_LOPROC	0x70000000#define SHT_HIPROC	0x7fffffff#define SHT_LOUSER	0x80000000#define SHT_HIUSER	0xffffffff#define SHT_MIPS_LIST		0x70000000#define SHT_MIPS_CONFLICT	0x70000002#define SHT_MIPS_GPTAB		0x70000003#define SHT_MIPS_UCODE		0x70000004/* sh_flags */#define SHF_WRITE	0x1#define SHF_ALLOC	0x2#define SHF_EXECINSTR	0x4#define SHF_MASKPROC	0xf0000000#define SHF_MIPS_GPREL	0x10000000/* special section indexes */#define SHN_UNDEF	0#define SHN_LORESERVE	0xff00#define SHN_LOPROC	0xff00#define SHN_HIPROC	0xff1f#define SHN_ABS		0xfff1#define SHN_COMMON	0xfff2#define SHN_HIRESERVE	0xffff#define SHN_MIPS_ACCOMON	0xff00 typedef struct elf32_shdr {  Elf32_Word	sh_name;  Elf32_Word	sh_type;  Elf32_Word	sh_flags;  Elf32_Addr	sh_addr;  Elf32_Off	sh_offset;  Elf32_Word	sh_size;  Elf32_Word	sh_link;  Elf32_Word	sh_info;  Elf32_Word	sh_addralign;  Elf32_Word	sh_entsize;} Elf32_Shdr;typedef struct elf64_shdr {  Elf64_Word sh_name;		/* Section name, index in string tbl */  Elf64_Word sh_type;		/* Type of section */  Elf64_Xword sh_flags;		/* Miscellaneous section attributes */  Elf64_Addr sh_addr;		/* Section virtual addr at execution */  Elf64_Off sh_offset;		/* Section file offset */  Elf64_Xword sh_size;		/* Size of section in bytes */  Elf64_Word sh_link;		/* Index of another section */  Elf64_Word sh_info;		/* Additional section information */  Elf64_Xword sh_addralign;	/* Section alignment */  Elf64_Xword sh_entsize;	/* Entry size if section holds table */} Elf64_Shdr;#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_PAD		7#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/* Notes used in ET_CORE */#define NT_PRSTATUS	1#define NT_PRFPREG	2#define NT_PRPSINFO	3#define NT_TASKSTRUCT	4#define NT_PRXFPREG     0x46e62b7f      /* copied from gdb5.1/include/elf/common.h *//* Note header in a PT_NOTE section */typedef struct elf32_note {  Elf32_Word	n_namesz;	/* Name size */  Elf32_Word	n_descsz;	/* Content size */  Elf32_Word	n_type;		/* Content type */} Elf32_Nhdr;/* Note header in a PT_NOTE section */typedef struct elf64_note {  Elf64_Word n_namesz;	/* Name size */  Elf64_Word n_descsz;	/* Content size */  Elf64_Word n_type;	/* Content type */} Elf64_Nhdr;#if ELF_CLASS == ELFCLASS32#define elfhdr		elf32_hdr#define elf_phdr	elf32_phdr#define elf_note	elf32_note#define elf_shdr	elf32_shdr#define elf_sym		elf32_sym#ifdef ELF_USES_RELOCA# define ELF_RELOC      Elf32_Rela#else# define ELF_RELOC      Elf32_Rel#endif#else#define elfhdr		elf64_hdr#define elf_phdr	elf64_phdr#define elf_note	elf64_note#define elf_shdr	elf64_shdr#define elf_sym		elf64_sym#ifdef ELF_USES_RELOCA# define ELF_RELOC      Elf64_Rela#else# define ELF_RELOC      Elf64_Rel#endif#endif /* ELF_CLASS */#ifndef ElfW# if ELF_CLASS == ELFCLASS32#  define ElfW(x)  Elf32_ ## x#  define ELFW(x)  ELF32_ ## x# else#  define ElfW(x)  Elf64_ ## x#  define ELFW(x)  ELF64_ ## x# endif#endif#endif /* _QEMU_ELF_H */

⌨️ 快捷键说明

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