From 26dd61e4e6352a35c0e69e804e093ba0a6025f9b Mon Sep 17 00:00:00 2001 From: TuxSH Date: Mon, 5 Jun 2017 20:28:33 +0200 Subject: [PATCH] Fix (work around) Nintendo own HM bug, GG Ninty --- .../kernel_extension/include/fatalExceptionHandlers.h | 3 +-- .../kernel_extension/source/fatalExceptionHandlers.s | 2 ++ .../kernel_extension/source/fatalExceptionHandlersMain.c | 6 +++++- 3 files changed, 8 insertions(+), 3 deletions(-) diff --git a/sysmodules/rosalina/kernel_extension/include/fatalExceptionHandlers.h b/sysmodules/rosalina/kernel_extension/include/fatalExceptionHandlers.h index bf5e9eb..2deccb9 100644 --- a/sysmodules/rosalina/kernel_extension/include/fatalExceptionHandlers.h +++ b/sysmodules/rosalina/kernel_extension/include/fatalExceptionHandlers.h @@ -28,10 +28,9 @@ #include "types.h" -bool isExceptionFatal(u32 spsr); +bool isExceptionFatal(u32 spsr, u32 *regs, u32 index); bool isDataAbortExceptionRangeControlled(u32 spsr, u32 addr); - void FIQHandler(void); void undefinedInstructionHandler(void); void prefetchAbortHandler(void); diff --git a/sysmodules/rosalina/kernel_extension/source/fatalExceptionHandlers.s b/sysmodules/rosalina/kernel_extension/source/fatalExceptionHandlers.s index d0f7b9d..30a9aec 100644 --- a/sysmodules/rosalina/kernel_extension/source/fatalExceptionHandlers.s +++ b/sysmodules/rosalina/kernel_extension/source/fatalExceptionHandlers.s @@ -47,6 +47,8 @@ push {r0-r12, lr} mrs r0, spsr + mov r1, sp + mov r2, #\index bl isExceptionFatal cmp r0, #0 pop {r0-r12, lr} diff --git a/sysmodules/rosalina/kernel_extension/source/fatalExceptionHandlersMain.c b/sysmodules/rosalina/kernel_extension/source/fatalExceptionHandlersMain.c index 8879ae7..295c898 100644 --- a/sysmodules/rosalina/kernel_extension/source/fatalExceptionHandlersMain.c +++ b/sysmodules/rosalina/kernel_extension/source/fatalExceptionHandlersMain.c @@ -33,7 +33,7 @@ #define REG_DUMP_SIZE 4 * 23 #define CODE_DUMP_SIZE 48 -bool isExceptionFatal(u32 spsr) +bool isExceptionFatal(u32 spsr, u32 *regs, u32 index) { if((spsr & 0x1f) != 0x10) return true; @@ -51,6 +51,10 @@ bool isExceptionFatal(u32 spsr) thread = KPROCESS_GET_RVALUE(currentProcess, mainThread); if(thread != NULL && thread->threadLocalStorage != NULL && *((vu32 *)thread->threadLocalStorage + 0x10) != 0) return false; + + if(index == 3 && strcmp(codeSetOfProcess(currentProcess)->processName, "menu") == 0 && // workaround a Home Menu bug leading to a dabort + regs[0] == 0x3FFF && regs[2] == 0 && regs[5] == 2 && regs[7] == 1) + return false; } return true;