Files
dusklight/libs/dolphin/src/db/db.c
T
Luke Street 4df8ccc871 Reorganize library code into libs/ (#3119)
* Reorganize files into libs/{dolphin,JSystem,PowerPC_EABI_Support,revolution,TRK_MINNOW_DOLPHIN}

* Update configure.py and project.py for new libs structure

* Refactor `#include <dolphin/x.h>` -> `<x.h>`

* Remove `__REVOLUTION_SDK__` forwards from dolphin

* Fix dolphin/ references in revolution

* Wrap `#include <dolphin.h>` in `!__REVOLUTION_SDK__`

* Always build TRK against dolphin headers

* Resolve revolution SDK header resolution issues
2026-03-01 14:35:36 -08:00

60 lines
1.4 KiB
C

#include <dolphin/base/PPCArch.h>
#include <dolphin/db.h>
#include <dolphin/os.h>
u8 DBStack[0x1000];
u8* DBStackEnd = DBStack + (sizeof(DBStack) - 8);
BOOL DBVerbose;
DBInterface* __DBInterface;
void DBInit(void) {
__DBInterface = OSPhysicalToCached(0x40);
__DBInterface->ExceptionDestination = (void *)OSCachedToPhysical(__DBExceptionDestination);
DBVerbose = TRUE;
}
BOOL DBIsDebuggerPresent(void) {
if (__DBInterface == NULL)
return FALSE;
return __DBInterface->bPresent;
}
void __DBExceptionDestinationAux(void) {
u32* contextAddr;
OSContext* context;
contextAddr = (void*)0xC0;
context = OSPhysicalToCached(*contextAddr);
OSReport("DBExceptionDestination\n");
OSDumpContext(context);
PPCHalt();
}
asm void __DBExceptionDestination(void) {
nofralloc
mfmsr r3
ori r3, r3, 0x30
mtmsr r3
b __DBExceptionDestinationAux
}
BOOL __DBIsExceptionMarked(__OSException exception) {
u32 mask = (1 << exception);
return __DBInterface->exceptionMask & mask;
}
void __DBMarkException(__OSException exception, int value) {
u32 mask = (1 << exception);
if (value != 0)
__DBInterface->exceptionMask = __DBInterface->exceptionMask | mask;
else
__DBInterface->exceptionMask = __DBInterface->exceptionMask & ~mask;
}
void __DBSetPresent(u32 value) {
__DBInterface->bPresent = value;
}
void DBPrintf(char* str, ...) {}