VirtualBox

Changeset 106988 in vbox for trunk/src/VBox/VMM/VMMR3


Ignore:
Timestamp:
Nov 13, 2024 3:01:58 PM (2 months ago)
Author:
vboxsync
Message:

VMM/NEMR3Native-win-armv8.cpp: Some cleanups, bugref:10392

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/VMM/VMMR3/NEMR3Native-win-armv8.cpp

    r106983 r106988  
    18601860                        );
    18611861        char szInstr[256]; RT_ZERO(szInstr);
    1862 #if 0
    18631862        DBGFR3DisasInstrEx(pVM->pUVM, pVCpu->idCpu, 0, 0,
    18641863                           DBGF_DISAS_FLAGS_CURRENT_GUEST | DBGF_DISAS_FLAGS_DEFAULT_MODE,
    18651864                           szInstr, sizeof(szInstr), NULL);
    1866 #endif
    18671865        Log3(("%s%s\n", szRegs, szInstr));
    18681866    }
     
    23592357        nemR3WinSetGReg(pVCpu, ARMV8_AARCH64_REG_X0, false /*f64BitReg*/, false /*fSignExtend*/, (uint64_t)ARM_PSCI_STS_NOT_SUPPORTED);
    23602358
     2359    /** @todo What to do if immediate is != 0? */
     2360
     2361    if (   rcStrict == VINF_SUCCESS
     2362        && fAdvancePc)
     2363        pVCpu->cpum.GstCtx.Pc.u64 += sizeof(uint32_t);
    23612364
    23622365    return rcStrict;
     
    24702473#endif
    24712474
    2472     if (RT_UNLIKELY(!pVCpu->nem.s.fIdRegsSynced))
    2473     {
    2474         /*
    2475          * Sync the guest ID registers which are per VM once (they are readonly and stay constant during VM lifetime).
    2476          * Need to do it here and not during the init because loading a saved state might change the ID registers from what
    2477          * done in the call to CPUMR3PopulateFeaturesByIdRegisters().
    2478          */
    2479         PCCPUMIDREGS pIdRegsGst = NULL;
    2480         int rc = CPUMR3QueryGuestIdRegs(pVM, &pIdRegsGst);
    2481         AssertRCReturn(rc, rc);
    2482 
    2483         WHV_REGISTER_NAME  aenmNames[12];
    2484         WHV_REGISTER_VALUE aValues[12];
    2485 
    2486         uint32_t iReg = 0;
    2487 #define ADD_REG64(a_enmName, a_uValue) do { \
    2488             aenmNames[iReg]      = (a_enmName); \
    2489             aValues[iReg].Reg128.High64 = 0; \
    2490             aValues[iReg].Reg64  = (a_uValue); \
    2491             iReg++; \
    2492         } while (0)
    2493 
    2494 
    2495         ADD_REG64(WHvArm64RegisterIdAa64Mmfr0El1, pIdRegsGst->u64RegIdAa64Mmfr0El1);
    2496 #undef ADD_REG64
    2497 
    2498         //HRESULT hrc = WHvSetVirtualProcessorRegisters(pVM->nem.s.hPartition, pVCpu->idCpu, aenmNames, iReg, aValues);
    2499         //AssertReturn(SUCCEEDED(hrc), VERR_NEM_IPE_9);
    2500 
    2501         pVCpu->nem.s.fIdRegsSynced = true;
    2502     }
    2503 
    25042475    /*
    25052476     * Try switch to NEM runloop state.
     
    25212492     */
    25222493    const bool      fSingleStepping     = DBGFIsStepping(pVCpu);
    2523 //    const uint32_t  fCheckVmFFs         = !fSingleStepping ? VM_FF_HP_R0_PRE_HM_MASK
    2524 //                                                           : VM_FF_HP_R0_PRE_HM_STEP_MASK;
    2525 //    const uint32_t  fCheckCpuFFs        = !fSingleStepping ? VMCPU_FF_HP_R0_PRE_HM_MASK : VMCPU_FF_HP_R0_PRE_HM_STEP_MASK;
    25262494    VBOXSTRICTRC    rcStrict            = VINF_SUCCESS;
    25272495    for (unsigned iLoop = 0;; iLoop++)
    25282496    {
    2529         /*
    2530          * Pending interrupts or such?  Need to check and deal with this prior
    2531          * to the state syncing.
    2532          */
    2533 #if 0
    2534         if (VMCPU_FF_IS_ANY_SET(pVCpu, VMCPU_FF_INTERRUPT_FIQ | VMCPU_FF_UPDATE_IRQ))
    2535         {
    2536             /* Try inject interrupt. */
    2537             rcStrict = nemHCWinHandleInterruptFF(pVM, pVCpu, &pVCpu->nem.s.fDesiredInterruptWindows);
    2538             if (rcStrict == VINF_SUCCESS)
    2539             { /* likely */ }
    2540             else
    2541             {
    2542                 LogFlow(("NEM/%u: breaking: nemHCWinHandleInterruptFF -> %Rrc\n", pVCpu->idCpu, VBOXSTRICTRC_VAL(rcStrict) ));
    2543                 STAM_REL_COUNTER_INC(&pVCpu->nem.s.StatBreakOnStatus);
    2544                 break;
    2545             }
    2546         }
    2547 #endif
    2548 
    25492497        /* Ensure that Hyper-V has the whole state. */
    25502498        int rc2 = nemHCWinCopyStateToHyperV(pVM, pVCpu);
     
    25672515            if (VMCPU_CMPXCHG_STATE(pVCpu, VMCPUSTATE_STARTED_EXEC_NEM_WAIT, VMCPUSTATE_STARTED_EXEC_NEM))
    25682516            {
    2569 #if 0 //def LOG_ENABLED
     2517#ifdef LOG_ENABLED
    25702518                if (LogIsFlowEnabled())
    25712519                {
    2572                     static const WHV_REGISTER_NAME s_aNames[6] = { WHvX64RegisterCs, WHvX64RegisterRip, WHvX64RegisterRflags,
    2573                                                                    WHvX64RegisterSs, WHvX64RegisterRsp, WHvX64RegisterCr0 };
    2574                     WHV_REGISTER_VALUE aRegs[RT_ELEMENTS(s_aNames)] = { {{0, 0} } };
     2520                    static const WHV_REGISTER_NAME s_aNames[2] = { WHvArm64RegisterPc, WHvArm64RegisterPstate };
     2521                    WHV_REGISTER_VALUE aRegs[RT_ELEMENTS(s_aNames)] = { { { {0, 0} } } };
    25752522                    WHvGetVirtualProcessorRegisters(pVM->nem.s.hPartition, pVCpu->idCpu, s_aNames, RT_ELEMENTS(s_aNames), aRegs);
    2576                     LogFlow(("NEM/%u: Entry @ %04x:%08RX64 IF=%d EFL=%#RX64 SS:RSP=%04x:%08RX64 cr0=%RX64\n",
    2577                              pVCpu->idCpu, aRegs[0].Segment.Selector, aRegs[1].Reg64, RT_BOOL(aRegs[2].Reg64 & X86_EFL_IF),
    2578                              aRegs[2].Reg64, aRegs[3].Segment.Selector, aRegs[4].Reg64, aRegs[5].Reg64));
     2523                    LogFlow(("NEM/%u: Entry @ %08RX64 pstate=%#RX64\n", pVCpu->idCpu, aRegs[0].Reg64, aRegs[1].Reg64));
    25792524                }
    25802525#endif
     2526
    25812527                MY_WHV_RUN_VP_EXIT_CONTEXT ExitReason = {0};
    25822528                TMNotifyStartOfExecution(pVM, pVCpu);
     
    25872533                TMNotifyEndOfExecution(pVM, pVCpu, ASMReadTSC());
    25882534#ifdef LOG_ENABLED
    2589                 LogFlow(("NEM/%u: Exit  @ @todo Reason=%#x\n", pVCpu->idCpu, ExitReason.ExitReason));
     2535                if (LogIsFlowEnabled())
     2536                {
     2537                    static const WHV_REGISTER_NAME s_aNames[2] = { WHvArm64RegisterPc, WHvArm64RegisterPstate };
     2538                    WHV_REGISTER_VALUE aRegs[RT_ELEMENTS(s_aNames)] = { { { {0, 0} } } };
     2539                    WHvGetVirtualProcessorRegisters(pVM->nem.s.hPartition, pVCpu->idCpu, s_aNames, RT_ELEMENTS(s_aNames), aRegs);
     2540                    LogFlow(("NEM/%u: Exit @ %08RX64 pstate=%#RX64 Reason=%#x\n",
     2541                             pVCpu->idCpu, aRegs[0].Reg64, aRegs[1].Reg64, ExitReason.ExitReason));
     2542                }
    25902543#endif
    25912544                if (SUCCEEDED(hrc))
     
    25992552                    else
    26002553                    {
    2601                         LogFlow(("NEM/%u: breaking: nemHCWinHandleMessage -> %Rrc\n", pVCpu->idCpu, VBOXSTRICTRC_VAL(rcStrict) ));
     2554                        LogFlow(("NEM/%u: breaking: nemR3WinHandleExit -> %Rrc\n", pVCpu->idCpu, VBOXSTRICTRC_VAL(rcStrict) ));
    26022555                        STAM_REL_COUNTER_INC(&pVCpu->nem.s.StatBreakOnStatus);
    26032556                        break;
     
    27012654#endif
    27022655
    2703 #if 0
    2704     LogFlow(("NEM/%u: %04x:%08RX64 efl=%#08RX64 => %Rrc\n", pVCpu->idCpu, pVCpu->cpum.GstCtx.cs.Sel,
    2705              pVCpu->cpum.GstCtx.rip, pVCpu->cpum.GstCtx.rflags.u, VBOXSTRICTRC_VAL(rcStrict) ));
    2706 #endif
     2656    LogFlow(("NEM/%u: %08RX64 pstate=%#08RX64 => %Rrc\n", pVCpu->idCpu, pVCpu->cpum.GstCtx.Pc.u64,
     2657             pVCpu->cpum.GstCtx.fPState, VBOXSTRICTRC_VAL(rcStrict) ));
    27072658    return rcStrict;
    27082659}
Note: See TracChangeset for help on using the changeset viewer.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette