2001-09-11 01:13:15 +00:00
|
|
|
/* $FreeBSD$ */
|
|
|
|
|
|
|
|
#ifndef _EF_H_
|
|
|
|
#define _EF_H_
|
|
|
|
|
|
|
|
#define EFT_KLD 1
|
|
|
|
#define EFT_KERNEL 2
|
|
|
|
|
|
|
|
typedef struct elf_file {
|
|
|
|
char* ef_name;
|
|
|
|
Elf_Phdr * ef_ph;
|
|
|
|
int ef_fd;
|
|
|
|
int ef_type;
|
|
|
|
Elf_Ehdr ef_hdr;
|
|
|
|
void* ef_fpage; /* First block of the file */
|
|
|
|
int ef_fplen; /* length of first block */
|
|
|
|
Elf_Dyn* ef_dyn; /* Symbol table etc. */
|
2002-04-11 09:30:15 +00:00
|
|
|
Elf_Hashelt ef_nbuckets;
|
|
|
|
Elf_Hashelt ef_nchains;
|
|
|
|
Elf_Hashelt* ef_buckets;
|
|
|
|
Elf_Hashelt* ef_chains;
|
|
|
|
Elf_Hashelt* ef_hashtab;
|
2001-09-11 01:13:15 +00:00
|
|
|
Elf_Off ef_stroff;
|
|
|
|
caddr_t ef_strtab;
|
|
|
|
int ef_strsz;
|
|
|
|
Elf_Off ef_symoff;
|
|
|
|
Elf_Sym* ef_symtab;
|
|
|
|
int ef_nsegs;
|
|
|
|
Elf_Phdr * ef_segs[2];
|
|
|
|
int ef_verbose;
|
2003-01-21 03:51:53 +00:00
|
|
|
Elf_Rel * ef_rel; /* relocation table */
|
|
|
|
int ef_relsz; /* number of entries */
|
|
|
|
Elf_Rela * ef_rela; /* relocation table */
|
|
|
|
int ef_relasz; /* number of entries */
|
2001-09-11 01:13:15 +00:00
|
|
|
} *elf_file_t;
|
|
|
|
|
|
|
|
__BEGIN_DECLS
|
|
|
|
int ef_open(const char *, elf_file_t, int);
|
|
|
|
int ef_close(elf_file_t ef);
|
|
|
|
int ef_read(elf_file_t ef, Elf_Off offset, size_t len, void* dest);
|
|
|
|
int ef_read_entry(elf_file_t ef, Elf_Off offset, size_t len, void **ptr);
|
2003-01-21 03:51:53 +00:00
|
|
|
int ef_reloc(elf_file_t ef, Elf_Off offset, size_t len, void *dest);
|
2001-09-11 01:13:15 +00:00
|
|
|
int ef_seg_read(elf_file_t ef, Elf_Off offset, size_t len, void *dest);
|
2003-01-21 03:51:53 +00:00
|
|
|
int ef_seg_read_rel(elf_file_t ef, Elf_Off offset, size_t len, void *dest);
|
2001-09-11 01:13:15 +00:00
|
|
|
int ef_seg_read_entry(elf_file_t ef, Elf_Off offset, size_t len, void**ptr);
|
2003-01-21 03:51:53 +00:00
|
|
|
int ef_seg_read_entry_rel(elf_file_t ef, Elf_Off offset, size_t len, void**ptr);
|
2001-09-11 01:13:15 +00:00
|
|
|
int ef_lookup_symbol(elf_file_t ef, const char* name, Elf_Sym** sym);
|
|
|
|
__END_DECLS
|
|
|
|
|
|
|
|
#endif /* _EF_H_*/
|