Skip to content

Commit

Permalink
Import fault bss under NON_MATCHING (#1484)
Browse files Browse the repository at this point in the history
* Import fault bss under NON_MATCHING

* Fix comments in data files

* Fix variable name
  • Loading branch information
Thar0 authored Jan 2, 2023
1 parent e37b993 commit e77b83c
Show file tree
Hide file tree
Showing 5 changed files with 27 additions and 4 deletions.
2 changes: 2 additions & 0 deletions data/fault.bss.s
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
6 changes: 4 additions & 2 deletions data/fault_drawer.bss.s
Original file line number Diff line number Diff line change
Expand Up @@ -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
4 changes: 3 additions & 1 deletion spec
Original file line number Diff line number Diff line change
Expand Up @@ -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?
Expand Down
11 changes: 10 additions & 1 deletion src/code/fault.c
Original file line number Diff line number Diff line change
Expand Up @@ -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*);
Expand Down
8 changes: 8 additions & 0 deletions src/code/fault_drawer.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit e77b83c

Please sign in to comment.