mirror of
https://github.com/Atmosphere-NX/Atmosphere.git
synced 2025-01-05 17:16:08 +00:00
thermosphere: resend debug event if not handled
This commit is contained in:
parent
984f6776c6
commit
ff1aac0ab5
3 changed files with 21 additions and 6 deletions
|
@ -69,7 +69,7 @@ void debugManagerPauseSgiHandler(void)
|
||||||
barrierWait(&g_debugManager.pauseBarrier);
|
barrierWait(&g_debugManager.pauseBarrier);
|
||||||
}
|
}
|
||||||
|
|
||||||
void debugManagerHandlePause(void)
|
bool debugManagerHandlePause(void)
|
||||||
{
|
{
|
||||||
u32 coreId = currentCoreCtx->coreId;
|
u32 coreId = currentCoreCtx->coreId;
|
||||||
__builtin_prefetch(&g_debugManager.pausedCoreList, 0, 3);
|
__builtin_prefetch(&g_debugManager.pausedCoreList, 0, 3);
|
||||||
|
@ -80,6 +80,13 @@ void debugManagerHandlePause(void)
|
||||||
__wfe();
|
__wfe();
|
||||||
} while (atomic_load(&g_debugManager.pausedCoreList) & BIT(coreId));
|
} while (atomic_load(&g_debugManager.pausedCoreList) & BIT(coreId));
|
||||||
maskIrq();
|
maskIrq();
|
||||||
|
|
||||||
|
if (!g_debugManager.debugEventInfos[coreId].handled) {
|
||||||
|
// Do we still have an unhandled debug event?
|
||||||
|
// TODO build
|
||||||
|
//GDB_TrySignalDebugEvent(&g_gdbContext, &g_debugManager.debugEventInfos[coreId]);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
currentCoreCtx->wasPaused = false;
|
currentCoreCtx->wasPaused = false;
|
||||||
|
@ -92,6 +99,8 @@ void debugManagerHandlePause(void)
|
||||||
} else if (!ssReqd && singleStepState != SingleStepState_Inactive) {
|
} else if (!ssReqd && singleStepState != SingleStepState_Inactive) {
|
||||||
singleStepSetNextState(currentCoreCtx->guestFrame, SingleStepState_Inactive);
|
singleStepSetNextState(currentCoreCtx->guestFrame, SingleStepState_Inactive);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void debugManagerPauseCores(u32 coreList)
|
void debugManagerPauseCores(u32 coreList)
|
||||||
|
@ -105,7 +114,12 @@ void debugManagerUnpauseCores(u32 coreList, u32 singleStepList)
|
||||||
{
|
{
|
||||||
singleStepList &= coreList;
|
singleStepList &= coreList;
|
||||||
|
|
||||||
__builtin_prefetch(&g_debugManager.pausedCoreList, 1, 0);
|
FOREACH_BIT (tmp, coreId, coreList) {
|
||||||
|
if (&g_debugManager.debugEventInfos[coreId].handled) {
|
||||||
|
// Discard already handled debug events
|
||||||
|
g_debugManager.debugEventInfos[coreId].type = DBGEVENT_NONE;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Since we're using a debugger lock, a simple stlr should be fine...
|
// Since we're using a debugger lock, a simple stlr should be fine...
|
||||||
atomic_store(&g_debugManager.singleStepCoreList, singleStepList);
|
atomic_store(&g_debugManager.singleStepCoreList, singleStepList);
|
||||||
|
@ -156,7 +170,7 @@ void debugManagerReportEvent(DebugEventType type, ...)
|
||||||
exceptionEnterInterruptibleHypervisorCode();
|
exceptionEnterInterruptibleHypervisorCode();
|
||||||
unmaskIrq();
|
unmaskIrq();
|
||||||
|
|
||||||
GDB_TrySignalDebugEvent(&g_gdbContext, info);
|
// TODO GDB_TrySignalDebugEvent(&g_gdbContext, info);
|
||||||
|
|
||||||
restoreInterruptFlags(flags);
|
restoreInterruptFlags(flags);
|
||||||
}
|
}
|
||||||
|
|
|
@ -22,7 +22,8 @@
|
||||||
extern GDBContext g_gdbContext;
|
extern GDBContext g_gdbContext;
|
||||||
|
|
||||||
typedef enum DebugEventType {
|
typedef enum DebugEventType {
|
||||||
DBGEVENT_DEBUGGER_BREAK = 0,
|
DBGEVENT_NONE = 0,
|
||||||
|
DBGEVENT_DEBUGGER_BREAK,
|
||||||
DBGEVENT_EXCEPTION,
|
DBGEVENT_EXCEPTION,
|
||||||
DBGEVENT_CORE_ON,
|
DBGEVENT_CORE_ON,
|
||||||
DBGEVENT_CORE_OFF,
|
DBGEVENT_CORE_OFF,
|
||||||
|
@ -48,7 +49,7 @@ typedef struct DebugEventInfo {
|
||||||
void debugManagerPauseSgiHandler(void);
|
void debugManagerPauseSgiHandler(void);
|
||||||
|
|
||||||
// Hypervisor interrupts will be serviced during the pause-wait
|
// Hypervisor interrupts will be serviced during the pause-wait
|
||||||
void debugManagerHandlePause(void);
|
bool debugManagerHandlePause(void);
|
||||||
|
|
||||||
// Note: these functions are not reentrant EXCEPT debugPauseCores(1 << currentCoreId)
|
// Note: these functions are not reentrant EXCEPT debugPauseCores(1 << currentCoreId)
|
||||||
// "Pause" makes sure all cores reaches the pause function before proceeding.
|
// "Pause" makes sure all cores reaches the pause function before proceeding.
|
||||||
|
|
|
@ -122,7 +122,7 @@ void exceptionReturnPreprocess(ExceptionStackFrame *frame)
|
||||||
if (currentCoreCtx->wasPaused && frame == currentCoreCtx->guestFrame) {
|
if (currentCoreCtx->wasPaused && frame == currentCoreCtx->guestFrame) {
|
||||||
// Were we paused & are we about to return to the guest?
|
// Were we paused & are we about to return to the guest?
|
||||||
exceptionEnterInterruptibleHypervisorCode();
|
exceptionEnterInterruptibleHypervisorCode();
|
||||||
debugManagerHandlePause();
|
while (!debugManagerHandlePause());
|
||||||
fpuCleanInvalidateRegisterCache();
|
fpuCleanInvalidateRegisterCache();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue