VirtualBox

Ignore:
Timestamp:
Feb 28, 2022 8:39:08 AM (3 years ago)
Author:
vboxsync
Message:

VMM: Nested VMX: bugref:10092 Add HM ring-0 API for querying transient VMX/SVM info.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/VMM/VMMR0/HMVMXR0.cpp

    r93932 r93963  
    48344834
    48354835/**
     4836 * Gets VMX VM-exit auxiliary information.
     4837 *
     4838 * @returns VBox status code.
     4839 * @param   pVCpu           The cross context virtual CPU structure.
     4840 * @param   pVmxExitAux     Where to store the VM-exit auxiliary info.
     4841 * @param   fWhat           What to fetch, HMVMX_READ_XXX.
     4842 */
     4843VMMR0DECL(int) VMXR0GetExitAuxInfo(PVMCPUCC pVCpu, PVMXEXITAUX pVmxExitAux, uint32_t fWhat)
     4844{
     4845    PVMXTRANSIENT pVmxTransient = pVCpu->hmr0.s.vmx.pVmxTransient;
     4846    if (RT_LIKELY(pVmxTransient))
     4847    {
     4848        AssertCompile(sizeof(fWhat) == sizeof(pVmxTransient->fVmcsFieldsRead));
     4849        fWhat &= ~pVmxTransient->fVmcsFieldsRead;
     4850
     4851        /* The exit reason is always available. */
     4852        pVmxExitAux->uReason = pVmxTransient->uExitReason;
     4853
     4854        if (fWhat & HMVMX_READ_EXIT_QUALIFICATION)
     4855        {
     4856            vmxHCReadExitQualVmcs(pVCpu, pVmxTransient);
     4857            fWhat &= ~HMVMX_READ_EXIT_QUALIFICATION;
     4858            pVmxExitAux->u64Qual = pVmxTransient->uExitQual;
     4859        }
     4860
     4861        if (fWhat & HMVMX_READ_IDT_VECTORING_INFO)
     4862        {
     4863            vmxHCReadIdtVectoringInfoVmcs(pVCpu, pVmxTransient);
     4864            fWhat &= ~HMVMX_READ_IDT_VECTORING_INFO;
     4865            pVmxExitAux->uIdtVectoringInfo = pVmxTransient->uIdtVectoringInfo;
     4866        }
     4867
     4868        if (fWhat & HMVMX_READ_IDT_VECTORING_ERROR_CODE)
     4869        {
     4870            vmxHCReadIdtVectoringErrorCodeVmcs(pVCpu, pVmxTransient);
     4871            fWhat &= ~HMVMX_READ_IDT_VECTORING_ERROR_CODE;
     4872            pVmxExitAux->uIdtVectoringErrCode = pVmxTransient->uIdtVectoringErrorCode;
     4873        }
     4874
     4875        if (fWhat & HMVMX_READ_EXIT_INSTR_LEN)
     4876        {
     4877            vmxHCReadExitInstrLenVmcs(pVCpu, pVmxTransient);
     4878            fWhat &= ~HMVMX_READ_EXIT_INSTR_LEN;
     4879            pVmxExitAux->cbInstr = pVmxTransient->cbExitInstr;
     4880        }
     4881
     4882        if (fWhat & HMVMX_READ_EXIT_INTERRUPTION_INFO)
     4883        {
     4884            vmxHCReadExitIntInfoVmcs(pVCpu, pVmxTransient);
     4885            fWhat &= ~HMVMX_READ_EXIT_INTERRUPTION_INFO;
     4886            pVmxExitAux->uExitIntInfo = pVmxTransient->uExitIntInfo;
     4887        }
     4888
     4889        if (fWhat & HMVMX_READ_EXIT_INTERRUPTION_ERROR_CODE)
     4890        {
     4891            vmxHCReadExitIntErrorCodeVmcs(pVCpu, pVmxTransient);
     4892            fWhat &= ~HMVMX_READ_EXIT_INTERRUPTION_ERROR_CODE;
     4893            pVmxExitAux->uExitIntErrCode = pVmxTransient->uExitIntErrorCode;
     4894        }
     4895
     4896        if (fWhat & HMVMX_READ_EXIT_INSTR_INFO)
     4897        {
     4898            vmxHCReadExitInstrInfoVmcs(pVCpu, pVmxTransient);
     4899            fWhat &= ~HMVMX_READ_EXIT_INSTR_INFO;
     4900            pVmxExitAux->InstrInfo.u = pVmxTransient->ExitInstrInfo.u;
     4901        }
     4902
     4903        if (fWhat & HMVMX_READ_GUEST_LINEAR_ADDR)
     4904        {
     4905            vmxHCReadGuestLinearAddrVmcs(pVCpu, pVmxTransient);
     4906            fWhat &= ~HMVMX_READ_GUEST_LINEAR_ADDR;
     4907            pVmxExitAux->u64GuestLinearAddr = pVmxTransient->uGuestLinearAddr;
     4908        }
     4909
     4910        if (fWhat & HMVMX_READ_GUEST_PHYSICAL_ADDR)
     4911        {
     4912            vmxHCReadGuestPhysicalAddrVmcs(pVCpu, pVmxTransient);
     4913            fWhat &= ~HMVMX_READ_GUEST_PHYSICAL_ADDR;
     4914            pVmxExitAux->u64GuestPhysAddr = pVmxTransient->uGuestPhysicalAddr;
     4915        }
     4916
     4917        if (fWhat & HMVMX_READ_GUEST_PENDING_DBG_XCPTS)
     4918        {
     4919            vmxHCReadGuestPendingDbgXctps(pVCpu, pVmxTransient);
     4920            fWhat &= ~HMVMX_READ_GUEST_PENDING_DBG_XCPTS;
     4921            pVmxExitAux->u64GuestPendingDbgXcpts = pVmxTransient->uGuestPendingDbgXcpts;
     4922        }
     4923
     4924        AssertMsg(!fWhat, ("fWhat=%#RX32 fVmcsFieldsRead=%#RX32\n", fWhat, pVmxTransient->fVmcsFieldsRead));
     4925        return VINF_SUCCESS;
     4926    }
     4927    return VERR_NOT_AVAILABLE;
     4928}
     4929
     4930
     4931/**
    48364932 * Does the necessary state syncing before returning to ring-3 for any reason
    48374933 * (longjmp, preemption, voluntary exits to ring-3) from VT-x.
     
    67746870    Assert(VmxTransient.pVmcsInfo == &pVCpu->hmr0.s.vmx.VmcsInfoNstGst);
    67756871
     6872    /* Setup pointer so PGM/IEM can query VM-exit auxiliary info. on demand in ring-0. */
     6873    pVCpu->hmr0.s.vmx.pVmxTransient = &VmxTransient;
     6874
    67766875    VBOXSTRICTRC rcStrict = VERR_INTERNAL_ERROR_5;
    67776876    for (;;)
     
    68066905            STAM_PROFILE_ADV_STOP(&pVCpu->hm.s.StatPreExit, x);
    68076906            hmR0VmxReportWorldSwitchError(pVCpu, rcRun, &VmxTransient);
    6808             return rcRun;
     6907            rcStrict = rcRun;
     6908            break;
    68096909        }
    68106910
     
    68556955        break;
    68566956    }
     6957
     6958    /* Ensure VM-exit auxiliary info. is no longer available. */
     6959    pVCpu->hmr0.s.vmx.pVmxTransient = NULL;
    68576960
    68586961    STAM_PROFILE_ADV_STOP(&pVCpu->hm.s.StatEntry, x);
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