From 0886b10619e5cc7c73ef739ea65f3d0c6f254c52 Mon Sep 17 00:00:00 2001 From: oreo639 <31916379+Oreo639@users.noreply.github.com> Date: Tue, 22 Oct 2019 16:03:00 -0700 Subject: [PATCH] rosilina: save errdisp info before doing anything else --- sysmodules/rosalina/source/errdisp.c | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/sysmodules/rosalina/source/errdisp.c b/sysmodules/rosalina/source/errdisp.c index 914895f..bcffea3 100644 --- a/sysmodules/rosalina/source/errdisp.c +++ b/sysmodules/rosalina/source/errdisp.c @@ -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: