VirtualBox

Changeset 15733 in vbox


Ignore:
Timestamp:
Dec 23, 2008 3:13:21 PM (16 years ago)
Author:
vboxsync
Message:

Experiment with the VT-x preemption timer for the 32/64 switcher.

File:
1 edited

Legend:

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

    r15729 r15733  
    21322132     */
    21332133
     2134
    21342135    /* All done! Let's start VM execution. */
    21352136    STAM_PROFILE_ADV_START(&pVCpu->hwaccm.s.StatInGC, z);
     
    21522153     * !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
    21532154     */
    2154 
    21552155    STAM_PROFILE_ADV_STOP(&pVCpu->hwaccm.s.StatInGC, z);
    21562156    STAM_PROFILE_ADV_START(&pVCpu->hwaccm.s.StatExit1, v);
     
    30073007        goto ResumeExecution;
    30083008
     3009    case VMX_EXIT_PREEMPTION_TIMER:     /* 52 VMX-preemption timer expired. The preemption timer counted down to zero. */
     3010#ifdef RT_OS_WINDOWS
     3011        goto ResumeExecution;
     3012#else
     3013        break; /* enable interrupts again */
     3014#endif
     3015
    30093016    default:
    30103017        /* The rest is handled after syncing the entire CPU state. */
     
    30203027    case VMX_EXIT_EXTERNAL_IRQ:         /* 1 External interrupt. */
    30213028    case VMX_EXIT_EPT_VIOLATION:
     3029    case VMX_EXIT_PREEMPTION_TIMER:     /* 52 VMX-preemption timer expired. The preemption timer counted down to zero. */
    30223030        /* Already handled above. */
    30233031        break;
     
    35733581    aParam[5] = 0;
    35743582
     3583    if (pVM->hwaccm.s.vmx.msr.vmx_pin_ctls.n.allowed1 & VMX_VMCS_CTRL_PIN_EXEC_CONTROLS_PREEMPT_TIMER)
     3584    {
     3585        uint32_t val;
     3586
     3587        rc = VMXReadVMCS32(VMX_VMCS_CTRL_PIN_EXEC_CONTROLS, &val);
     3588        AssertRC(rc);
     3589        val  = val | VMX_VMCS_CTRL_PIN_EXEC_CONTROLS_PREEMPT_TIMER;
     3590        rc = VMXWriteVMCS(VMX_VMCS_CTRL_PIN_EXEC_CONTROLS, val);
     3591        AssertRC(rc);
     3592
     3593        VMXWriteVMCS(VMX_VMCS32_GUEST_PREEMPTION_TIMER_VALUE, 0x10000);
     3594    }
     3595
    35753596    rc = VMXR0Execute64BitsHandler(pVM, pVCpu, pCtx, pVM->hwaccm.s.pfnVMXGCStartVM64, 6, &aParam[0]);
     3597
     3598    if (pVM->hwaccm.s.vmx.msr.vmx_pin_ctls.n.allowed1 & VMX_VMCS_CTRL_PIN_EXEC_CONTROLS_PREEMPT_TIMER)
     3599    {
     3600        uint32_t val;
     3601
     3602        rc = VMXReadVMCS32(VMX_VMCS_CTRL_PIN_EXEC_CONTROLS, &val);
     3603        AssertRC(rc);
     3604        val  = val & ~VMX_VMCS_CTRL_PIN_EXEC_CONTROLS_PREEMPT_TIMER;
     3605        rc = VMXWriteVMCS(VMX_VMCS_CTRL_PIN_EXEC_CONTROLS, val);
     3606        AssertRC(rc);
     3607    }
    35763608
    35773609#ifdef DEBUG
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