mirror of
https://github.com/Atmosphere-NX/Atmosphere.git
synced 2024-12-18 16:32:05 +00:00
thermosphere: fix bug in exceptionReturnPreprocess
This commit is contained in:
parent
c67ff366ea
commit
0b7efc0501
2 changed files with 18 additions and 15 deletions
|
@ -127,21 +127,24 @@ void exceptionEntryPostprocess(ExceptionStackFrame *frame, bool isLowerEl)
|
||||||
// Called on exception return (avoids overflowing a vector section)
|
// Called on exception return (avoids overflowing a vector section)
|
||||||
void exceptionReturnPreprocess(ExceptionStackFrame *frame)
|
void exceptionReturnPreprocess(ExceptionStackFrame *frame)
|
||||||
{
|
{
|
||||||
if (currentCoreCtx->wasPaused && frame == currentCoreCtx->guestFrame) {
|
|
||||||
// Were we paused & are we about to return to the guest?
|
|
||||||
exceptionEnterInterruptibleHypervisorCode();
|
|
||||||
while (!debugManagerHandlePause());
|
|
||||||
fpuCleanInvalidateRegisterCache();
|
|
||||||
}
|
|
||||||
|
|
||||||
// Update virtual counter
|
|
||||||
currentCoreCtx->totalTimeInHypervisor += timerGetSystemTick() - frame->cntpct_el0;
|
|
||||||
SET_SYSREG(cntvoff_el2, currentCoreCtx->totalTimeInHypervisor);
|
|
||||||
|
|
||||||
if (frame == currentCoreCtx->guestFrame) {
|
if (frame == currentCoreCtx->guestFrame) {
|
||||||
// Restore interrupt mask
|
if (currentCoreCtx->wasPaused) {
|
||||||
SET_SYSREG(cntp_ctl_el0, frame->cntp_ctl_el0);
|
// Were we paused & are we about to return to the guest?
|
||||||
SET_SYSREG(cntv_ctl_el0, frame->cntv_ctl_el0);
|
exceptionEnterInterruptibleHypervisorCode();
|
||||||
|
while (!debugManagerHandlePause());
|
||||||
|
fpuCleanInvalidateRegisterCache();
|
||||||
|
}
|
||||||
|
|
||||||
|
// Update virtual counter
|
||||||
|
u64 ticksNow = timerGetSystemTick();
|
||||||
|
currentCoreCtx->totalTimeInHypervisor += ticksNow - frame->cntpct_el0;
|
||||||
|
SET_SYSREG(cntvoff_el2, currentCoreCtx->totalTimeInHypervisor);
|
||||||
|
|
||||||
|
if (frame == currentCoreCtx->guestFrame) {
|
||||||
|
// Restore interrupt mask
|
||||||
|
SET_SYSREG(cntp_ctl_el0, frame->cntp_ctl_el0);
|
||||||
|
SET_SYSREG(cntv_ctl_el0, frame->cntv_ctl_el0);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -206,7 +206,7 @@ void handleIrqException(ExceptionStackFrame *frame, bool isLowerEl, bool isA32)
|
||||||
u32 irqId = iar & 0x3FF;
|
u32 irqId = iar & 0x3FF;
|
||||||
u32 srcCore = (iar >> 10) & 7;
|
u32 srcCore = (iar >> 10) & 7;
|
||||||
|
|
||||||
DEBUG("EL2 [core %d]: Received irq %x\n", (int)currentCoreCtx->coreId, irqId);
|
//DEBUG("EL2 [core %d]: Received irq %x\n", (int)currentCoreCtx->coreId, irqId);
|
||||||
|
|
||||||
if (irqId == GIC_IRQID_SPURIOUS) {
|
if (irqId == GIC_IRQID_SPURIOUS) {
|
||||||
// Spurious interrupt received
|
// Spurious interrupt received
|
||||||
|
|
Loading…
Reference in a new issue