8 #define ELF_HEADER_IDENT 16
9 #define ELF_PRX_TYPE 0xFFA0
10 #define ELF_MACHINE_MIPS 8
11 #define ELF_VERSION_CURRENT 1
12 #define ELF_FLAGS_MACH_ALLEGREX 0x00A20000
13 #define ELF_FLAGS_ABI_EABI32 0x00003000
14 #define ELF_FLAGS_MIPS_ARCH2 0x10000000
17 /* Structure to hold prx header data */
20 uint8 ident
[ELF_HEADER_IDENT
];
38 struct elf_section
*sections
;
39 struct hashtable
*secbyname
;
41 struct elf_program
*programs
;
44 struct prx_reloc
*relocs
;
46 struct prx_modinfo
*modinfo
;
50 #define SHT_PROGBITS 1
53 #define SHT_LOPROC 0x70000000
54 #define SHT_HIPROC 0x7fffffff
55 #define SHT_LOUSER 0x80000000
56 #define SHT_HIUSER 0xffffffff
58 #define SHT_PRXRELOC (SHT_LOPROC | 0xA0)
62 #define SHF_EXECINSTR 4
64 /* Structure defining a single elf section */
85 #define PT_LOPROC 0x70000000
86 #define PT_HIPROC 0x7fffffff
87 #define PT_PRX (PT_LOPROC | 0xA1)
108 /* MIPS Reloc Entry Types */
109 #define R_MIPS_NONE 0
112 #define R_MIPS_REL32 3
114 #define R_MIPS_HI16 5
115 #define R_MIPS_LO16 6
116 #define R_MIPS_GPREL16 7
117 #define R_MIPS_LITERAL 8
118 #define R_MIPS_GOT16 9
119 #define R_MIPS_PC16 10
120 #define R_MIPS_CALL16 11
121 #define R_MIPS_GPREL32 12
146 struct prx_import
*imports
;
147 struct prx_export
*exports
;
163 struct prx_function
*funcs
;
164 struct prx_variable
*vars
;
178 struct prx_function
*funcs
;
179 struct prx_variable
*vars
;
184 struct prx_function
{
190 struct prx_variable
{
198 struct prx
*prx_load (const char *path
);
199 void prx_free (struct prx
*p
);
200 void prx_print (struct prx
*p
);
201 void prx_resolve_nids (struct prx
*p
, struct nidstable
*nids
);
202 uint32
prx_translate (struct prx
*p
, uint32 vaddr
);