CRO0: Difference between revisions

Kynex7510 (talk | contribs)
Trie entries + unknown fields
Import Module Table entry: The order of "Offset" vs "Count" was swapped... at least for this `.crs` file I'm reading.
 
(One intermediate revision by one other user not shown)
Line 3: Line 3:
CRO with extension .cro is used for "DLLs". CRS with extension .crs is in the same format of CRO but storing the symbol information of the static module (the main application). The end of the file is aligned to a 0x1000-byte boundary with 0xCC bytes.
CRO with extension .cro is used for "DLLs". CRS with extension .crs is in the same format of CRO but storing the symbol information of the static module (the main application). The end of the file is aligned to a 0x1000-byte boundary with 0xCC bytes.


The first hash-table entry hashes the 0x100-byte header following the hash-table. The following hash-table entries hash the sections specified in the header.
The CRO hashes before the magic are hashed themselves and verified against the [[CRR0|CRR]] hash table.


When the RO module loads the entire CRO into process memory(mapped in the 0x00100000-0x04000000 region), it modifies the mapped CRO data. The magic field is also changed to "FIXD" if fix level is not 0.
When the RO module loads the entire CRO into process memory (mapped in the 0x00100000-0x04000000 region), it relocates the mapped CRO data (eg. such that offsets can be dereferenced). The magic field is also changed to "FIXD" if fix level is not 0.


Upon loading, the RO module will look for export symbol "nnroAeabiAtexit_" to patch it to its import symbol "__aeabi_atexit".
Upon loading, the RO module will look for export symbol "nnroAeabiAtexit_" to patch it to its import symbol "__aeabi_atexit".
Line 18: Line 18:
!  Description
!  Description
|-
|-
| 0x0
| 0x00
| 0x80
| 0x20
| SHA-256 hash-table, verified by [[CRR0|CRR]]
| SHA-256 hash over the raw data from offset 0x80 to *(code offset), exclusive
|-
| 0x20
| 0x20
| SHA-256 hash over the raw data from *(code offset) to *(module name offset), exclusive
|-
| 0x40
| 0x20
| SHA-256 hash over the raw data from *(module name offset) to *(data offset), exclusive
|-
| 0x60
| 0x20
| SHA-256 hash over the raw data from *(data offset) to *(data offset + data size), exclusive (RO does NOT check this hash)
|-
|-
| 0x80
| 0x80
Line 353: Line 365:
| 0x4
| 0x4
| 0x4
| 0x4
| Indexed import num
| Offset of the head of a sub list in Indexed Import Table
|-
|-
| 0x8
| 0x8
| 0x4
| 0x4
| Offset of the head of a sub list in Indexed Import Table
| Indexed import num
|-
|-
| 0xC
| 0xC
| 0x4
| 0x4
| Anonymous import num
| Offset of the head of a sub list in Anonymous Import Table
|-
|-
| 0x10
| 0x10
| 0x4
| 0x4
| Offset of the head of a sub list in Anonymous Import Table
| Anonymous import num
|}
|}