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

📄 exec_elf.h

📁 微内核软实时操作系统
💻 H
📖 第 1 页 / 共 2 页
字号:
#define STB_NUM		3		/* number of symbol bindings */#define STB_LOPROC	13		/* reserved range for processor */#define STB_HIPROC	15		/*  specific symbol bindings *//* Symbol type - ELF32_ST_TYPE - st_info */#define STT_NOTYPE	0		/* not specified */#define STT_OBJECT	1		/* data object */#define STT_FUNC	2		/* function */#define STT_SECTION	3		/* section */#define STT_FILE	4		/* file */#define STT_NUM		5		/* number of symbol types */#define STT_LOPROC	13		/* reserved range for processor */#define STT_HIPROC	15		/*  specific symbol types *//* Relocation entry with implicit addend */typedef struct {	Elf32_Addr	r_offset;	/* offset of relocation */	Elf32_Word	r_info;		/* symbol table index and type */} Elf32_Rel;/* Relocation entry with explicit addend */typedef struct {	Elf32_Addr	r_offset;	/* offset of relocation */	Elf32_Word	r_info;		/* symbol table index and type */	Elf32_Sword	r_addend;} Elf32_Rela;/* Extract relocation info - r_info */#define ELF32_R_SYM(i)		((i) >> 8)#define ELF32_R_TYPE(i)		((unsigned char) (i))#define ELF32_R_INFO(s,t) 	(((s) << 8) + (unsigned char)(t))typedef struct {	Elf64_Xword	r_offset;	/* where to do it */	Elf64_Xword	r_info;		/* index & type of relocation */} Elf64_Rel;typedef struct {	Elf64_Xword	r_offset;	/* where to do it */	Elf64_Xword	r_info;		/* index & type of relocation */	Elf64_Sxword	r_addend;	/* adjustment value */} Elf64_Rela;#define	ELF64_R_SYM(info)	((info) >> 32)#define	ELF64_R_TYPE(info)	((info) & 0xFFFFFFFF)#define ELF64_R_INFO(s,t) 	(((s) << 32) + (uint32_t)(t))/* Program Header */typedef struct {	Elf32_Word	p_type;		/* segment type */	Elf32_Off	p_offset;	/* segment offset */	Elf32_Addr	p_vaddr;	/* virtual address of segment */	Elf32_Addr	p_paddr;	/* physical address - ignored? */	Elf32_Word	p_filesz;	/* number of bytes in file for seg. */	Elf32_Word	p_memsz;	/* number of bytes in mem. for seg. */	Elf32_Word	p_flags;	/* flags */	Elf32_Word	p_align;	/* memory alignment */} Elf32_Phdr;typedef struct {	Elf64_Half	p_type;		/* entry type */	Elf64_Half	p_flags;	/* flags */	Elf64_Off	p_offset;	/* offset */	Elf64_Addr	p_vaddr;	/* virtual address */	Elf64_Addr	p_paddr;	/* physical address */	Elf64_Xword	p_filesz;	/* file size */	Elf64_Xword	p_memsz;	/* memory size */	Elf64_Xword	p_align;	/* memory & file alignment */} Elf64_Phdr;/* Segment types - p_type */#define PT_NULL		0		/* unused */#define PT_LOAD		1		/* loadable segment */#define PT_DYNAMIC	2		/* dynamic linking section */#define PT_INTERP	3		/* the RTLD */#define PT_NOTE		4		/* auxiliary information */#define PT_SHLIB	5		/* reserved - purpose undefined */#define PT_PHDR		6		/* program header */#define PT_NUM		7		/* Number of segment types */#define PT_LOPROC	0x70000000	/* reserved range for processor */#define PT_HIPROC	0x7fffffff	/*  specific segment types *//* Segment flags - p_flags */#define PF_X		0x1		/* Executable */#define PF_W		0x2		/* Writable */#define PF_R		0x4		/* Readable */#define PF_MASKPROC	0xf0000000	/* reserved bits for processor */					/*  specific segment flags *//* Dynamic structure */typedef struct {	Elf32_Sword	d_tag;		/* controls meaning of d_val */	union {		Elf32_Word	d_val;	/* Multiple meanings - see d_tag */		Elf32_Addr	d_ptr;	/* program virtual address */	} d_un;} Elf32_Dyn;typedef struct {	Elf64_Xword	d_tag;		/* controls meaning of d_val */	union {		Elf64_Addr	d_ptr;		Elf64_Xword	d_val;	} d_un;} Elf64_Dyn;/* Dynamic Array Tags - d_tag */#define DT_NULL		0		/* marks end of _DYNAMIC array */#define DT_NEEDED	1		/* string table offset of needed lib */#define DT_PLTRELSZ	2		/* size of relocation entries in PLT */#define DT_PLTGOT	3		/* address PLT/GOT */#define DT_HASH		4		/* address of symbol hash table */#define DT_STRTAB	5		/* address of string table */#define DT_SYMTAB	6		/* address of symbol table */#define DT_RELA		7		/* address of relocation table */#define DT_RELASZ	8		/* size of relocation table */#define DT_RELAENT	9		/* size of relocation entry */#define DT_STRSZ	10		/* size of string table */#define DT_SYMENT	11		/* size of symbol table entry */#define DT_INIT		12		/* address of initialization func. */#define DT_FINI		13		/* address of termination function */#define DT_SONAME	14		/* string table offset of shared obj */#define DT_RPATH	15		/* string table offset of library					   search path */#define DT_SYMBOLIC	16		/* start sym search in shared obj. */#define DT_REL		17		/* address of rel. tbl. w addends */#define DT_RELSZ	18		/* size of DT_REL relocation table */#define DT_RELENT	19		/* size of DT_REL relocation entry */#define DT_PLTREL	20		/* PLT referenced relocation entry */#define DT_DEBUG	21		/* bugger */#define DT_TEXTREL	22		/* Allow rel. mod. to unwritable seg */#define DT_JMPREL	23		/* add. of PLT's relocation entries */#define DT_BIND_NOW	24		/* Bind now regardless of env setting */#define DT_NUM		25		/* Number used. */#define DT_LOPROC	0x70000000	/* reserved range for processor */#define DT_HIPROC	0x7fffffff	/*  specific dynamic array tags */	/* Standard ELF hashing function */unsigned int elf_hash(const unsigned char *name);/* * Note Definitions */typedef struct {	Elf32_Word namesz;	Elf32_Word descsz;	Elf32_Word type;} Elf32_Note;typedef struct {	Elf64_Half namesz;	Elf64_Half descsz;	Elf64_Half type;} Elf64_Note;/* * XXX - these _KERNEL items aren't part of the ABI! */#if defined(_KERNEL) || defined(_DYN_LOADER)#define ELF32_NO_ADDR	((u_long) ~0)	/* Indicates addr. not yet filled in */#define ELF_AUX_ENTRIES	8		/* Size of aux array passed to loader */typedef struct {	Elf32_Sword	au_id;				/* 32-bit id */	Elf32_Word	au_v;				/* 32-bit value */} Aux32Info;#define ELF64_NO_ADDR	((uint64_t) ~0)/* Indicates addr. not yet filled in */#define ELF64_AUX_ENTRIES	8	/* Size of aux array passed to loader */typedef struct {	Elf64_Shalf	au_id;				/* 32-bit id */	Elf64_Xword	au_v;				/* 64-bit id */} Aux64Info;enum AuxID {	AUX_null = 0,	AUX_ignore = 1,	AUX_execfd = 2,	AUX_phdr = 3,			/* &phdr[0] */	AUX_phent = 4,			/* sizeof(phdr[0]) */	AUX_phnum = 5,			/* # phdr entries */	AUX_pagesz = 6,			/* PAGESIZE */	AUX_base = 7,			/* ld.so base addr */	AUX_flags = 8,			/* processor flags */	AUX_entry = 9,			/* a.out entry */	AUX_sun_uid = 2000,		/* euid */	AUX_sun_ruid = 2001,		/* ruid */	AUX_sun_gid = 2002,		/* egid */	AUX_sun_rgid = 2003		/* rgid */};struct elf_args {        u_long  arg_entry;		/* program entry point */        u_long  arg_interp;		/* Interpreter load address */        u_long  arg_phaddr;		/* program header address */        u_long  arg_phentsize;		/* Size of program header */        u_long  arg_phnum;		/* Number of program headers */        u_long  arg_os;			/* OS tag */};#endif#if !defined(ELFSIZE) && defined(ARCH_ELFSIZE)#define ELFSIZE ARCH_ELFSIZE#endif#if defined(ELFSIZE)#define CONCAT(x,y)	__CONCAT(x,y)#define ELFNAME(x)	CONCAT(elf,CONCAT(ELFSIZE,CONCAT(_,x)))#define ELFNAME2(x,y)	CONCAT(x,CONCAT(_elf,CONCAT(ELFSIZE,CONCAT(_,y))))#define ELFNAMEEND(x)	CONCAT(x,CONCAT(_elf,ELFSIZE))#define ELFDEFNNAME(x)	CONCAT(ELF,CONCAT(ELFSIZE,CONCAT(_,x)))#endif#if defined(ELFSIZE) && (ELFSIZE == 32)#define Elf_Ehdr	Elf32_Ehdr#define Elf_Phdr	Elf32_Phdr#define Elf_Shdr	Elf32_Shdr#define Elf_Sym		Elf32_Sym#define Elf_Rel		Elf32_Rel#define Elf_RelA	Elf32_Rela#define Elf_Dyn		Elf32_Dyn#define Elf_Word	Elf32_Word#define Elf_Sword	Elf32_Sword#define Elf_Addr	Elf32_Addr#define Elf_Off		Elf32_Off#define Elf_Nhdr	Elf32_Nhdr#define Elf_Note	Elf32_Note#define ELF_R_SYM	ELF32_R_SYM#define ELF_R_TYPE	ELF32_R_TYPE#define ELF_R_INFO	ELF32_R_INFO#define ELFCLASS	ELFCLASS32#define ELF_ST_BIND	ELF32_ST_BIND#define ELF_ST_TYPE	ELF32_ST_TYPE#define ELF_ST_INFO	ELF32_ST_INFO#define AuxInfo		Aux32Info#elif defined(ELFSIZE) && (ELFSIZE == 64)#define Elf_Ehdr	Elf64_Ehdr#define Elf_Phdr	Elf64_Phdr#define Elf_Shdr	Elf64_Shdr#define Elf_Sym		Elf64_Sym#define Elf_Rel		Elf64_Rel#define Elf_RelA	Elf64_Rela#define Elf_Dyn		Elf64_Dyn#define Elf_Word	Elf64_Word#define Elf_Sword	Elf64_Sword#define Elf_Addr	Elf64_Addr#define Elf_Off		Elf64_Off#define Elf_Nhdr	Elf64_Nhdr#define Elf_Note	Elf64_Note#define ELF_R_SYM	ELF64_R_SYM#define ELF_R_TYPE	ELF64_R_TYPE#define ELF_R_INFO	ELF64_R_INFO#define ELFCLASS	ELFCLASS64#define ELF_ST_BIND	ELF64_ST_BIND#define ELF_ST_TYPE	ELF64_ST_TYPE#define ELF_ST_INFO	ELF64_ST_INFO#define AuxInfo		Aux64Info#endif#ifndef _KERNELextern Elf_Dyn		_DYNAMIC[];#endif#ifdef	_KERNEL#ifdef _KERN_DO_ELF64int exec_elf64_makecmds(struct proc *, struct exec_package *);void *elf64_copyargs(struct exec_package *, struct ps_strings *,        void *, void *);int exec_elf64_fixup(struct proc *, struct exec_package *);char *elf64_check_brand(Elf64_Ehdr *);int elf64_os_pt_note(struct proc *, struct exec_package *, Elf64_Ehdr *,	char *, size_t, size_t);#endif#ifdef _KERN_DO_ELFint exec_elf32_makecmds(struct proc *, struct exec_package *);void *elf32_copyargs(struct exec_package *, struct ps_strings *,        void *, void *);int exec_elf32_fixup(struct proc *, struct exec_package *);char *elf32_check_brand(Elf32_Ehdr *);int elf32_os_pt_note(struct proc *, struct exec_package *, Elf32_Ehdr *,	char *, size_t, size_t);#endif#endif /* _KERNEL */#define ELF_TARG_VER	1	/* The ver for which this code is intended */#endif /* _SYS_EXEC_ELF_H_ */

⌨️ 快捷键说明

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