VirtualBox

Changeset 74667 in vbox for trunk/src


Ignore:
Timestamp:
Oct 8, 2018 11:12:21 AM (6 years ago)
Author:
vboxsync
Message:

VMM/IEM: Nested VMX: bugref:9180 VM-exit bits; String IO intercept prep work.

File:
1 edited

Legend:

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

    r74663 r74667  
    33323332
    33333333/**
     3334 * VMX VM-exit handler for VM-exits due to string I/O instructions (INS and OUTS).
     3335 *
     3336 * @returns VBox strict status code.
     3337 * @param   pVCpu           The cross context virtual CPU structure.
     3338 * @param   uInstrId        The VM-exit instruction identity (VMXINSTRID_IO_INS or
     3339 *                          VMXINSTRID_IO_OUTS).
     3340 * @param   u16Port         The I/O port being accessed.
     3341 * @param   cbAccess        The size of the I/O access in bytes (1, 2 or 4 bytes).
     3342 * @param   fRep            Whether the instruction has a REP prefix or not.
     3343 * @param   ExitInstrInfo   The VM-exit instruction info. field.
     3344 * @param   cbInstr         The instruction length in bytes.
     3345 */
     3346IEM_STATIC VBOXSTRICTRC iemVmxVmexitInstrStrIo(PVMCPU pVCpu, VMXINSTRID uInstrId, uint16_t u16Port, uint8_t cbAccess, bool fRep,
     3347                                               VMXEXITINSTRINFO ExitInstrInfo, uint8_t cbInstr)
     3348{
     3349    Assert(uInstrId == VMXINSTRID_IO_INS || uInstrId == VMXINSTRID_IO_OUTS);
     3350    Assert(cbAccess == 1 || cbAccess == 2 || cbAccess == 4);
     3351    Assert(ExitInstrInfo.StrIo.iSegReg < X86_SREG_COUNT);
     3352    Assert(ExitInstrInfo.StrIo.u3AddrSize == 0 || ExitInstrInfo.StrIo.u3AddrSize == 1 || ExitInstrInfo.StrIo.u3AddrSize == 2);
     3353
     3354    bool const fIntercept = iemVmxIsIoInterceptSet(pVCpu, u16Port);
     3355    if (fIntercept)
     3356    {
     3357        uint32_t const uDirection = uInstrId == VMXINSTRID_IO_INS ? VMX_EXIT_QUAL_IO_DIRECTION_IN
     3358                                                                  : VMX_EXIT_QUAL_IO_DIRECTION_OUT;
     3359        VMXVEXITINFO ExitInfo;
     3360        RT_ZERO(ExitInfo);
     3361        ExitInfo.uReason   = VMX_EXIT_IO_INSTR;
     3362        ExitInfo.cbInstr   = cbInstr;
     3363        ExitInfo.InstrInfo = ExitInstrInfo;
     3364        ExitInfo.u64Qual = RT_BF_MAKE(VMX_BF_EXIT_QUAL_IO_WIDTH,     cbAccess - 1)
     3365                         | RT_BF_MAKE(VMX_BF_EXIT_QUAL_IO_DIRECTION, uDirection)
     3366                         | RT_BF_MAKE(VMX_BF_EXIT_QUAL_IO_IS_STRING, 1)
     3367                         | RT_BF_MAKE(VMX_BF_EXIT_QUAL_IO_IS_REP,    fRep)
     3368                         | RT_BF_MAKE(VMX_BF_EXIT_QUAL_IO_ENCODING,  0)     /* DX (not immediate). */
     3369                         | RT_BF_MAKE(VMX_BF_EXIT_QUAL_IO_PORT,      u16Port);
     3370        return iemVmxVmexitInstrWithInfo(pVCpu, &ExitInfo);
     3371    }
     3372
     3373    return VINF_VMX_INTERCEPT_NOT_ACTIVE;
     3374}
     3375
     3376
     3377/**
    33343378 * VMX VM-exit handler for TPR virtualization.
    33353379 *
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