All elements in the Switch's boot chain up to the kernel have the ability to issue a system panic.
Panics are handled by writing a panic code in the PMC_SCRATCH200 register and requesting a reboot by programming a dedicated hardware watchdog (WDT4). The bootloaders and the Secure Monitor are able to do this right away, but the kernel must invoke the Panic SMC.
When the system reboots, the encrypted bootloader checks if the reset was requested by the watchdog (PMC_RST_STATUS register is set to 0x01) and parses the panic code stored in PMC_SCRATCH200.
If a panic did occur, the Switch will paint the main screen with a solid color and halt execution.
The blue, green and red values are nibbles which represent the color that will fill the panic screen. Each nibble is duplicated to form a full byte before writing the final color to the display's MMIO.
Different colors are used to represent panic events coming from different execution levels within the system.
|0xFF7700||Secure Monitor (exception vectors)|
|0x00FFFF||Secure Monitor (general errors)|
|0x00AAFF||Secure Monitor (deep sleep) [1.0.0+]|
|0xFF77FF||Secure Monitor (deep sleep) [4.0.0+]|
|0xAA00FF||Bootloader (general errors)|
|0xFFFFAA||Bootloader (booting SafeMode) [1.0.0-3.0.2]|
While any combination of panic colors and codes is possible, several panic codes are specifically tied to a certain color.
|0x1||Package2 signature verification failed|
|0x2||Package2 meta verification failed|
|0x3||Package2 version check failed|
|0x4||Package2 payload verification failed|
|0x7||Invalid CPU context|
|0x8||Invalid SE state|
|0x9||CPU is already awake [2.0.0+]|
|0x20||Rebooting into SafeMode|
|0x21||Rebooting for anti-downgrade|
|0x30||General bootloader error|
|0x31||Invalid DRAM ID|
|0x35||Failed to boot SafeMode|
|0x36||Activity Monitor fired [4.0.0+]|
|0x40||Show error called (kernel panic)|