pspsdk-1.0+beta2
|
#include <stdio.h>
#include <getopt.h>
#include <string.h>
#include <stdlib.h>
#include <unistd.h>
#include <assert.h>
#include <ctype.h>
#include <errno.h>
#include "types.h"
#include "elftypes.h"
#include "prxtypes.h"
#include "sha1.h"
Data Structures | |
struct | NidMap |
struct | ImportMap |
Macros | |
#define | PRX_LIBSTUB_SECT ".lib.stub" |
#define | PRX_STUBTEXT_SECT ".sceStub.text" |
#define | PRX_NID_SECT ".rodata.sceNid" |
#define | MAX_MAPNIDS 1024 |
#define | MIPS_JR_31 0x03e00008 |
#define | MIPS_NOP 0x0 |
Functions | |
int | process_args (int argc, char **argv) |
void | print_help (void) |
const unsigned char * | find_data (unsigned int iAddr) |
struct ImportMap * | find_map_by_name (const char *name) |
unsigned char * | load_file (const char *file, unsigned int *size) |
int | validate_header (unsigned char *data) |
int | load_sections (unsigned char *data) |
int | load_elf (const char *elf) |
void | free_data (void) |
void | strip_wsp (char *str) |
int | load_mapfile (const char *mapfile) |
int | fixup_imports (void) |
int | fixup_nidmap (void) |
int | main (int argc, char **argv) |
#define MAX_MAPNIDS 1024 |
Referenced by load_mapfile().
#define MIPS_JR_31 0x03e00008 |
Referenced by fixup_imports().
#define MIPS_NOP 0x0 |
Referenced by fixup_imports().
#define PRX_LIBSTUB_SECT ".lib.stub" |
Referenced by load_sections().
#define PRX_NID_SECT ".rodata.sceNid" |
Referenced by load_sections().
#define PRX_STUBTEXT_SECT ".sceStub.text" |
Referenced by load_sections().
const unsigned char* find_data | ( | unsigned int | iAddr | ) |
References i, ElfSection::iAddr, ElfHeader::iShnum, iSize, NULL, and ElfSection::pData.
Referenced by fixup_nidmap().
|
read |
References ImportMap::name, ImportMap::next, and strcmp().
Referenced by fixup_nidmap().
int fixup_imports | ( | void | ) |
References count, PspModuleImport::entry_size, PspModuleImport::flags, fprintf(), PspModuleImport::func_count, PspModuleImport::funcs, ElfSection::iAddr, ElfSection::iSize, LH, LW, MIPS_JR_31, MIPS_NOP, PspModuleImport::name, PspModuleImport::nids, NULL, ElfSection::pData, SH, stderr, SW, and PspModuleImport::var_count.
Referenced by main().
int fixup_nidmap | ( | void | ) |
References count, ImportMap::count, find_data(), find_map_by_name(), fprintf(), PspModuleImport::func_count, i, ElfSection::iSize, LH, LW, PspModuleImport::name, NidMap::newnid, ImportMap::nids, PspModuleImport::nids, NidMap::oldnid, ElfSection::pData, size, stderr, and PspModuleImport::var_count.
Referenced by main().
int load_elf | ( | const char * | elf | ) |
References load_file(), load_sections(), NULL, and validate_header().
Referenced by main().
unsigned char* load_file | ( | const char * | file, |
unsigned int * | size | ||
) |
int load_mapfile | ( | const char * | mapfile | ) |
References ImportMap::count, endp, fclose(), fgets(), fopen(), fp, fprintf(), malloc(), MAX_MAPNIDS, memset(), ImportMap::name, NidMap::newnid, ImportMap::next, ImportMap::nids, NULL, NidMap::oldnid, printf(), sha1(), SHA1_DIGEST_SIZE, stderr, strchr(), strip_wsp(), strncpy(), and strtoul().
Referenced by main().
int load_sections | ( | unsigned char * | data | ) |
References ElfSection::blOutput, fprintf(), i, ElfSection::iAddr, ElfSection::iAddralign, ElfSection::iEntsize, ElfSection::iFlags, ElfSection::iIndex, ElfSection::iInfo, ElfSection::iLink, ElfSection::iName, ElfSection::iOffset, ElfHeader::iShentsize, ElfHeader::iShnum, ElfHeader::iShoff, ElfHeader::iShstrndx, ElfSection::iSize, iSize, ElfSection::iType, LW, malloc(), memset(), NULL, ElfSection::pData, ElfSection::pRef, PRX_LIBSTUB_SECT, PRX_NID_SECT, PRX_STUBTEXT_SECT, PSP_MODULE_INFO_NAME, SHF_ALLOC, SHT_PRXRELOC, SHT_REL, stderr, strcmp(), strcpy(), and ElfSection::szName.
Referenced by load_elf().
int main | ( | int | argc, |
char ** | argv | ||
) |
References fclose(), fixup_imports(), fixup_nidmap(), fopen(), fp, fprintf(), free_data(), fwrite(), load_elf(), load_mapfile(), NULL, print_help(), process_args(), and stderr.
int process_args | ( | int | argc, |
char ** | argv | ||
) |
void strip_wsp | ( | char * | str | ) |
References isspace(), memmove(), and strlen().
Referenced by load_mapfile().
int validate_header | ( | unsigned char * | data | ) |
References ELF_EXEC_TYPE, ELF_MACHINE_MIPS, ELF_MAGIC, ELF_PRX_TYPE, fprintf(), ElfHeader::iClass, ElfHeader::iData, ElfHeader::iEhsize, ElfHeader::iEntry, ElfHeader::iFlags, ElfHeader::iIdver, ElfHeader::iMachine, ElfHeader::iMagic, ElfHeader::iPhentsize, ElfHeader::iPhnum, ElfHeader::iPhoff, ElfHeader::iShentsize, ElfHeader::iShnum, ElfHeader::iShoff, ElfHeader::iShstrndx, ElfHeader::iType, ElfHeader::iVersion, LH, LW, and stderr.
Referenced by load_elf().