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)
{
case 0x100:
return "Instruction Abort";
return "IABRT";
case 0x101:
return "Data Abort";
return "DABRT";
case 0x102:
return "PC Misalignment";
return "PC-UA";
case 0x103:
return "SP Misalignment";
return "SP-UA";
case 0x104:
return "Trap";
return "TRAP";
case 0x106:
return "SError";
return "SE";
case 0x301:
return "Bad SVC";
return "SVC";
case 0xFFE:
return "std::abort()";
return "std::abort";
default:
return "Unknown";
return "UNK";
}
}
@ -359,12 +359,15 @@ void secmon_exo_check_panic()
if ((rpt->magic & 0xF0FFFFFF) != ATM_FATAL_MAGIC)
return;
// Change magic to invalid, to prevent double-display of error/bootlooping.
rpt->magic = 0;
gfx_clear_grey(0x1B);
gfx_con_setpos(0, 0);
WPRINTF("Panic occurred while running Atmosphere.\n\n");
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.
char filepath[0x40];
@ -374,23 +377,20 @@ void secmon_exo_check_panic()
itoa((u32)(rpt->report_identifier), filepath + strlen(filepath), 16);
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);
// 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");
display_backlight_brightness(100, 1000);
msleep(1000);
u32 btn = btn_wait();
while (!(btn & BTN_POWER))
btn = btn_wait();
while (!(btn_wait() & BTN_POWER))
;
display_backlight_brightness(0, 1000);
gfx_con_setpos(0, 0);

View file

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

View file

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