From e77b83cf1b76fa4a3774e10e554300adfb1c76ce Mon Sep 17 00:00:00 2001 From: Tharo <17233964+Thar0@users.noreply.github.com> Date: Mon, 2 Jan 2023 10:52:56 +0000 Subject: [PATCH] Import fault bss under NON_MATCHING (#1484) * Import fault bss under NON_MATCHING * Fix comments in data files * Fix variable name --- data/fault.bss.s | 2 ++ data/fault_drawer.bss.s | 6 ++++-- spec | 4 +++- src/code/fault.c | 11 ++++++++++- src/code/fault_drawer.c | 8 ++++++++ 5 files changed, 27 insertions(+), 4 deletions(-) diff --git a/data/fault.bss.s b/data/fault.bss.s index b66f9cf837..d8d76a0518 100644 --- a/data/fault.bss.s +++ b/data/fault.bss.s @@ -7,6 +7,8 @@ .section .bss +# Note: This file is only included in the MATCHING build, the data is imported for non-matching + .balign 16 glabel sFaultInstance diff --git a/data/fault_drawer.bss.s b/data/fault_drawer.bss.s index 8642064c48..0c64984b33 100644 --- a/data/fault_drawer.bss.s +++ b/data/fault_drawer.bss.s @@ -7,10 +7,12 @@ .section .bss +# Note: This file is only included in the MATCHING build, the data is imported for non-matching + .balign 16 glabel sFaultDrawer .space 0x3C -glabel D_8016B6C0 - .space 0x20 +glabel D_8016B6BC + .space 0x24 diff --git a/spec b/spec index 5ab17d2ee1..c515af7e92 100644 --- a/spec +++ b/spec @@ -409,9 +409,11 @@ beginseg include "build/src/code/irqmgr.o" include "build/src/code/debug_malloc.o" include "build/src/code/fault.o" - include "build/data/fault.bss.o" include "build/src/code/fault_drawer.o" +#ifndef NON_MATCHING + include "build/data/fault.bss.o" include "build/data/fault_drawer.bss.o" +#endif include "build/src/code/kanread.o" include "build/src/code/ucode_disas.o" pad_text // audio library aligned to 32 bytes? diff --git a/src/code/fault.c b/src/code/fault.c index 4a302d9f3b..97aeaa75dc 100644 --- a/src/code/fault.c +++ b/src/code/fault.c @@ -76,12 +76,21 @@ const char* sFpExceptionNames[] = { "Unimplemented operation", "Invalid operation", "Division by zero", "Overflow", "Underflow", "Inexact operation", }; -// TODO: import .bss (has reordering issues) +#ifndef NON_MATCHING +// TODO: match .bss (has reordering issues) extern FaultMgr* sFaultInstance; extern u8 sFaultAwaitingInput; extern STACK(sFaultStack, 0x600); extern StackEntry sFaultThreadInfo; extern FaultMgr gFaultMgr; +#else +// Non-matching version for struct shiftability +FaultMgr* sFaultInstance; +u8 sFaultAwaitingInput; +STACK(sFaultStack, 0x600); +StackEntry sFaultThreadInfo; +FaultMgr gFaultMgr; +#endif typedef struct { /* 0x00 */ s32 (*callback)(void*, void*); diff --git a/src/code/fault_drawer.c b/src/code/fault_drawer.c index 49bcdd6898..121b7d29b0 100644 --- a/src/code/fault_drawer.c +++ b/src/code/fault_drawer.c @@ -99,7 +99,15 @@ FaultDrawer sFaultDrawerDefault = { NULL, }; +#ifndef NON_MATCHING +// TODO: match .bss (has reordering issues) extern FaultDrawer sFaultDrawer; +extern char D_8016B6BC[0x24]; +#else +// Non-matching version for struct shiftability +FaultDrawer sFaultDrawer; +char D_8016B6BC[0x24]; +#endif void FaultDrawer_SetOsSyncPrintfEnabled(u32 enabled) { sFaultDrawer.osSyncPrintfEnabled = enabled;