Merge pull request #1332 from Oreo639/errdisp

rosilina: save errdisp info before doing anything else
This commit is contained in:
TuxSH 2019-11-05 00:14:07 +00:00 committed by GitHub
commit 0e1415299a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

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); 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) static int ERRF_FormatError(char *out, ERRF_FatalErrInfo *info)
{ {
char *outStart = out; char *outStart = out;
@ -154,7 +159,7 @@ static int ERRF_FormatError(char *out, ERRF_FatalErrInfo *info)
desc = "The System Memory has been damaged."; desc = "The System Memory has been damaged.";
break; break;
case ERRF_ERRTYPE_FAILURE: 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; desc = info->data.failure_mesg;
break; break;
default: default:
@ -229,14 +234,15 @@ void ERRF_HandleCommands(void *ctx)
{ {
(void)ctx; (void)ctx;
u32 *cmdbuf = getThreadCommandBuffer(); u32 *cmdbuf = getThreadCommandBuffer();
ERRF_FatalErrInfo info;
switch(cmdbuf[0] >> 16) switch(cmdbuf[0] >> 16)
{ {
case 1: // Throw case 1: // Throw
{ {
ERRF_FatalErrInfo *info = (ERRF_FatalErrInfo *)(cmdbuf + 1); ERRF_GetErrInfo(&info, (cmdbuf + 1), sizeof(ERRF_FatalErrInfo));
ERRF_SaveErrorToFile(info); ERRF_SaveErrorToFile(&info);
if(info->type != ERRF_ERRTYPE_LOGGED || info->procId == 0) if(info.type != ERRF_ERRTYPE_LOGGED || info.procId == 0)
{ {
menuEnter(); menuEnter();
@ -244,7 +250,7 @@ void ERRF_HandleCommands(void *ctx)
Draw_ClearFramebuffer(); Draw_ClearFramebuffer();
Draw_FlushFramebuffer(); Draw_FlushFramebuffer();
ERRF_DisplayError(info); ERRF_DisplayError(&info);
/* /*
If we ever wanted to return: If we ever wanted to return: