PRX: Difference between revisions
Jump to navigation
Jump to search
CelesteBlue (talk | contribs) No edit summary |
CelesteBlue (talk | contribs) No edit summary |
||
Line 1: | Line 1: | ||
= Overview = | = Overview = | ||
'''P'''laystation '''R'''elocatable E'''x'''ecutable (PRX) | |||
= Structure = | = Structure = | ||
Line 14: | Line 14: | ||
! Description | ! Description | ||
|- | |- | ||
| | | 0 | ||
| short | | short | ||
| Module attributes | | Module attributes | ||
|- | |- | ||
| | | 2 | ||
| char[2] | | char[2] | ||
| Module version | | Module version | ||
|- | |- | ||
| | | 4 | ||
| char[28] | | char[28] | ||
| Module name | | Module name | ||
|- | |- | ||
| | | 0x20 | ||
| long | | long | ||
| TOC address | | TOC address | ||
|- | |- | ||
| | | 0x24 | ||
| long | | long | ||
| Pointer to the start of exports section | | Pointer to the start of exports section | ||
|- | |- | ||
| | | 0x28 | ||
| long | | long | ||
| Pointer to end of exports section | | Pointer to end of exports section | ||
|- | |- | ||
| | | 0x2C | ||
| long | | long | ||
| Points to the start of imports section | | Points to the start of imports section | ||
|- | |- | ||
| | | 0x30 | ||
| long | | long | ||
| Points to the end of imports section | | Points to the end of imports section | ||
Line 54: | Line 54: | ||
! Description | ! Description | ||
|- | |- | ||
| | | 0 | ||
| char[2] | | char[2] | ||
| Structure size (0x1C 32-bit or 0x28 64-bit), padding | | Structure size (0x1C 32-bit or 0x28 64-bit), padding | ||
|- | |- | ||
| | | 2 | ||
| short | | short | ||
| Version | | Version | ||
|- | |- | ||
| | | 4 | ||
| short | | short | ||
| Attributes | | Attributes | ||
|- | |- | ||
| | | 6 | ||
| short | | short | ||
| Number of functions | | Number of functions | ||
|- | |- | ||
| | | 8 | ||
| short | | short | ||
| Number of variables | | Number of variables | ||
|- | |- | ||
| | | 0xA | ||
| short | | short | ||
| Number of thread local storage variables | | Number of thread local storage variables | ||
|- | |- | ||
| | | 0xC | ||
| char | | char | ||
| Hash info | | Hash info | ||
|- | |- | ||
| | | 0xD | ||
| char | | char | ||
| Thread local storage hash info | | Thread local storage hash info | ||
|- | |- | ||
| | | 0xE | ||
| char[2] | | char[2] | ||
| Reserved | | Reserved | ||
|- | |- | ||
| | | 0x10 | ||
| long | | long | ||
| Pointer to exported library name | | Pointer to exported library name | ||
|- | |- | ||
| | | 0x14 | ||
| long | | long | ||
| Pointer to function NID table | | Pointer to function NID table | ||
|- | |- | ||
| | | 0x18 | ||
| long | | long | ||
| Pointer to function stub table | | Pointer to function stub table | ||
Line 110: | Line 110: | ||
! Description | ! Description | ||
|- | |- | ||
| | | 0 | ||
| char | | char | ||
| Structure size (0x2C) | | Structure size (0x2C) | ||
|- | |- | ||
| | | 1 | ||
| char | | char | ||
| Unused | | Unused | ||
|- | |- | ||
| | | 2 | ||
| short | | short | ||
| Version | | Version | ||
|- | |- | ||
| | | 4 | ||
| short | | short | ||
| Attributes. AUTO_EXPORT=0x0001, WEAK_EXPORT=0x0002, NOLINK_EXPORT=0x0004, WEAK_IMPORT=0x0008, 0x2000 seems to indicate a non-PRX library (like "stdc" or "allocator") that comes from somewhere else (LV2?) | | Attributes. AUTO_EXPORT=0x0001, WEAK_EXPORT=0x0002, NOLINK_EXPORT=0x0004, WEAK_IMPORT=0x0008, 0x2000 seems to indicate a non-PRX library (like "stdc" or "allocator") that comes from somewhere else (LV2?) | ||
|- | |- | ||
| | | 6 | ||
| short | | short | ||
| Number of functions | | Number of functions | ||
|- | |- | ||
| | | 8 | ||
| short | | short | ||
| Number of variables | | Number of variables | ||
|- | |- | ||
| | | 0xA | ||
| short | | short | ||
| Number of thread local storage variables | | Number of thread local storage variables | ||
|- | |- | ||
| | | 0xC | ||
| byte[4] | | byte[4] | ||
| reserved | | reserved | ||
|- | |- | ||
| | | 0x10 | ||
| long | | long | ||
| Pointer to imported library name. | | Pointer to imported library name. | ||
|- | |- | ||
| | | 0x14 | ||
| long | | long | ||
| Pointer to the list of NID's for the exported functions. | | Pointer to the list of NID's for the exported functions. | ||
|- | |- | ||
| | | 0x18 | ||
| long | | long | ||
| Pointer to the list of exported functions. | | Pointer to the list of exported functions. | ||
|- | |- | ||
| | | 0x1C | ||
| long | | long | ||
| var_nid_table | | var_nid_table | ||
|- | |- | ||
| | | 0x20 | ||
| long | | long | ||
| var_entry_table | | var_entry_table | ||
|- | |- | ||
| | | 0x24 | ||
| long | | long | ||
| tls_nid_table | | tls_nid_table | ||
|- | |- | ||
| | | 0x28 | ||
| long | | long | ||
| tls_entry_table | | tls_entry_table | ||
Line 172: | Line 172: | ||
== Relocations == | == Relocations == | ||
=== PS3 === | |||
Relocations can be found in either PT_SCE_PPURELA segments or SHT_SCE_PPURELA / SHT_RELA sections. RELA relocations are standard relocations while PPURELA relocations have 2 segment (program header) indexes stored in r_sym of r_info. | Relocations can be found in either PT_SCE_PPURELA segments or SHT_SCE_PPURELA / SHT_RELA sections. RELA relocations are standard relocations while PPURELA relocations have 2 segment (program header) indexes stored in r_sym of r_info. |
Revision as of 19:37, 26 December 2019
Overview
Playstation Relocatable Executable (PRX)
Structure
First LOAD segment p_paddr points to module info.
Module Info
Offset | Type | Description |
---|---|---|
0 | short | Module attributes |
2 | char[2] | Module version |
4 | char[28] | Module name |
0x20 | long | TOC address |
0x24 | long | Pointer to the start of exports section |
0x28 | long | Pointer to end of exports section |
0x2C | long | Points to the start of imports section |
0x30 | long | Points to the end of imports section |
Exports
Offset | Type | Description |
---|---|---|
0 | char[2] | Structure size (0x1C 32-bit or 0x28 64-bit), padding |
2 | short | Version |
4 | short | Attributes |
6 | short | Number of functions |
8 | short | Number of variables |
0xA | short | Number of thread local storage variables |
0xC | char | Hash info |
0xD | char | Thread local storage hash info |
0xE | char[2] | Reserved |
0x10 | long | Pointer to exported library name |
0x14 | long | Pointer to function NID table |
0x18 | long | Pointer to function stub table |
Imports
Offset | Type | Description |
---|---|---|
0 | char | Structure size (0x2C) |
1 | char | Unused |
2 | short | Version |
4 | short | Attributes. AUTO_EXPORT=0x0001, WEAK_EXPORT=0x0002, NOLINK_EXPORT=0x0004, WEAK_IMPORT=0x0008, 0x2000 seems to indicate a non-PRX library (like "stdc" or "allocator") that comes from somewhere else (LV2?) |
6 | short | Number of functions |
8 | short | Number of variables |
0xA | short | Number of thread local storage variables |
0xC | byte[4] | reserved |
0x10 | long | Pointer to imported library name. |
0x14 | long | Pointer to the list of NID's for the exported functions. |
0x18 | long | Pointer to the list of exported functions. |
0x1C | long | var_nid_table |
0x20 | long | var_entry_table |
0x24 | long | tls_nid_table |
0x28 | long | tls_entry_table |
Relocations
PS3
Relocations can be found in either PT_SCE_PPURELA segments or SHT_SCE_PPURELA / SHT_RELA sections. RELA relocations are standard relocations while PPURELA relocations have 2 segment (program header) indexes stored in r_sym of r_info.
- The first index can be extracted with 0x7FFFFF00 as a mask and is used as a base address for r_addend. This sum will be the value applied to the patch.
- The second index can be extracted with 0x000000FF as a mask and is used as a base address for the target segment to patch and is added to r_offset.
- The first bit (0x80000000) is also set on earlier PRX's but it is currently unknown what it is used for.
|