rosilina: save errdisp info before doing anything else

This commit is contained in:
oreo639 2019-10-22 16:03:00 -07:00
parent a2e46919c1
commit 0886b10619

View File

@ -50,6 +50,11 @@ static inline int ERRF_FormatRegisterValue(char *out, const char *name, u32 valu
return sprintf(out, "%-9s %08lx", name, value);
}
static inline void ERRF_GetErrInfo(ERRF_FatalErrInfo* info, u32* in, u32 size)
{
memcpy(info, in, size);
}
static int ERRF_FormatError(char *out, ERRF_FatalErrInfo *info)
{
char *outStart = out;
@ -154,7 +159,7 @@ static int ERRF_FormatError(char *out, ERRF_FatalErrInfo *info)
desc = "The System Memory has been damaged.";
break;
case ERRF_ERRTYPE_FAILURE:
info->data.failure_mesg[0x60] = 0; // make sure the last byte in the IPC buffer is NULL
info->data.failure_mesg[0x5F] = 0; // make sure the last byte in the IPC buffer is NULL
desc = info->data.failure_mesg;
break;
default:
@ -229,14 +234,15 @@ void ERRF_HandleCommands(void *ctx)
{
(void)ctx;
u32 *cmdbuf = getThreadCommandBuffer();
ERRF_FatalErrInfo info;
switch(cmdbuf[0] >> 16)
{
case 1: // Throw
{
ERRF_FatalErrInfo *info = (ERRF_FatalErrInfo *)(cmdbuf + 1);
ERRF_SaveErrorToFile(info);
if(info->type != ERRF_ERRTYPE_LOGGED || info->procId == 0)
ERRF_GetErrInfo(&info, (cmdbuf + 1), sizeof(ERRF_FatalErrInfo));
ERRF_SaveErrorToFile(&info);
if(info.type != ERRF_ERRTYPE_LOGGED || info.procId == 0)
{
menuEnter();
@ -244,7 +250,7 @@ void ERRF_HandleCommands(void *ctx)
Draw_ClearFramebuffer();
Draw_FlushFramebuffer();
ERRF_DisplayError(info);
ERRF_DisplayError(&info);
/*
If we ever wanted to return: