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): |
| | | |
− | === SegmentHeader ===
| + | = NSO Header = |
− | {| class="wikitable" border="1"
| |
− | |-
| |
− | ! Offset
| |
− | ! Size
| |
− | ! Description
| |
− | |-
| |
− | | 0x0
| |
− | | 4
| |
− | | file offset of data
| |
− | |-
| |
− | | 0x4
| |
− | | 4
| |
− | | memory offset loaded to
| |
− | |-
| |
− | | 0x8
| |
− | | 4
| |
− | | size of data copied to memory offset (i.e. size after decompression)
| |
− | |-
| |
− | | 0xC
| |
− | | 4
| |
− | | alignment used on memory size / size of .bss in the case of .data segment
| |
− | |}
| |
− | | |
− | === .rodata-relative extent ===
| |
− | {| class="wikitable" border="1"
| |
− | |-
| |
− | ! Offset
| |
− | ! Size
| |
− | ! Description
| |
− | |-
| |
− | | 0x0
| |
− | | 4
| |
− | | offset (relative to .rodata)
| |
− | |-
| |
− | | 0x4
| |
− | | 4
| |
− | | size of region
| |
− | |}
| |
− | | |
− | === NSO Header ===
| |
| {| class="wikitable" border="1" | | {| class="wikitable" border="1" |
| |- | | |- |
Line 68: |
Line 28: |
| | 0x10 | | | 0x10 |
| | 0x10 * 3 | | | 0x10 * 3 |
− | | SegmentHeader for each segment | + | | SegmentHeader[3] |
| |- | | |- |
| | 0x40 | | | 0x40 |
Line 76: |
Line 36: |
| | 0x60 | | | 0x60 |
| | 0x4 * 3 | | | 0x4 * 3 |
− | | file size of each segment (i.e. LZ4-compressed size) | + | | 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 |
− | | zero padding | + | | ZeroPadding |
| |- | | |- |
| | 0x04 | | | 0x04 |
| | 4 | | | 4 |
− | | offset to magic. Always 8 (so it works when MOD is at image_base + 0). | + | | MagicOffset. Always 8 (so it works when MOD is at image_base + 0). |
| |- | | |- |
| | 0x08 | | | 0x08 |
| | 4 | | | 4 |
− | | magic "MOD0" | + | | Magic "MOD0" |
| |- | | |- |
| | 0x0C | | | 0x0C |