VirtualBox

Changeset 49478 in vbox for trunk


Ignore:
Timestamp:
Nov 14, 2013 12:56:30 PM (11 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
90629
Message:

VMM/HMVMXR0: Fixed single-stepping in the guest to generate #DB correctly.

File:
1 edited

Legend:

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

    r49407 r49478  
    68706870
    68716871    /* Delivery pending debug exception if the guest is single-stepping. Evaluate and set the BS bit. */
    6872     int rc2 = VINF_SUCCESS;
    6873     if (   fBlockSti
    6874         || fBlockMovSS)
    6875     {
    6876         if (   !pVCpu->hm.s.fSingleInstruction
    6877             && !DBGFIsStepping(pVCpu))
    6878         {
    6879             Assert(pVCpu->hm.s.vmx.fUpdatedGuestState & HMVMX_UPDATED_GUEST_RFLAGS);
    6880             if (pMixedCtx->eflags.Bits.u1TF)    /* We don't have any IA32_DEBUGCTL MSR for guests. Treat as all bits 0. */
    6881             {
    6882                 /*
    6883                  * The pending-debug exceptions field is cleared on all VM-exits except VMX_EXIT_TPR_BELOW_THRESHOLD,
    6884                  * VMX_EXIT_MTF, VMX_EXIT_APIC_WRITE and VMX_EXIT_VIRTUALIZED_EOI.
    6885                  * See Intel spec. 27.3.4 "Saving Non-Register State".
    6886                  */
    6887                 rc2 = VMXWriteVmcs32(VMX_VMCS_GUEST_PENDING_DEBUG_EXCEPTIONS, VMX_VMCS_GUEST_DEBUG_EXCEPTIONS_BS);
    6888                 AssertRCReturn(rc, rc);
    6889             }
    6890         }
    6891         else
    6892         {
    6893             /* We are single-stepping in the hypervisor debugger, clear interrupt inhibition as setting the BS bit would mean
    6894                delivering a #DB to the guest upon VM-entry when it shouldn't be. */
    6895             uIntrState = 0;
    6896         }
     6872    if (   !pVCpu->hm.s.fSingleInstruction
     6873        && !DBGFIsStepping(pVCpu))
     6874    {
     6875        int rc2 = hmR0VmxSaveGuestRflags(pVCpu, pMixedCtx);
     6876        AssertRCReturn(rc2, rc2);
     6877        if (pMixedCtx->eflags.Bits.u1TF)    /* We don't have any IA32_DEBUGCTL MSR for guests. Treat as all bits 0. */
     6878        {
     6879            /*
     6880             * The pending-debug exceptions field is cleared on all VM-exits except VMX_EXIT_TPR_BELOW_THRESHOLD,
     6881             * VMX_EXIT_MTF, VMX_EXIT_APIC_WRITE and VMX_EXIT_VIRTUALIZED_EOI.
     6882             * See Intel spec. 27.3.4 "Saving Non-Register State".
     6883             */
     6884            rc2 = VMXWriteVmcs32(VMX_VMCS_GUEST_PENDING_DEBUG_EXCEPTIONS, VMX_VMCS_GUEST_DEBUG_EXCEPTIONS_BS);
     6885            AssertRCReturn(rc2, rc2);
     6886        }
     6887    }
     6888    else
     6889    {
     6890        /* We are single-stepping in the hypervisor debugger, clear interrupt inhibition as setting the BS bit would mean
     6891           delivering a #DB to the guest upon VM-entry when it shouldn't be. */
     6892        uIntrState = 0;
    68976893    }
    68986894
     
    69016897     * VT-x clears the valid bit on every VM-exit. See Intel spec. 24.8.3 "VM-Entry Controls for Event Injection".
    69026898     */
    6903     rc2 = hmR0VmxLoadGuestIntrState(pVCpu, uIntrState);
     6899    int rc2 = hmR0VmxLoadGuestIntrState(pVCpu, uIntrState);
    69046900    AssertRC(rc2);
    69056901
Note: See TracChangeset for help on using the changeset viewer.

© 2025 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette