Changeset 100001 in vbox for trunk/src/VBox/VMM/VMMR3
- Timestamp:
- May 30, 2023 6:11:02 AM (20 months ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/VMM/VMMR3/NEMR3Native-darwin-armv8.cpp
r99976 r100001 51 51 #include <iprt/asm.h> 52 52 #include <iprt/asm-arm.h> 53 #include <iprt/asm-math.h> 53 54 #include <iprt/ldr.h> 54 55 #include <iprt/mem.h> … … 1036 1037 return nemR3DarwinHandleExitExceptionTrappedHvcInsn(pVM, pVCpu, uIss); 1037 1038 case ARMV8_ESR_EL2_EC_TRAPPED_WFX: 1038 return VINF_SUCCESS; /** @todo VINF_EM_HALT; We don't get notified about the vTimer if halting here currently leading to a guest hang...*/ 1039 { 1040 /* No need to halt if there is an interrupt pending already. */ 1041 if (VMCPU_FF_IS_ANY_SET(pVCpu, (VMCPU_FF_INTERRUPT_IRQ | VMCPU_FF_INTERRUPT_FIQ))) 1042 return VINF_SUCCESS; 1043 1044 /* Set the vTimer expiration in order to get out of the halt at the right point in time. */ 1045 if ( (pVCpu->cpum.GstCtx.CntvCtlEl0 & ARMV8_CNTV_CTL_EL0_AARCH64_ENABLE) 1046 && !(pVCpu->cpum.GstCtx.CntvCtlEl0 & ARMV8_CNTV_CTL_EL0_AARCH64_IMASK)) 1047 { 1048 uint64_t cTicksVTimer = ASMReadTSC() - pVCpu->nem.s.u64VTimerOff; 1049 1050 /* Check whether it expired and start executing guest code. */ 1051 if (cTicksVTimer >= pVCpu->cpum.GstCtx.CntvCValEl0) 1052 return VINF_SUCCESS; 1053 1054 uint64_t cTicksVTimerToExpire = pVCpu->cpum.GstCtx.CntvCValEl0 - cTicksVTimer; 1055 uint64_t cNanoSecsVTimerToExpire = ASMMultU64ByU32DivByU32(cTicksVTimerToExpire, RT_NS_1SEC, (uint32_t)pVM->nem.s.u64CntFrqHz); 1056 1057 /* Our halt method doesn't work with sub millisecond granularity at the moment causing a huge slowdown. */ 1058 if (cNanoSecsVTimerToExpire < 20 * RT_NS_1MS) 1059 return VINF_SUCCESS; 1060 1061 TMCpuSetVTimerNextActivation(pVCpu, cNanoSecsVTimerToExpire); 1062 } 1063 else 1064 TMCpuSetVTimerNextActivation(pVCpu, UINT64_MAX); 1065 1066 return VINF_EM_HALT; 1067 } 1039 1068 case ARMV8_ESR_EL2_EC_UNKNOWN: 1040 1069 default: … … 1076 1105 return nemR3DarwinHandleExitException(pVM, pVCpu, pExit); 1077 1106 case HV_EXIT_REASON_VTIMER_ACTIVATED: 1107 { 1108 LogFlowFunc(("vTimer got activated\n")); 1109 TMCpuSetVTimerNextActivation(pVCpu, UINT64_MAX); 1078 1110 pVCpu->nem.s.fVTimerActivated = true; 1079 1111 return GICPpiSet(pVCpu, NEM_DARWIN_VTIMER_GIC_PPI_IRQ, true /*fAsserted*/); 1112 } 1080 1113 default: 1081 1114 AssertReleaseFailed();
Note:
See TracChangeset
for help on using the changeset viewer.