Refactor fatal/hard error names

This commit is contained in:
CTCaer 2020-07-14 22:41:48 +03:00
parent 1f67251331
commit ab5b59e10d
3 changed files with 32 additions and 32 deletions

View file

@ -331,23 +331,23 @@ static const char *get_error_desc(u32 error_desc)
switch (error_desc) switch (error_desc)
{ {
case 0x100: case 0x100:
return "Instruction Abort"; return "IABRT";
case 0x101: case 0x101:
return "Data Abort"; return "DABRT";
case 0x102: case 0x102:
return "PC Misalignment"; return "PC-UA";
case 0x103: case 0x103:
return "SP Misalignment"; return "SP-UA";
case 0x104: case 0x104:
return "Trap"; return "TRAP";
case 0x106: case 0x106:
return "SError"; return "SE";
case 0x301: case 0x301:
return "Bad SVC"; return "SVC";
case 0xFFE: case 0xFFE:
return "std::abort()"; return "std::abort";
default: default:
return "Unknown"; return "UNK";
} }
} }
@ -359,12 +359,15 @@ void secmon_exo_check_panic()
if ((rpt->magic & 0xF0FFFFFF) != ATM_FATAL_MAGIC) if ((rpt->magic & 0xF0FFFFFF) != ATM_FATAL_MAGIC)
return; return;
// Change magic to invalid, to prevent double-display of error/bootlooping.
rpt->magic = 0;
gfx_clear_grey(0x1B); gfx_clear_grey(0x1B);
gfx_con_setpos(0, 0); gfx_con_setpos(0, 0);
WPRINTF("Panic occurred while running Atmosphere.\n\n"); WPRINTF("Panic occurred while running Atmosphere.\n\n");
WPRINTFARGS("Title ID: %08X%08X", (u32)((u64)rpt->title_id >> 32), (u32)rpt->title_id); WPRINTFARGS("Title ID: %08X%08X", (u32)((u64)rpt->title_id >> 32), (u32)rpt->title_id);
WPRINTFARGS("Error Desc: %s (0x%x)\n", get_error_desc(rpt->error_desc), rpt->error_desc); WPRINTFARGS("Error: %s (0x%x)\n", get_error_desc(rpt->error_desc), rpt->error_desc);
// Save context to the SD card. // Save context to the SD card.
char filepath[0x40]; char filepath[0x40];
@ -374,23 +377,20 @@ void secmon_exo_check_panic()
itoa((u32)(rpt->report_identifier), filepath + strlen(filepath), 16); itoa((u32)(rpt->report_identifier), filepath + strlen(filepath), 16);
strcat(filepath, ".bin"); strcat(filepath, ".bin");
sd_save_to_file((void *)rpt, sizeof(atm_fatal_error_ctx), filepath); if (!sd_save_to_file((void *)rpt, sizeof(atm_fatal_error_ctx), filepath))
{
gfx_con.fntsz = 8;
WPRINTFARGS("Report saved to %s\n", filepath);
gfx_con.fntsz = 16;
}
gfx_con.fntsz = 8;
WPRINTFARGS("Report saved to %s\n", filepath);
// Change magic to invalid, to prevent double-display of error/bootlooping.
rpt->magic = 0x0;
gfx_con.fntsz = 16;
gfx_printf("\n\nPress POWER to continue.\n"); gfx_printf("\n\nPress POWER to continue.\n");
display_backlight_brightness(100, 1000); display_backlight_brightness(100, 1000);
msleep(1000); msleep(1000);
u32 btn = btn_wait(); while (!(btn_wait() & BTN_POWER))
while (!(btn & BTN_POWER)) ;
btn = btn_wait();
display_backlight_brightness(0, 1000); display_backlight_brightness(0, 1000);
gfx_con_setpos(0, 0); gfx_con_setpos(0, 0);

View file

@ -692,7 +692,7 @@ void nyx_load_run()
WPRINTF("\nUpdate your bootloader folder!\n\n"); WPRINTF("\nUpdate your bootloader folder!\n\n");
WPRINTF("Press any key..."); WPRINTF("Press any key...");
msleep(2000); msleep(1000);
btn_wait(); btn_wait();
} }
@ -1166,16 +1166,16 @@ static void _show_errors()
switch (*excp_type) switch (*excp_type)
{ {
case EXCP_TYPE_RESET: case EXCP_TYPE_RESET:
WPRINTF("Reset"); WPRINTF("RST");
break; break;
case EXCP_TYPE_UNDEF: case EXCP_TYPE_UNDEF:
WPRINTF("Undefined instruction"); WPRINTF("UNDEF");
break; break;
case EXCP_TYPE_PABRT: case EXCP_TYPE_PABRT:
WPRINTF("Prefetch abort"); WPRINTF("PABRT");
break; break;
case EXCP_TYPE_DABRT: case EXCP_TYPE_DABRT:
WPRINTF("Data abort"); WPRINTF("DABRT");
break; break;
} }
WPRINTF("\n"); WPRINTF("\n");
@ -1186,7 +1186,7 @@ static void _show_errors()
WPRINTF("Press any key..."); WPRINTF("Press any key...");
msleep(2000); msleep(1000);
btn_wait(); btn_wait();
} }
} }

View file

@ -307,16 +307,16 @@ static void _show_errors()
switch (*excp_type) switch (*excp_type)
{ {
case EXCP_TYPE_RESET: case EXCP_TYPE_RESET:
WPRINTF("Reset"); WPRINTF("RST");
break; break;
case EXCP_TYPE_UNDEF: case EXCP_TYPE_UNDEF:
WPRINTF("Undefined instruction"); WPRINTF("UNDEF");
break; break;
case EXCP_TYPE_PABRT: case EXCP_TYPE_PABRT:
WPRINTF("Prefetch abort"); WPRINTF("PABRT");
break; break;
case EXCP_TYPE_DABRT: case EXCP_TYPE_DABRT:
WPRINTF("Data abort"); WPRINTF("DABRT");
break; break;
} }
WPRINTF("\n"); WPRINTF("\n");