VirtualBox

Changeset 71069 in vbox for trunk/src/VBox


Ignore:
Timestamp:
Feb 20, 2018 10:53:58 AM (7 years ago)
Author:
vboxsync
Message:

VMM/IEM: Nested Hw.virt: Update number of bytes fetched for SVM decode assist on intercepted #PFs. Still todo/WIP when fewer
than 15 bytes are present in the opcode cache.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/VMM/VMMAll/IEMAllCImplSvmInstr.cpp.h

    r71048 r71069  
    957957        {
    958958            /** @todo Nested-guest SVM - figure out fetching op-code bytes from IEM. */
     959            PSVMVMCBCTRL  pVmcbCtrl = &pCtx->hwvirt.svm.CTX_SUFF(pVmcb)->ctrl;
    959960#ifdef IEM_WITH_CODE_TLB
    960             AssertReleaseFailedReturn(VERR_IEM_IPE_5);
     961            uint8_t const cbCurrent   = pVCpu->iem.s.cbInstrBuf;
     962            uint8_t const *pbInstrBuf = pVCpu->iem.s.pbInstrBuf;
     963            if (   pbInstrBuf
     964                && cbCurrent >= SVM_CTRL_GUEST_INSTR_BYTES_MAX)
     965            {
     966                pVmcbCtrl->cbInstrFetched = SVM_CTRL_GUEST_INSTR_BYTES_MAX;
     967                memcpy(&pVmcbCtrl->abInstr[0], pbInstrBuf, SVM_CTRL_GUEST_INSTR_BYTES_MAX);
     968            }
     969            else
     970            { AssertReleaseFailedReturn(VERR_IEM_IPE_5); /** @todo */ }
    961971#else
    962             PSVMVMCBCTRL  pVmcbCtrl = &pCtx->hwvirt.svm.CTX_SUFF(pVmcb)->ctrl;
    963972            uint8_t const offOpCode = pVCpu->iem.s.offOpcode;
    964             uint8_t const cbCurrent = pVCpu->iem.s.cbOpcode - pVCpu->iem.s.offOpcode;
     973            uint8_t const cbCurrent = pVCpu->iem.s.cbOpcode - offOpCode;
    965974            if (cbCurrent >= SVM_CTRL_GUEST_INSTR_BYTES_MAX)
    966975            {
    967                 Assert(cbCurrent <= RT_ELEMENTS(pVCpu->iem.s.abOpcode));
     976                pVmcbCtrl->cbInstrFetched = SVM_CTRL_GUEST_INSTR_BYTES_MAX;
    968977                memcpy(&pVmcbCtrl->abInstr[0], &pVCpu->iem.s.abOpcode[offOpCode], SVM_CTRL_GUEST_INSTR_BYTES_MAX);
    969978            }
    970979            else
    971             {
    972                 /** @todo fetch 15 bytes from CS:RIP and stop fetching on exceptions or CS
    973                  *        limit is exceeded. */
    974             }
     980            { AssertReleaseFailedReturn(VERR_IEM_IPE_5); /** @todo */ }
    975981#endif
    976982        }
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