Difference between revisions of "ErrDisp"

From 3dbrew
Jump to: navigation, search
(Added preliminary information about errinfo format)
m (Added errdisp output format 4 information)
Line 20: Line 20:
 
|}
 
|}
  
= errinfo =
+
= output, where *((u8*)errinfo) == 4 =
Note: the following data is still only partly reliable
 
 
{| class="wikitable" border="1"
 
{| class="wikitable" border="1"
 
|-
 
|-
! Type
+
! Entry
! Name
+
! Format string
! Info
+
! Format args
 +
! Description
 
|-
 
|-
| 1 byte
+
| PID
 +
| 0x%08X_0x%08X
 +
| 0x41900000, *(u32*)(errinfo + 0x10)
 +
| Process ID
 +
|-
 +
| REV
 +
| %d
 +
| *(u16*)(errinfo + 2) | (*(u8*)(errinfo + 1) << 16)
 
| ?
 
| ?
| unknown
 
 
|-
 
|-
| 1 byte
+
| AID
| ?
+
| 0x%08X_0x%08X
| unknown
+
| 0x41900000, *(u32*)(errinfo + 0x18)
 +
| Application ID?
 +
|-
 +
| RSL
 +
| 0x%08X
 +
| *(u32*)(errinfo + 4)
 +
| Error code
 +
|-
 +
| Level
 +
| %d
 +
| *(u32*)(errinfo + 4) & 0x80000000 ? (*(u32*)(errinfo + 4) >> 0x27) - 0x20 :  *(u32*)(errinfo + 4) >> 0x27
 +
| Error code level
 
|-
 
|-
| 2 bytes
+
| Summary
|  
+
| %d
| The type of error info struct (??)
+
| (*(u32*)(errinfo + 4) & 0x7E00000) >> 21
 +
| Error code summary
 
|-
 
|-
| 4 bytes
+
| Module
|  
+
| %d
| The return code of the errored function (?? - Inconsistent)
+
| (*(u32*)(errinfo + 4) & 0x3FC00) >> 10
 +
| Error code module
 
|-
 
|-
| 4 bytes
+
| Desc
| caller_ptr
+
| %d
| The contents of the LR register - where the error was called from
+
| (*(u32*)(errinfo + 4) << 22) >> 22
 +
| Error code description
 
|-
 
|-
| 4 bytes
+
| ?
| process_id
+
| %0.*s
| The ID/Handle of the running process
+
| 0x2E, for (int i = 0; i < 2; i++) (errinfo + (((i << 3) - i) + (i << 4)) << 1) + 0x20
 +
| ?
 +
|-
 +
| Datetime
 +
| %04d/%02d/%02d %02d:%02d:%02d
 +
| ?
 +
| ?
 
|}
 
|}

Revision as of 01:14, 17 February 2015

This system process handles displaying the error screens, such as "an error has occurred, the system needs shutdown". This can also display a register dump for exceptions, and info for fatal errors. (Normally the black-screen errors are displayed on retail, while the latter is displayed on development units.)

The register dump/fatal error info can also be written to nandrw/sys/native.log. On retail consoles, the system does not notify ErrDisp that any user-land exceptions occurred, ErrDisp is only notified for this on dev/debug units. Therefore, on retail consoles native.log only contains info from fatal errors. Starting with 5.0.0-11 ErrDisp no longer writes logs to native.log, except when the error-type is value 5 and when other checks with the errorinfo structure are successful (normally processes using this port never use error-type 5).

The bottom screen displays the error screen like "error has occurred", even with a development 3DS. The top screen can display the development error info, this is only displayed when UNITINFO bit0 is clear, for a development 3DS.

ErrDisp handles "returning" to Home Menu via NSS:RebootSystem, which triggers a hardware system reboot.

ErrDisp error port "err:f"

Command Header Description
0x00010800 ThrowFatalError(0x80-byte errorinfo)
0x00020042 (size, (size<<14) | 2, errorinfoptr) This is similar to cmd1, except with this the input buffer is copied to final output errorinfo+0x80 instead of +0x0, via the ARM11 kernel. Max size is 0x100. ErrDisp doesn't do anything in the cmd-handler for this command at all, besides checking the command header and buffer header.

output, where *((u8*)errinfo) == 4

Entry Format string Format args Description
PID 0x%08X_0x%08X 0x41900000, *(u32*)(errinfo + 0x10) Process ID
REV %d (*(u8*)(errinfo + 1) << 16) ?
AID 0x%08X_0x%08X 0x41900000, *(u32*)(errinfo + 0x18) Application ID?
RSL 0x%08X *(u32*)(errinfo + 4) Error code
Level %d *(u32*)(errinfo + 4) & 0x80000000 ? (*(u32*)(errinfo + 4) >> 0x27) - 0x20 : *(u32*)(errinfo + 4) >> 0x27 Error code level
Summary %d (*(u32*)(errinfo + 4) & 0x7E00000) >> 21 Error code summary
Module %d (*(u32*)(errinfo + 4) & 0x3FC00) >> 10 Error code module
Desc %d (*(u32*)(errinfo + 4) << 22) >> 22 Error code description
? %0.*s 0x2E, for (int i = 0; i < 2; i++) (errinfo + (((i << 3) - i) + (i << 4)) << 1) + 0x20 ?
Datetime %04d/%02d/%02d %02d:%02d:%02d ? ?