PS2SDK
PS2 Homebrew Libraries
Loading...
Searching...
No Matches
ELF.h
1#ifndef __ELF_H__
2#define __ELF_H__
3
4#include <stdint.h>
5
6/* ELF-loading stuff */
7#define ELF_MAGIC 0x464c457f
8#define ELF_TYPE_IRX 0xFF80 /* SCE IOP Relocatable eXcutable file version 1.0 */
9#define ELF_TYPE_ERX2 0xFF91 /* SCE EE Relocatable eXcutable file version 2.0 */
10#define ELF_PT_LOAD 1
11
12/*------------------------------*/
13typedef struct
14{
15 uint8_t ident[16]; /* Structure of a ELF header */
16 uint16_t type;
17 uint16_t machine;
18 uint32_t version;
19 uint32_t entry;
20 uint32_t phoff;
21 uint32_t shoff;
22 uint32_t flags;
23 uint16_t ehsize;
24 uint16_t phentsize;
25 uint16_t phnum;
26 uint16_t shentsize;
27 uint16_t shnum;
28 uint16_t shstrndx;
30/*------------------------------*/
31typedef struct
32{
33 uint32_t type; /* Structure of a header a sections in an ELF */
34 uint32_t offset;
35 void *vaddr;
36 uint32_t paddr;
37 uint32_t filesz;
38 uint32_t memsz;
39 uint32_t flags;
40 uint32_t align;
42
43typedef struct
44{
45 uint32_t name;
46 uint32_t type;
47 uint32_t flags;
48 uint32_t addr;
49 uint32_t offset;
50 uint32_t size;
51 uint32_t link;
52 uint32_t info;
53 uint32_t addralign;
54 uint32_t entsize;
56
57typedef struct
58{
59 uint32_t offset;
60 uint32_t info;
61} elf_rel;
62
63typedef struct
64{
65 uint32_t offset;
66 uint32_t info;
67 uint32_t addend;
68} elf_rela;
69
70enum ELF_SHT_types {
71 SHT_NULL = 0,
72 SHT_PROGBITS,
73 SHT_SYMTAB,
74 SHT_STRTAB,
75 SHT_RELA,
76 SHT_HASH,
77 SHT_DYNAMIC,
78 SHT_NOTE,
79 SHT_NOBITS,
80 SHT_REL,
81 SHT_SHLIB,
82 SHT_DYNSYM
83};
84
85typedef struct iopmod_struct
86{
87 uint32_t moduleinfo;
88 uint32_t entry;
89 uint32_t gp_value;
90 uint32_t text_size;
91 uint32_t data_size;
92 uint32_t bss_size;
93 uint16_t version;
94 char modname[];
95} iopmod_t;
96
97typedef struct eemod_struct
98{
99 uint32_t moduleinfo;
100 uint32_t entry;
101 uint32_t gp_value;
102 uint32_t text_size;
103 uint32_t data_size;
104 uint32_t bss_size;
105 uint32_t ERX_lib_addr;
106 uint32_t ERX_lib_size;
107 uint32_t ERX_stub_addr;
108 uint32_t ERX_stub_size;
109 uint16_t version;
110 char modname[];
111} eemod_t;
112
113#define SHT_LOPROC 0x70000000
114#define SHT_LOPROC_IOPMOD_TAB 0x80
115#define SHT_LOPROC_EEMOD_TAB 0x90
116#define SHT_HIPROC 0x7fffffff
117#define SHT_LOUSER 0x80000000
118#define SHT_HIUSER 0xffffffff
119
120#define SHF_WRITE 0x1
121#define SHF_ALLOC 0x2
122#define SHF_EXECINSTR 0x4
123#define SHF_MASKPROC 0xf0000000
124
125#endif /* __ELF_H__ */
unsigned int version
Definition fileXio.h:3