NCCH/Extended Header: Difference between revisions
mNo edit summary |
mNo edit summary |
||
(12 intermediate revisions by 8 users not shown) | |||
Line 9: | Line 9: | ||
All values are little endian unless otherwise specified. | All values are little endian unless otherwise specified. | ||
See also: [https://github.com/ | See also: [https://github.com/3DSGuy/Project_CTR/blob/20f708450b9c6e7f64eafa6c2a8eeb25a630c69a/ctrtool/exheader.h] | ||
{| class="wikitable" border="1" | {| class="wikitable" border="1" | ||
Line 31: | Line 31: | ||
| <code>0x500</code> | | <code>0x500</code> | ||
| <code>0x100</code> | | <code>0x100</code> | ||
| NCCH | | NCCH header RSA-2048 modulus | ||
|- | |- | ||
| <code>0x600</code> | | <code>0x600</code> | ||
Line 38: | Line 38: | ||
|} | |} | ||
The <code>AccessDesc</code> signature covers the NCCH | The <code>AccessDesc</code> signature covers the NCCH header modulus and second ACI. The <code>AccessDesc</code> public key is initialised by the boot ROM. | ||
When loading the exheader, [[FIRM|Process9]] compares the exheader data with the data in the <code>AccessDesc</code> (note that not everything is compared here). When these don't match, an error is returned. The Process9 code handling this validation was updated with [[6.0.0-11|v6.0]]; the only change in this function seems to be the check for the "Ideal processor" field. | When loading the exheader, [[FIRM|Process9]] compares the exheader data with the data in the <code>AccessDesc</code> (note that not everything is compared here). When these don't match, an error is returned. The Process9 code handling this validation was updated with [[6.0.0-11|v6.0]]; the only change in this function seems to be the check for the "Ideal processor" field. | ||
Line 51: | Line 51: | ||
| <code>0x0</code> | | <code>0x0</code> | ||
| <code>0x8</code> | | <code>0x8</code> | ||
| Application title | | Application title (default is "CtrApp") | ||
|- | |- | ||
| <code>0x8</code> | | <code>0x8</code> | ||
Line 91: | Line 91: | ||
| <code>0x40</code> | | <code>0x40</code> | ||
| <code>0x180</code> (<code>48*8</code>) | | <code>0x180</code> (<code>48*8</code>) | ||
| Dependency module (program ID) list | | Dependency [[Title list#00040130 - System Modules|module]] (program ID) list | ||
|- | |- | ||
| <code>0x1C0</code> | | <code>0x1C0</code> | ||
Line 225: | Line 225: | ||
|- | |- | ||
| <code>4-7</code> | | <code>4-7</code> | ||
| System | | Old3DS system mode | ||
|} | |||
===== Old3DS System Mode ===== | |||
{| class="wikitable" border="1" | |||
|- | |||
! Value | |||
! Description | |||
|- | |||
| <code>0</code> | |||
| <code>Prod</code> (64MB of usable application memory) | |||
|- | |||
| <code>1</code> | |||
| <code>Undefined</code> (unusable) | |||
|- | |||
| <code>2</code> | |||
| <code>Dev1</code> (96MB of usable application memory) | |||
|- | |||
| <code>3</code> | |||
| <code>Dev2</code> (80MB of usable application memory) | |||
|- | |||
| <code>4</code> | |||
| <code>Dev3</code> (72MB of usable application memory) | |||
|- | |||
| <code>5</code> | |||
| <code>Dev4</code> (32MB of usable application memory) | |||
|- | |||
| <code>6-7</code> | |||
| <code>Undefined</code> Same as <code>Prod</code>? | |||
|} | |} | ||
Line 263: | Line 291: | ||
|- | |- | ||
| <code>0-3</code> | | <code>0-3</code> | ||
| | | New3DS system mode | ||
|- | |- | ||
| <code>4-7</code> | | <code>4-7</code> | ||
Line 269: | Line 297: | ||
|} | |} | ||
The exheader value for the | ===== New3DS System Mode ===== | ||
{| class="wikitable" border="1" | |||
|- | |||
! Value | |||
! Description | |||
|- | |||
| <code>0</code> | |||
| <code>Legacy</code> (use Old3DS system mode) | |||
|- | |||
| <code>1</code> | |||
| <code>Prod</code> (124MB of usable application memory) | |||
|- | |||
| <code>2</code> | |||
| <code>Dev1</code> (178MB of usable application memory) | |||
|- | |||
| <code>3</code> | |||
| <code>Dev2</code> (124MB of usable application memory) | |||
|- | |||
| <code>4-7</code> | |||
| <code>Undefined</code> Same as <code>Prod</code>? | |||
|} | |||
When in <code>Legacy</code> mode, the actual memory layout is the same as in <code>New3DS Prod</code>, except the available application memory as reported to the application is reduced to the Old3DS size. | |||
The exheader value for the New3DS system mode value must be ≤ to the <code>AccessDesc</code> value, otherwise the invalid-exheader error is returned. | |||
==== Storage Info ==== | ==== Storage Info ==== | ||
Line 442: | Line 494: | ||
|- | |- | ||
| <code>0b11111111100x</code> | | <code>0b11111111100x</code> | ||
| | | Map IO/static address range | ||
| | | Describes a memory mapping like the 0b111111111110 descriptor, but an entire range rather than a single page is mapped. Another 0b11111111100x descriptor must follow this one to denote the (exclusive) end of the address range to map. Bit20 on the first descriptor: map read-only (otherwise RW), bit20 on the second descriptor: map static (cacheable, otherwise IO if the bit is not set) | ||
|- | |- | ||
| <code>0b111111111110</code> | | <code>0b111111111110</code> | ||
| | | Map IO memory page | ||
| Bits 0-19: | | Bits 0-19: page index to map (virtual address >> 12; the physical address is determined per-page according to [[Memory layout]]); Bit 20: Map read-only (otherwise read-write) | ||
|} | |} | ||