VirtualBox

Changeset 29737 in vbox for trunk/src/VBox/VMM/VMMR0


Ignore:
Timestamp:
May 21, 2010 2:07:52 PM (15 years ago)
Author:
vboxsync
Message:

Fixed dropping back to the recompiler too often when running unrestricted guest code that switches mode very often.

File:
1 edited

Legend:

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

    r29250 r29737  
    755755#endif
    756756
    757 #ifdef HWACCM_VMX_EMULATE_REALMODE
    758757    if (    CPUMIsGuestInRealModeEx(pCtx)
    759758        &&  pVM->hwaccm.s.vmx.pRealModeTSS)
     
    826825        return VINF_SUCCESS;
    827826    }
    828 #endif /* HWACCM_VMX_EMULATE_REALMODE */
    829827
    830828    /* Set event injection state. */
     
    12821280#endif
    12831281
    1284 # ifdef HWACCM_VMX_EMULATE_REALMODE
    12851282    /* Intercept all exceptions in real mode as none of them can be injected directly (#GP otherwise). */
    12861283    if (    CPUMIsGuestInRealModeEx(pCtx)
    12871284        &&  pVM->hwaccm.s.vmx.pRealModeTSS)
    12881285        u32TrapMask |= HWACCM_VMX_TRAP_MASK_REALMODE;
    1289 # endif /* HWACCM_VMX_EMULATE_REALMODE */
    12901286
    12911287    int rc = VMXWriteVMCS(VMX_VMCS_CTRL_EXCEPTION_BITMAP, u32TrapMask);
     
    13511347    if (pVCpu->hwaccm.s.fContextUseFlags & HWACCM_CHANGED_GUEST_SEGMENT_REGS)
    13521348    {
    1353 #ifdef HWACCM_VMX_EMULATE_REALMODE
    13541349        if (pVM->hwaccm.s.vmx.pRealModeTSS)
    13551350        {
     
    14211416            }
    14221417        }
    1423 #endif /* HWACCM_VMX_EMULATE_REALMODE */
    14241418
    14251419        VMX_WRITE_SELREG(ES, es);
     
    14651459    if (pVCpu->hwaccm.s.fContextUseFlags & HWACCM_CHANGED_GUEST_TR)
    14661460    {
    1467 #ifdef HWACCM_VMX_EMULATE_REALMODE
    14681461        /* Real mode emulation using v86 mode with CR4.VME (interrupt redirection using the int bitmap in the TSS) */
    14691462        if (    CPUMIsGuestInRealModeEx(pCtx)
     
    14881481        }
    14891482        else
    1490 #endif /* HWACCM_VMX_EMULATE_REALMODE */
    14911483        {
    14921484            rc =  VMXWriteVMCS(VMX_VMCS16_GUEST_FIELD_TR,         pCtx->tr);
     
    16461638        }
    16471639
    1648 #ifdef HWACCM_VMX_EMULATE_REALMODE
    16491640        /* Turn off VME if we're in emulated real mode. */
    16501641        if (    CPUMIsGuestInRealModeEx(pCtx)
    16511642            &&  pVM->hwaccm.s.vmx.pRealModeTSS)
    16521643            val &= ~X86_CR4_VME;
    1653 #endif /* HWACCM_VMX_EMULATE_REALMODE */
    16541644
    16551645        rc |= VMXWriteVMCS64(VMX_VMCS64_GUEST_CR4,            val);
     
    17871777    eflags.u32 |= VMX_EFLAGS_RESERVED_1;
    17881778
    1789 #ifdef HWACCM_VMX_EMULATE_REALMODE
    17901779    /* Real mode emulation using v86 mode. */
    17911780    if (    CPUMIsGuestInRealModeEx(pCtx)
     
    17971786        eflags.Bits.u2IOPL = 0; /* must always be 0 or else certain instructions won't cause faults. */
    17981787    }
    1799 #endif /* HWACCM_VMX_EMULATE_REALMODE */
    18001788    rc   = VMXWriteVMCS(VMX_VMCS_GUEST_RFLAGS,           eflags.u32);
    18011789    AssertRC(rc);
     
    20182006    pCtx->idtr.pIdt         = val;
    20192007
    2020 #ifdef HWACCM_VMX_EMULATE_REALMODE
    20212008    /* Real mode emulation using v86 mode. */
    20222009    if (    CPUMIsGuestInRealModeEx(pCtx)
     
    20332020    }
    20342021    else
    2035 #endif /* HWACCM_VMX_EMULATE_REALMODE */
    20362022    {
    20372023        /* In real mode we have a fake TSS, so only sync it back when it's supposed to be valid. */
     
    33203306#endif
    33213307            default:
    3322 #ifdef HWACCM_VMX_EMULATE_REALMODE
    33233308                if (    CPUMIsGuestInRealModeEx(pCtx)
    33243309                    &&  pVM->hwaccm.s.vmx.pRealModeTSS)
     
    33363321                    goto ResumeExecution;
    33373322                }
    3338 #endif
    33393323                AssertMsgFailed(("Unexpected vm-exit caused by exception %x\n", vector));
    33403324                rc = VERR_VMX_UNEXPECTED_EXCEPTION;
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