Jump to content
Setting up an AI agent? ReverseEngineering.wiki skill (works from the command line, no configuration): https://reverseengineering.wiki/skill/rewiki/SKILL.md · setup for every client, including MCP: https://reverseengineering.wiki/llms.txt · REWiki:Connect

Format:PRX (PSP module)

From ReverseEngineering.wiki
Format
Platforms Platform:PlayStation Portable
Magic 7F 45 4C 46 (ELF), e_type FFA0
Extensions .prx, .elf
Endianness little
On this wiki Facts · Code · Notes · Topics

Relocatable module of the PlayStation Portable (ELF32 little-endian MIPS Allegrex, e_type 0xFFA0) that carries a sceModuleInfo record in .rodata.sceModuleInfo, library export tables in .lib.ent and import tables in .lib.stub whose functions are identified by 32-bit NIDs; also the form of PSP game executables (EBOOT DATA.PSP).

Overview

PSP programs and system libraries are modules. The SDK links an ordinary MIPS ELF and psp-prxgen (or the fixup tools) turns it into a PRX: e_type 0xFFA0 (ELF_PRX_TYPE), a base address of 0, and relocations kept in sections of type 0x700000A0 (SHT_PRXRELOC) instead of plain SHT_REL. Applications use the same container (type 0xFFA0 for relocatable, plain executables use 2). Commercial modules are signed and encrypted in a ~PSP wrapper (magic 7E 50 53 50); this page covers the plain form.

sceModuleInfo

Placed in section .rodata.sceModuleInfo, 16-byte aligned (pspsdk PSP_MODULE_INFO macro, pspmoduleinfo.h):

Offset Size Field
0x00 2 attributes: 0 user, 0x0001 no stop, 0x0002 single load, 0x0004 single start, 0x1000 kernel
0x02 2 version: minor byte then major byte
0x04 27 module name, zero padded
0x1F 1 terminator (0)
0x20 4 gp value
0x24 4 export table start (__lib_ent_top)
0x28 4 export table end
0x2C 4 import (stub) table start (__lib_stub_top)
0x30 4 import table end

The structure is 0x34 bytes. The module name is the quickest identification of what a PRX is.

Exports

Section .lib.ent: an array of entries (struct _PspLibraryEntry) of 16 bytes: name pointer, version u16, attribute u16, entry length u8 (in words), variable count u8, function count u16, table pointer. The table holds (functions + variables) NIDs followed by the same number of addresses (functions first, then variables). The first, unnamed entry is the system library syslib (psp-build-exports names it syslib), whose slots are the module entry points such as module_start. See Technique:SCE NID imports and exports.

Imports

Section .lib.stub: one record per imported library, 20 bytes: name pointer, flags and version word, entry size u8 (in words), variable count u8, function count u16, NID table pointer (.rodata.sceNid), stub table pointer (.sceStub.text). Each imported function owns an 8-byte stub in .sceStub.text; the kernel loader matches the NID against the exporting module and writes a jump (or syscall) into the stub at load time. Calls in the code are plain jal to the stub.

Tools

psp-prxgen, psp-fixup-imports, psp-build-exports (pspsdk, BSD). Ghidra and IDA have PSP loaders that resolve NIDs by name.

Pitfalls

  • Names are unknown at runtime: only NIDs are stored, so function naming needs a NID-to-name table (see the technique page).
  • Before load a stub is two words: a pointer to the library stub record and the NID (pspsdk src/base/pspimport.s lines 23-37: .word __stub_module_<lib>, .word <funcid>), and the NID is also listed in .rodata.sceNid (lines 39-40). The import record in .lib.stub is emitted by IMPORT_START as name pointer, flags/version, the word 5 (entry size in words, counts left to be filled by the fixup tool), and two placeholder words (lines 11-18). Unverified: that the kernel overwrites the stub with a jump or syscall, read from documentation, not from the loader code.

Code & repositories

See Platform:PlayStation Portable.

  • https://github.com/pspdev/pspsdk @ 6ef2b21dc440ef8d4125f000301faaa2a470975e · license: BSD-3-Clause (declared by the contributor; GitHub's detector did not recognize LICENSE)
    PSP SDK (BSD): module info, import/export macros, NID generation, prxgen, pack-pbp, mksfo
    Tested on: source read, not run: source read, tools/ and src/user/ at the pinned commit · checked 2026-10-18; last activity 2026-10-17