VirtualBox

Changeset 91305 in vbox for trunk/src/VBox/VMM/VMMAll


Ignore:
Timestamp:
Sep 17, 2021 8:56:45 PM (3 years ago)
Author:
vboxsync
Message:

VMM/CPUM,++: Moved the nested VT-X I/O permission bitmap allocations into CPUMCTX. bugref:10093

Location:
trunk/src/VBox/VMM/VMMAll
Files:
2 edited

Legend:

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

    r91301 r91305  
    24782478 *
    24792479 * @returns @c true if the I/O port access must cause a VM-exit, @c false otherwise.
    2480  * @param   pvIoBitmap  Pointer to I/O bitmap.
     2480 * @param   pbIoBitmap  Pointer to I/O bitmap.
    24812481 * @param   uPort       The I/O port being accessed.
    24822482 * @param   cbAccess    e size of the I/O access in bytes (1, 2 or 4 bytes).
    24832483 */
    2484 static bool cpumGetVmxIoBitmapPermission(void const *pvIoBitmap, uint16_t uPort, uint8_t cbAccess)
     2484static bool cpumGetVmxIoBitmapPermission(uint8_t const *pbIoBitmap, uint16_t uPort, uint8_t cbAccess)
    24852485{
    24862486    Assert(cbAccess == 1 || cbAccess == 2 || cbAccess == 4);
     
    25042504     * If any bit corresponding to the I/O access is set, we must cause a VM-exit.
    25052505     */
    2506     uint8_t const *pbIoBitmap = (uint8_t const *)pvIoBitmap;
    25072506    uint16_t const offPerm    = uPort >> 3;                         /* Byte offset of the port. */
    25082507    uint16_t const idxPermBit = uPort - (offPerm << 3);             /* Bit offset within byte. */
     
    25132512    /* Fetch 8 or 16-bits depending on whether the access spans 8-bit boundary. */
    25142513    RTUINT16U uPerm;
    2515     uPerm.s.Lo = *(pbIoBitmap + offPerm);
     2514    uPerm.s.Lo = pbIoBitmap[offPerm];
    25162515    if (idxPermBit + cbAccess > 8)
    2517         uPerm.s.Hi = *(pbIoBitmap + 1 + offPerm);
     2516        uPerm.s.Hi = pbIoBitmap[offPerm + 1];
    25182517    else
    25192518        uPerm.s.Hi = 0;
     
    28022801
    28032802    if (CPUMIsGuestVmxProcCtlsSet(pCtx, VMX_PROC_CTLS_USE_IO_BITMAPS))
    2804     {
    2805         uint8_t const *pbIoBitmap = (uint8_t const *)pCtx->hwvirt.vmx.CTX_SUFF(pvIoBitmap);
    2806         Assert(pbIoBitmap);
    2807         return cpumGetVmxIoBitmapPermission(pbIoBitmap, u16Port, cbAccess);
    2808     }
     2803        return cpumGetVmxIoBitmapPermission(pCtx->hwvirt.vmx.abIoBitmap, u16Port, cbAccess);
    28092804
    28102805    return false;
  • trunk/src/VBox/VMM/VMMAll/IEMAllCImplVmxInstr.cpp.h

    r91304 r91305  
    66636663        /* Read the IO bitmap A. */
    66646664        RTGCPHYS const GCPhysIoBitmapA = pVmcs->u64AddrIoBitmapA.u;
    6665         Assert(pVCpu->cpum.GstCtx.hwvirt.vmx.CTX_SUFF(pvIoBitmap));
    6666         int rc = PGMPhysSimpleReadGCPhys(pVCpu->CTX_SUFF(pVM), pVCpu->cpum.GstCtx.hwvirt.vmx.CTX_SUFF(pvIoBitmap),
     6665        int rc = PGMPhysSimpleReadGCPhys(pVCpu->CTX_SUFF(pVM), &pVCpu->cpum.GstCtx.hwvirt.vmx.abIoBitmap[0],
    66676666                                         GCPhysIoBitmapA, VMX_V_IO_BITMAP_A_SIZE);
    66686667        if (RT_SUCCESS(rc))
     
    66736672        /* Read the IO bitmap B. */
    66746673        RTGCPHYS const GCPhysIoBitmapB = pVmcs->u64AddrIoBitmapB.u;
    6675         uint8_t *pbIoBitmapB = (uint8_t *)pVCpu->cpum.GstCtx.hwvirt.vmx.CTX_SUFF(pvIoBitmap) + VMX_V_IO_BITMAP_A_SIZE;
    6676         rc = PGMPhysSimpleReadGCPhys(pVCpu->CTX_SUFF(pVM), pbIoBitmapB, GCPhysIoBitmapB, VMX_V_IO_BITMAP_B_SIZE);
     6674        rc = PGMPhysSimpleReadGCPhys(pVCpu->CTX_SUFF(pVM), &pVCpu->cpum.GstCtx.hwvirt.vmx.abIoBitmap[VMX_V_IO_BITMAP_A_SIZE],
     6675                                    GCPhysIoBitmapB, VMX_V_IO_BITMAP_B_SIZE);
    66776676        if (RT_SUCCESS(rc))
    66786677        { /* likely */ }
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