Code: Select all
typedef struct {
// 0, 0, 1, 1 ?
unsigned char c1, c2, c3, c4;
// 28 bytes of module name, packed with 0's.
char name[28];
unsigned long gp; /* ptr to MIPS GOT data */
unsigned long libent; /* ptr to .lib.ent section */
unsigned long libentend; /* ptr to end of .lib.ent section */
unsigned long libstub; /* ptr to .lib.stub section */
unsigned long libstubend; /* ptr to end of .lib.stub section */
} __attribute__((packed)) PspModuleInfo;
// this struct seems to appear as the data in
// the .lib.ent section, and is referenced by
// the module info
typedef struct {
unsigned long l1; // 0x00000000 ?
unsigned long l2; // 0x80000000, most likely flags ?
unsigned long l3; // 0x00010104, maybe 2 shorts? one is a version?
// addr of start of .rodata.sceResident, which has 4
// longs (and one 0 long) before module name strings start,
// which includes things like a ptr to _start (see PspResidentData struct)
unsigned long sceResidentAddr;
} PspLibEntData;
// this struct is pointed to by PspLibEntData, and appears at the
// start of .rodata.sceResident. Each entry in .rodata.sceResident
// has a null long in between it, with the module strings (used in
// LibStubEntry) being padded to 4-byte alignment, and always
// including a terminating 0.
typedef struct {
unsigned long l1; // unknown 0xd632acdb
unsigned long l2; // unknown 0xf01d73a7
unsigned long startAddress; // address of _start
unsigned long moduleInfoAddr; // address of sceModuleInfo struct
} PspResidentData;
typedef struct {
// pointer to module name (will be in .rodata.sceResident section)
unsigned long moduleNameSymbol;
// mod version??
unsigned short version;
unsigned short val1;
unsigned char val2; // 0x5
unsigned char val3;
// number of function symbols
unsigned short numFuncs;
// each symbol has an associated nid; nidData is a pointer
// (in .rodata.sceNid section) to an array of longs, one
// for each function, which identifies the function whose
// address is to be inserted.
//
// The hash is the first 4 bytes of a SHA-1 hash of the function
// name. (Represented as a little-endian long, so the order
// of the bytes is reversed.)
unsigned long nidData;
// the address of the function stubs where the function address jumps
// should be filled in
unsigned long firstSymAddr;
} __attribute__((packed)) PspLibStubEntry;
That's all i've got so far; I'm curious what happens if someone with a 1.0 psp makes those 2 magic longs 0 in the PspResidentData...