SELF

From Vita Development Wiki
Revision as of 22:08, 30 December 2018 by CelesteBlue (talk | contribs)
Jump to navigation Jump to search

SELF files are a wrapper around encrypted ELF files. The encrypted header contains keys to decrypt each encrypted ELF program, which are decrypted and loaded individually. Because of this, a copy of the ELF headers and ELF program headers are stored in plain text next to the Certified File header.

Authority Id

8 bytes long. Located at offset 0x80 in PSVita SELF header.

sceAppMgrConvertVs0UserDrivePath checks the Authority Id to limit mount points.

0x2800000000008000 (SceWebCore eboot.bin - NPXS10017 / NPXS10037 on 1.69-3.01, replaced later by SceWebKit).

0x2800000000008003 (SceWebCore) can access vs0:data/external/cert/ and vs0:data/external/webcore/.

0x210000101CD20007 (PSM Dev Assistant can access vs0:data/external and vs0:sys/external.

Relocations

Relocations are stored within the PT_SCE_RELA segment.

Relocation entry format can be one of 10 types which is determined by the first 4 bits.

Format 0

Start End Description
0 3 Entry format type set to 0
4 7 Symbol segment index
8 15 Relocation type
16 19 Patch segment index
20 27 Second relocation type
28 31 Distance from offset (used for second relocation)
32 63 Addend
64 95 Offset

Format 1

Start End Description
0 3 Entry format type set to 1
4 7 Symbol segment index
8 15 Relocation type
16 19 Patch segment index
20 41 Offset
42 63 Addend

Format 2

Start End Description
0 3 Entry format type set to 2
4 7 Symbol segment index
8 15 Relocation type
16 31 Offset
32 64 Addend

Format 3

Start End Description
0 3 Entry format type set to 3
4 7 Symbol segment index
8 8 Mode (ARM = 0, THUMB = 1)
9 26 Offset
27 31 Distance from offset
32 64 Addend

Format 4

Start End Description
0 3 Entry format type set to 4
4 26 Offset
27 31 Distance from offset

Format 5

Start End Description
0 3 Entry format type set to 5
4 12 Distance 1
13 17 Distance 2
18 26 Distance 3
27 31 Distance 4

Format 6

Start End Description
0 3 Entry format type set to 6
4 31 Offset

Format 7

Start End Description
0 3 Entry format type set to 7
4 10 Offset 1
11 17 Offset 2
18 24 Offset 3
25 31 Offset 4

Format 8

Start End Description
0 3 Entry format type set to 8
4 7 Offset 1
8 11 Offset 2
12 15 Offset 3
16 19 Offset 4
20 23 Offset 5
24 27 Offset 6
28 31 Offset 7

Format 9

Start End Description
0 3 Entry format type set to 9
4 5 Offset 1
6 7 Offset 2
8 9 Offset 3
10 11 Offset 4
12 13 Offset 5
14 15 Offset 6
16 17 Offset 7
18 19 Offset 8
20 21 Offset 9
22 23 Offset 10
24 25 Offset 11
26 27 Offset 12
28 29 Offset 13
30 31 Offset 14

Supported Relocation Codes (3.60)

Code Description
0 R_ARM_NONE
2 R_ARM_ABS32
3 R_ARM_REL32
10 R_ARM_THM_CALL
28 R_ARM_CALL
29 R_ARM_JUMP24
38 R_ARM_TARGET1 (same as R_ARM_ABS32)
40 R_ARM_V4BX (same as R_ARM_NONE)
41 R_ARM_TARGET2 (same as R_ARM_REL32)
42 R_ARM_PREL31
43 R_ARM_MOVW_ABS_NC
44 R_ARM_MOVT_ABS
47 R_ARM_THM_MOVW_ABS_NC
48 R_ARM_THM_MOVT_ABS