NSO: Difference between revisions
No edit summary |
|||
Line 3: | Line 3: | ||
It starts with the "NSO" header and mainly describes .text, .rodata, and .data segments (like a short-form of ELF program headers): | It starts with the "NSO" header and mainly describes .text, .rodata, and .data segments (like a short-form of ELF program headers): | ||
= NSO Header = | |||
{| class="wikitable" border="1" | {| class="wikitable" border="1" | ||
|- | |- | ||
Line 68: | Line 28: | ||
| 0x10 | | 0x10 | ||
| 0x10 * 3 | | 0x10 * 3 | ||
| SegmentHeader | | SegmentHeader[3] | ||
|- | |- | ||
| 0x40 | | 0x40 | ||
Line 76: | Line 36: | ||
| 0x60 | | 0x60 | ||
| 0x4 * 3 | | 0x4 * 3 | ||
| | | CompressedSize[3] | ||
|- | |- | ||
| 0x6c | | 0x6c | ||
Line 102: | Line 62: | ||
For example, the MOD header is essentially a replacement for a PT_DYNAMIC program header. | For example, the MOD header is essentially a replacement for a PT_DYNAMIC program header. | ||
=== MOD | == SegmentHeader == | ||
{| class="wikitable" border="1" | |||
|- | |||
! Offset | |||
! Size | |||
! Description | |||
|- | |||
| 0x0 | |||
| 4 | |||
| FileOffset | |||
|- | |||
| 0x4 | |||
| 4 | |||
| MemoryOffset | |||
|- | |||
| 0x8 | |||
| 4 | |||
| DecompressedSize | |||
|- | |||
| 0xC | |||
| 4 | |||
| UnkOffset/UnkSize/BssSize | |||
|} | |||
== .rodata-relative extent == | |||
{| class="wikitable" border="1" | |||
|- | |||
! Offset | |||
! Size | |||
! Description | |||
|- | |||
| 0x0 | |||
| 4 | |||
| RegionRoDataOffset | |||
|- | |||
| 0x4 | |||
| 4 | |||
| RegionSize | |||
|} | |||
== MOD == | |||
All offsets are signed 32bit values relative to the magic field. | All offsets are signed 32bit values relative to the magic field. | ||
The 32bits at image base + 4 must point to the magic field. | The 32bits at image base + 4 must point to the magic field. | ||
Line 115: | Line 115: | ||
| 0x00 | | 0x00 | ||
| 4 | | 4 | ||
| | | ZeroPadding | ||
|- | |- | ||
| 0x04 | | 0x04 | ||
| 4 | | 4 | ||
| | | MagicOffset. Always 8 (so it works when MOD is at image_base + 0). | ||
|- | |- | ||
| 0x08 | | 0x08 | ||
| 4 | | 4 | ||
| | | Magic "MOD0" | ||
|- | |- | ||
| 0x0C | | 0x0C |