From eb1a610f9217e0d1d0332d2e3f7f696c9eef7337 Mon Sep 17 00:00:00 2001 From: CreeperMario Date: Thu, 11 Jan 2018 18:21:06 +1030 Subject: [PATCH] whb: Exception handler now works * The context structure for the crash handler thread needs to be aligned to at least 8 bytes. * In my cases, the entry at the bottom of my stack always has a back-chain value of 0x1. Of course, this address is not likely to be part of the stack, so this should be considered to be the end of the stack. * During ISI exceptions, only a stack trace is printed, and during DSI, disassembly and stack information is printed. For some unknown reason, I never see register dumps. --- src/libwhb/src/crash.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/libwhb/src/crash.c b/src/libwhb/src/crash.c index 65095d2..85f5b14 100644 --- a/src/libwhb/src/crash.c +++ b/src/libwhb/src/crash.c @@ -40,7 +40,7 @@ sRegistersLength = 0; static uint8_t sCrashThreadStack[THREAD_STACK_SIZE]; -static OSThread +static OSThread __attribute__((aligned(8))) sCrashThread; static int @@ -96,7 +96,7 @@ getStackTrace(OSContext *context) for (i = 0; i < 16; ++i) { uint32_t addr; - if (!stackPtr || (uintptr_t)stackPtr == 0xFFFFFFFF) { + if (!stackPtr || (uintptr_t)stackPtr == 0x1 || (uintptr_t)stackPtr == 0xFFFFFFFF) { break; }