thermosphere: fix bug in exceptionReturnPreprocess

This commit is contained in:
TuxSH 2020-02-01 22:09:07 +00:00
parent c67ff366ea
commit 0b7efc0501
2 changed files with 18 additions and 15 deletions

View file

@ -127,7 +127,8 @@ void exceptionEntryPostprocess(ExceptionStackFrame *frame, bool isLowerEl)
// Called on exception return (avoids overflowing a vector section)
void exceptionReturnPreprocess(ExceptionStackFrame *frame)
{
if (currentCoreCtx->wasPaused && frame == currentCoreCtx->guestFrame) {
if (frame == currentCoreCtx->guestFrame) {
if (currentCoreCtx->wasPaused) {
// Were we paused & are we about to return to the guest?
exceptionEnterInterruptibleHypervisorCode();
while (!debugManagerHandlePause());
@ -135,7 +136,8 @@ void exceptionReturnPreprocess(ExceptionStackFrame *frame)
}
// Update virtual counter
currentCoreCtx->totalTimeInHypervisor += timerGetSystemTick() - frame->cntpct_el0;
u64 ticksNow = timerGetSystemTick();
currentCoreCtx->totalTimeInHypervisor += ticksNow - frame->cntpct_el0;
SET_SYSREG(cntvoff_el2, currentCoreCtx->totalTimeInHypervisor);
if (frame == currentCoreCtx->guestFrame) {
@ -143,6 +145,7 @@ void exceptionReturnPreprocess(ExceptionStackFrame *frame)
SET_SYSREG(cntp_ctl_el0, frame->cntp_ctl_el0);
SET_SYSREG(cntv_ctl_el0, frame->cntv_ctl_el0);
}
}
}
void handleLowerElSyncException(ExceptionStackFrame *frame)

View file

@ -206,7 +206,7 @@ void handleIrqException(ExceptionStackFrame *frame, bool isLowerEl, bool isA32)
u32 irqId = iar & 0x3FF;
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) {
// Spurious interrupt received