Difference between revisions of "Panic codes"

From Nintendo Switch Brew
Jump to navigation Jump to search
Line 45: Line 45:
  
 
== Panic codes ==
 
== Panic codes ==
While any combination of panic colors and codes is possible, several panic codes are specifically tied to a certain execution level.
+
While any combination of panic colors and codes is possible, several panic codes are specifically tied to a certain color.
  
 
{| class=wikitable
 
{| class=wikitable
! Value || Level || Description
+
! Value || Color || Description
 
|-
 
|-
 
| 0x0 || Any || No information
 
| 0x0 || Any || No information
 
|-
 
|-
| 0x1 || Kernel || Package2 signature verification failed
+
| 0x1 || <div style="width: 60px; height: 20px; background:#0000FF;"></div> || Package2 signature verification failed
 
|-
 
|-
| 0x2 || Kernel || Package2 meta verification failed
+
| 0x2 || <div style="width: 60px; height: 20px; background:#0000FF;"></div> || Package2 meta verification failed
 
|-
 
|-
| 0x3 || Kernel || Package2 version check failed
+
| 0x3 || <div style="width: 60px; height: 20px; background:#0000FF;"></div> || Package2 version check failed
 
|-
 
|-
| 0x4 || Kernel || Package2 payload verification failed
+
| 0x4 || <div style="width: 60px; height: 20px; background:#0000FF;"></div> || Package2 payload verification failed
 
|-
 
|-
| 0x5 || Secure Monitor || Unknown SMC
+
| 0x5 || <div style="width: 60px; height: 20px; background:#00FFFF;"></div> || Unknown SMC
 
|-
 
|-
| 0x6 || Secure Monitor || Unknown Abort
+
| 0x6 || <div style="width: 60px; height: 20px; background:#00FFFF;"></div> || Unknown Abort
 
|-
 
|-
| 0x7 || Secure Monitor || Invalid CPU context
+
| 0x7 || <div style="width: 60px; height: 20px; background:#00AAFF;"></div> || Invalid CPU context
 
|-
 
|-
| 0x8 || Secure Monitor || Invalid SE state
+
| 0x8 || <div style="width: 60px; height: 20px; background:#00AAFF;"></div> || Invalid SE state
 
|-
 
|-
| 0x9 || Secure Monitor || CPU is already awake
+
| 0x9 || <div style="width: 60px; height: 20px; background:#00AAFF;"></div> || CPU is already awake [2.0.0+]
 
|-
 
|-
 
| 0x10 || Any || Unknown exception
 
| 0x10 || Any || Unknown exception
 
|-
 
|-
| 0x20 || Bootloader || Rebooting into SafeMode
+
| 0x20 || <div style="width: 60px; height: 20px; background:#000000;"></div> || Rebooting into SafeMode
 
|-
 
|-
| 0x21 || Bootloader || Rebooting for anti-downgrade
+
| 0x21 || <div style="width: 60px; height: 20px; background:#000000;"></div> || Rebooting for anti-downgrade
 
|-
 
|-
| 0x30 || Bootloader || General bootloader error
+
| 0x30 || <div style="width: 60px; height: 20px; background:#AA00FF;"></div> || General bootloader error
 
|-
 
|-
| 0x31 || Bootloader || Invalid DRAM ID
+
| 0x31 || <div style="width: 60px; height: 20px; background:#AA00FF;"></div> || Invalid DRAM ID
 
|-
 
|-
| 0x32 || Bootloader || Invalid size
+
| 0x32 || <div style="width: 60px; height: 20px; background:#AA00FF;"></div> || Invalid size
 
|-
 
|-
| 0x33 || Bootloader || Invalid argument
+
| 0x33 || <div style="width: 60px; height: 20px; background:#AA00FF;"></div> || Invalid argument
 
|-
 
|-
| 0x34 || Bootloader || Bad GPT
+
| 0x34 || <div style="width: 60px; height: 20px; background:#AA00FF;"></div> || Bad GPT
 
|-
 
|-
| 0x35 || Bootloader || Failed to boot SafeMode
+
| 0x35 || <div style="width: 60px; height: 20px; background:#AA00FF;"></div> || Failed to boot SafeMode
 
|-
 
|-
| 0x36 || Bootloader-color || [4.0.0+]  
+
| 0x36 || <div style="width: 60px; height: 20px; background:#AA00FF;"></div> || [4.0.0+]  
 
|-
 
|-
| 0x40 || Kernel || Show error called (kernel panic)
+
| 0x40 || <div style="width: 60px; height: 20px; background:#0000FF;"></div> || Show error called (kernel panic)
 
|}
 
|}

Revision as of 21:53, 15 January 2018

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.

Structure

Bits Field
31-28 Blue value
27-24 Green value
23-20 Red value
19-0 Description

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.

Panic colors

Different colors are used to represent panic events coming from different execution levels within the system.

Color Value Level
0x000000 Default
0x0000FF Kernel
0x00FFFF Secure Monitor (general errors)
0x00AAFF Secure Monitor (deep sleep)
0xAA00FF Bootloader (general errors)
0xFFFFAA Bootloader (wrong bootloader)
0xFFAA00 GPU

Panic codes

While any combination of panic colors and codes is possible, several panic codes are specifically tied to a certain color.

Value Color Description
0x0 Any No information
0x1
Package2 signature verification failed
0x2
Package2 meta verification failed
0x3
Package2 version check failed
0x4
Package2 payload verification failed
0x5
Unknown SMC
0x6
Unknown Abort
0x7
Invalid CPU context
0x8
Invalid SE state
0x9
CPU is already awake [2.0.0+]
0x10 Any Unknown exception
0x20
Rebooting into SafeMode
0x21
Rebooting for anti-downgrade
0x30
General bootloader error
0x31
Invalid DRAM ID
0x32
Invalid size
0x33
Invalid argument
0x34
Bad GPT
0x35
Failed to boot SafeMode
0x36
[4.0.0+]
0x40
Show error called (kernel panic)