VirtualBox

Changeset 45556 in vbox for trunk/src


Ignore:
Timestamp:
Apr 15, 2013 4:45:27 PM (12 years ago)
Author:
vboxsync
Message:

VMM/VMMR0: HM bits.

File:
1 edited

Legend:

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

    r45552 r45556  
    25612561        rc = VMXWriteVmcsGstN(VMX_VMCS_GUEST_RIP, pMixedCtx->rip);
    25622562        AssertRCReturn(rc, rc);
    2563         Log(("VMX_VMCS_GUEST_RIP=%#RX64\n", pMixedCtx->rip));
     2563        Log(("Load: VMX_VMCS_GUEST_RIP=%#RX64\n", pMixedCtx->rip));
    25642564        pVCpu->hm.s.fContextUseFlags &= ~HM_CHANGED_GUEST_RIP;
    25652565    }
     
    26292629        AssertRCReturn(rc, rc);
    26302630
    2631         Log(("VMX_VMCS_GUEST_RFLAGS=%#RX64\n", uRFlags.u64));
     2631        Log(("Load: VMX_VMCS_GUEST_RFLAGS=%#RX64\n", uRFlags.u64));
    26322632        pVCpu->hm.s.fContextUseFlags &= ~HM_CHANGED_GUEST_RFLAGS;
    26332633    }
     
    26842684        rc  = VMXWriteVmcsGstN(VMX_VMCS_CTRL_CR0_READ_SHADOW, u64GuestCR0);
    26852685        AssertRCReturn(rc, rc);
    2686         Log2(("VMX_VMCS_CTRL_CR0_READ_SHADOW=%#RX64\n", u64GuestCR0));
     2686        Log(("Load: VMX_VMCS_CTRL_CR0_READ_SHADOW=%#RX64\n", u64GuestCR0));
    26872687
    26882688        /* Setup VT-x's view of the guest CR0. */
     
    27122712         * Guest FPU bits.
    27132713         * Intel spec. 23.8 "Restrictions on VMX operation" mentions that CR0.NE bit must always be set on the first
    2714          * CPUs to support VT-x (prob. means all the way up to Nehalem) and no mention of with regards to UX in VM-entry checks.
     2714         * CPUs to support VT-x and no mention of with regards to UX in VM-entry checks.
    27152715         */
    27162716        u64GuestCR0 |= X86_CR0_NE;
     
    27892789        rc  = VMXWriteVmcsGstN(VMX_VMCS_GUEST_CR0, u64GuestCR0);
    27902790        rc |= VMXWriteVmcs32(VMX_VMCS32_CTRL_EXCEPTION_BITMAP, pVCpu->hm.s.vmx.u32XcptBitmap);
    2791         Log2(("VMX_VMCS_GUEST_CR0=%#RX32\n", (uint32_t)u64GuestCR0));
     2791        Log(("Load: VMX_VMCS_GUEST_CR0=%RGv (uSetCR0=%#RGv uZapCR0=%#RGv)\n", u64GuestCR0, uSetCR0, uZapCR0));
    27922792
    27932793        /*
     
    27982798        uint64_t u64CR0Mask = 0;
    27992799        u64CR0Mask =  X86_CR0_PE
     2800                    | X86_CR0_NE
    28002801                    | X86_CR0_WP
    28012802                    | X86_CR0_PG
     
    28532854            rc = VMXWriteVmcs64(VMX_VMCS64_CTRL_EPTP_FULL, pVCpu->hm.s.vmx.HCPhysEPTP);
    28542855            AssertRCReturn(rc, rc);
    2855             Log(("VMX_VMCS64_CTRL_EPTP_FULL=%#RX64\n", pVCpu->hm.s.vmx.HCPhysEPTP));
     2856            Log(("Load: VMX_VMCS64_CTRL_EPTP_FULL=%#RX64\n", pVCpu->hm.s.vmx.HCPhysEPTP));
    28562857
    28572858            if (   pVM->hm.s.vmx.fUnrestrictedGuest
     
    28972898        }
    28982899
    2899         Log2(("VMX_VMCS_GUEST_CR3=%#RX64\n", u64GuestCR3));
     2900        Log(("Load: VMX_VMCS_GUEST_CR3=%#RX64\n", u64GuestCR3));
    29002901        rc = VMXWriteVmcsGstN(VMX_VMCS_GUEST_CR3, u64GuestCR3);
    29012902        AssertRCReturn(rc, rc);
     
    29142915        rc  = VMXWriteVmcsGstN(VMX_VMCS_CTRL_CR4_READ_SHADOW, u64GuestCR4);
    29152916        AssertRCReturn(rc, rc);
    2916         Log2(("VMX_VMCS_CTRL_CR4_READ_SHADOW=%#RGv\n", u64GuestCR4));
     2917        Log(("Load: VMX_VMCS_CTRL_CR4_READ_SHADOW=%#RGv\n", u64GuestCR4));
    29172918
    29182919        /* Setup VT-x's view of the guest CR4. */
     
    29822983
    29832984        /* Write VT-x's view of the guest CR4 into the VMCS. */
    2984         Log2(("VMX_VMCS_GUEST_CR4=%#RGv (Set=%#RX32 Zap=%#RX32)\n", u64GuestCR4, uSetCR4, uZapCR4));
     2985        Log(("Load: VMX_VMCS_GUEST_CR4=%#RGv (Set=%#RX32 Zap=%#RX32)\n", u64GuestCR4, uSetCR4, uZapCR4));
    29852986        rc = VMXWriteVmcsGstN(VMX_VMCS_GUEST_CR4, u64GuestCR4);
    29862987
     
    33713372                       in real-mode (e.g. OpenBSD 4.0) */
    33723373                    REMFlushTBs(pVM);
    3373                     Log2(("Switch to protected mode detected!\n"));
     3374                    Log(("Load: Switch to protected mode detected!\n"));
    33743375                }
    33753376                pVCpu->hm.s.vmx.enmLastSeenGuestMode = enmGuestMode;
     
    34603461        AssertRCReturn(rc, rc);
    34613462
    3462         Log2(("VMX_VMCS_GUEST_TR_BASE=%#RX64\n", u64Base));
     3463        Log(("Load: VMX_VMCS_GUEST_TR_BASE=%#RX64\n", u64Base));
    34633464        pVCpu->hm.s.fContextUseFlags &= ~HM_CHANGED_GUEST_TR;
    34643465    }
     
    34743475
    34753476        Assert(!(pCtx->gdtr.cbGdt & 0xffff0000ULL));      /* Bits 31:16 MBZ. */
    3476         Log2(("VMX_VMCS_GUEST_GDTR_BASE=%#RX64\n", pCtx->gdtr.pGdt));
     3477        Log(("Load: VMX_VMCS_GUEST_GDTR_BASE=%#RX64\n", pCtx->gdtr.pGdt));
    34773478        pVCpu->hm.s.fContextUseFlags &= ~HM_CHANGED_GUEST_GDTR;
    34783479    }
     
    35113512        }
    35123513
    3513         Log2(("VMX_VMCS_GUEST_LDTR_BASE=%#RX64\n",  pCtx->ldtr.u64Base));
     3514        Log(("Load: VMX_VMCS_GUEST_LDTR_BASE=%#RX64\n",  pCtx->ldtr.u64Base));
    35143515        pVCpu->hm.s.fContextUseFlags &= ~HM_CHANGED_GUEST_LDTR;
    35153516    }
     
    35253526
    35263527        Assert(!(pCtx->idtr.cbIdt & 0xffff0000ULL));      /* Bits 31:16 MBZ. */
    3527         Log2(("VMX_VMCS_GUEST_IDTR_BASE=%#RX64\n", pCtx->idtr.pIdt));
     3528        Log(("Load: VMX_VMCS_GUEST_IDTR_BASE=%#RX64\n", pCtx->idtr.pIdt));
    35283529        pVCpu->hm.s.fContextUseFlags &= ~HM_CHANGED_GUEST_IDTR;
    35293530    }
     
    47314732
    47324733        /* See Intel spec. 30.7.1.1 "Reflecting Exceptions to Guest Software". */
    4733         VMXREFLECTXCPT enmReflect = VMXREFLECTXCPT_NONE;
     4734        VMXREFLECTXCPT enmReflect     = VMXREFLECTXCPT_NONE;
     4735        RTGCUINTPTR GCPtrFaultAddress = 0;
    47344736        if (uIntType == VMX_IDT_VECTORING_INFO_TYPE_HW_XCPT)
    47354737        {
    47364738            if (   hmR0VmxIsBenignXcpt(uIdtVector)
    4737                 || hmR0VmxIsBenignXcpt(uExitVector))
     4739                || hmR0VmxIsBenignXcpt(uExitVector)
     4740                || (   hmR0VmxIsContributoryXcpt(uIdtVector)
     4741                    && uExitVector == X86_XCPT_PF))
    47384742            {
    47394743                enmReflect = VMXREFLECTXCPT_XCPT;
     
    47444748                pVmxTransient->fVectoringPF = true;
    47454749                enmReflect = VMXREFLECTXCPT_XCPT;
     4750                GCPtrFaultAddress = pMixedCtx->cr2;
     4751                Log(("Vectoring #PF uCR2=%#RGv\n", pMixedCtx->cr2));
    47464752            }
    47474753            else if (   (pVCpu->hm.s.vmx.u32XcptBitmap & VMX_CONTRIBUTORY_XCPT_BITMAP)
     
    47784784                }
    47794785                hmR0VmxSetPendingEvent(pVCpu, VMX_ENTRY_INTR_INFO_FROM_EXIT_IDT_INFO(pVmxTransient->uIdtVectoringInfo),
    4780                                        0 /* cbInstr */,  u32ErrCode, 0 /* GCPtrFaultAddress */);
     4786                                       0 /* cbInstr */,  u32ErrCode, GCPtrFaultAddress);
    47814787                rc = VINF_SUCCESS;
    4782                 Log(("Pending event %#RX64 Err=%#RX32\n", pVCpu->hm.s.Event.u64IntrInfo, pVCpu->hm.s.Event.u32ErrCode));
     4788                Log(("Pending vectoring event %#RX64 Err=%#RX32\n", pVCpu->hm.s.Event.u64IntrInfo, pVCpu->hm.s.Event.u32ErrCode));
    47834789                break;
    47844790            }
     
    47884794                hmR0VmxSetPendingXcptDF(pVCpu, pMixedCtx);
    47894795                rc = VINF_VMX_DOUBLE_FAULT;
    4790                 Log(("Pending #DF %#RX64 uIdtVector=%#x uExitVector=%#x\n", pVCpu->hm.s.Event.u64IntrInfo, uIdtVector,
     4796                Log(("Pending vectoring #DF %#RX64 uIdtVector=%#x uExitVector=%#x\n", pVCpu->hm.s.Event.u64IntrInfo, uIdtVector,
    47914797                     uExitVector));
    47924798                break;
     
    47954801            case VMXREFLECTXCPT_TF:
    47964802            {
    4797                 Log(("Pending triple-fault uIdt=%#x uExit=%#x\n", uIdtVector, uExitVector));
     4803                Log(("Pending vectoring triple-fault uIdt=%#x uExit=%#x\n", uIdtVector, uExitVector));
    47984804                rc = VINF_EM_RESET;
    47994805                break;
     
    52105216            AssertRCReturn(rc, rc);
    52115217        }
     5218
    52125219        pVCpu->hm.s.vmx.fUpdatedGuestState |= VMX_UPDATED_GUEST_CR3;
    52135220    }
     
    55195526            {
    55205527                AssertRC(rc);
    5521                 Log2(("hmR0VmxCheckForceFlags: PGMSyncCR3 forcing us back to ring-3. rc=%d\n", rc));
     5528                Log(("hmR0VmxCheckForceFlags: PGMSyncCR3 forcing us back to ring-3. rc=%d\n", rc));
    55225529                return rc;
    55235530            }
     
    55315538            STAM_COUNTER_INC(&pVCpu->hm.s.StatSwitchHmToR3FF);
    55325539            rc = RT_UNLIKELY(VM_FF_IS_PENDING(pVM, VM_FF_PGM_NO_MEMORY)) ? VINF_EM_NO_MEMORY : VINF_EM_RAW_TO_R3;
    5533             Log2(("hmR0VmxCheckForceFlags: HM_TO_R3 forcing us back to ring-3. rc=%d\n", rc));
     5540            Log(("hmR0VmxCheckForceFlags: HM_TO_R3 forcing us back to ring-3. rc=%d\n", rc));
    55345541            return rc;
    55355542        }
     
    55395546            || VMCPU_FF_IS_PENDING(pVCpu, VMCPU_FF_REQUEST))
    55405547        {
    5541             Log2(("hmR0VmxCheckForceFlags: Pending VM request forcing us back to ring-3\n"));
     5548            Log(("hmR0VmxCheckForceFlags: Pending VM request forcing us back to ring-3\n"));
    55425549            return VINF_EM_PENDING_REQUEST;
    55435550        }
     
    55465553        if (VM_FF_IS_PENDING(pVM, VM_FF_PGM_POOL_FLUSH_PENDING))
    55475554        {
    5548             Log2(("hmR0VmxCheckForceFlags: PGM pool flush pending forcing us back to ring-3\n"));
     5555            Log(("hmR0VmxCheckForceFlags: PGM pool flush pending forcing us back to ring-3\n"));
    55495556            return rc = VINF_PGM_POOL_FLUSH_PENDING;
    55505557        }
     
    55535560        if (VM_FF_IS_PENDING(pVM, VM_FF_PDM_DMA))
    55545561        {
    5555             Log2(("hmR0VmxCheckForceFlags: Pending DMA request forcing us back to ring-3\n"));
     5562            Log(("hmR0VmxCheckForceFlags: Pending DMA request forcing us back to ring-3\n"));
    55565563            return VINF_EM_RAW_TO_R3;
    55575564        }
     
    56385645    AssertRC(rc);
    56395646    Log(("Converting TRPM trap: u32IntrInfo=%#RX32 enmTrpmEvent=%d cbInstr=%u u32ErrCode=%#RX32 GCPtrFaultAddress=%#RGv\n",
    5640          u32IntrInfo, enmTrpmEvent, u32ErrCode, GCPtrFaultAddress));
     5647         u32IntrInfo, enmTrpmEvent, cbInstr, u32ErrCode, GCPtrFaultAddress));
    56415648    hmR0VmxSetPendingEvent(pVCpu, u32IntrInfo, cbInstr, u32ErrCode, GCPtrFaultAddress);
    56425649}
     
    56745681            case VMX_IDT_VECTORING_INFO_TYPE_SW_XCPT:      /* #BP and #OF */
    56755682            case VMX_IDT_VECTORING_INFO_TYPE_HW_XCPT:
    5676                 enmTrapType = TRPM_TRAP;            /** @tod does #BP and #OF come under TRAP or SOFTWARE_INT?? */
     5683                enmTrapType = TRPM_TRAP;
    56775684                break;
    56785685            default:
     
    59545961            && !fBlockMovSS)
    59555962        {
    5956             uint8_t u8Interrupt = 0;
     5963            uint8_t u8Interrupt;
    59575964            rc = PDMGetInterrupt(pVCpu, &u8Interrupt);
    59585965            if (RT_SUCCESS(rc))
     
    65206527
    65216528        /* Map the HC APIC-access page into the GC space, this also updates the shadow page tables if necessary. */
    6522         Log2(("Mapped HC APIC-access page into GC: GCPhysApicBase=%#RGv\n", GCPhysApicBase));
     6529        Log(("Mapped HC APIC-access page into GC: GCPhysApicBase=%#RGv\n", GCPhysApicBase));
    65236530        rc = IOMMMIOMapMMIOHCPage(pVM, pVCpu, GCPhysApicBase, pVM->hm.s.vmx.HCPhysApicAccess, X86_PTE_RW | X86_PTE_P);
    65246531        AssertRCReturn(rc, rc);
     
    68866893   } while (0)
    68876894
    6888 # define VMX_VALIDATE_EXIT_HANDLER_PARAMS() \
    6889             do {                                                      \
    6890                 AssertPtr(pVCpu);                                     \
    6891                 AssertPtr(pMixedCtx);                                 \
    6892                 AssertPtr(pVmxTransient);                             \
    6893                 Assert(pVmxTransient->fVMEntryFailed == false);       \
    6894                 Assert(ASMIntAreEnabled());                           \
    6895                 Assert(!RTThreadPreemptIsEnabled(NIL_RTTHREAD));      \
    6896                 VMX_ASSERT_PREEMPT_CPUID_VAR();                       \
    6897                 LogFunc(("\n"));                                      \
    6898                 Assert(!RTThreadPreemptIsEnabled(NIL_RTTHREAD));      \
    6899                 if (VMMR0IsLogFlushDisabled(pVCpu))                   \
    6900                     VMX_ASSERT_PREEMPT_CPUID();                       \
     6895# define VMX_VALIDATE_EXIT_HANDLER_PARAMS()                                  \
     6896            do {                                                             \
     6897                AssertPtr(pVCpu);                                            \
     6898                AssertPtr(pMixedCtx);                                        \
     6899                AssertPtr(pVmxTransient);                                    \
     6900                Assert(pVmxTransient->fVMEntryFailed == false);              \
     6901                Assert(ASMIntAreEnabled());                                  \
     6902                Assert(!RTThreadPreemptIsEnabled(NIL_RTTHREAD));             \
     6903                VMX_ASSERT_PREEMPT_CPUID_VAR();                              \
     6904                LogFunc(("vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv\n")); \
     6905                Assert(!RTThreadPreemptIsEnabled(NIL_RTTHREAD));             \
     6906                if (VMMR0IsLogFlushDisabled(pVCpu))                          \
     6907                    VMX_ASSERT_PREEMPT_CPUID();                              \
    69016908            } while (0)
    69026909# define VMX_VALIDATE_EXIT_XCPT_HANDLER_PARAMS() \
    6903             do { \
    6904                 LogFunc(("\n"));                                      \
     6910            do {                                 \
     6911                LogFunc(("\n"));                 \
    69056912            } while(0)
    69066913#else   /* Release builds */
     
    72487255    else
    72497256    {
    7250         AssertMsg(rc == VERR_EM_INTERPRETER, ("hmR0VmxExitInvlpg: EMInterpretInvlpg %RGv failed with %Rrc\n",
     7257        AssertMsg(rc == VERR_EM_INTERPRETER, ("hmR0VmxExitInvlpg: EMInterpretInvlpg %#RGv failed with %Rrc\n",
    72517258                                              pVmxTransient->uExitQualification, rc));
    72527259        rc = VERR_EM_INTERPRETER;
     
    77807787            {
    77817788                case 0: /* CR0 */
    7782                     Log(("CR0 write rc=%d\n", rc));
     7789                    Log(("CR0 write rc=%d CR0=%#RGv\n", rc, pMixedCtx->cr0));
    77837790                    pVCpu->hm.s.fContextUseFlags |= HM_CHANGED_GUEST_CR0;
    77847791                    break;
     
    77887795                case 3: /* CR3 */
    77897796                    Assert(!pVM->hm.s.fNestedPaging || !CPUMIsGuestPagingEnabledEx(pMixedCtx));
    7790                     Log(("CR3 write rc=%d\n", rc));
     7797                    Log(("CR3 write rc=%d CR3=%#RGv\n", rc, pMixedCtx->cr3));
    77917798                    pVCpu->hm.s.fContextUseFlags |= HM_CHANGED_GUEST_CR3;
    77927799                    break;
    77937800                case 4: /* CR4 */
    7794                     Log(("CR4 write rc=%d\n", rc));
     7801                    Log(("CR4 write rc=%d CR4=%#RGv\n", rc, pMixedCtx->cr4));
    77957802                    pVCpu->hm.s.fContextUseFlags |= HM_CHANGED_GUEST_CR4;
    77967803                    break;
     
    78127819        {
    78137820            /* EMInterpretCRxRead() requires EFER MSR, CS. */
    7814             rc = hmR0VmxSaveGuestSegmentRegs(pVCpu, pMixedCtx);
     7821            rc  = hmR0VmxSaveGuestSegmentRegs(pVCpu, pMixedCtx);
    78157822            AssertRCReturn(rc, rc);
    78167823            Assert(   !pVM->hm.s.fNestedPaging
     
    83888395{
    83898396    VMX_VALIDATE_EXIT_XCPT_HANDLER_PARAMS();
     8397    STAM_COUNTER_INC(&pVCpu->hm.s.StatExitGuestMF);
    83908398
    83918399    int rc = hmR0VmxSaveGuestCR0(pVCpu, pMixedCtx);
    83928400    AssertRCReturn(rc, rc);
    8393     STAM_COUNTER_INC(&pVCpu->hm.s.StatExitGuestMF);
    83948401
    83958402    if (!(pMixedCtx->cr0 & X86_CR0_NE))
     
    84118418{
    84128419    VMX_VALIDATE_EXIT_XCPT_HANDLER_PARAMS();
     8420    STAM_COUNTER_INC(&pVCpu->hm.s.StatExitGuestBP);
    84138421
    84148422    /** @todo Try optimize this by not saving the entire guest state unless
     
    84168424    int rc = hmR0VmxSaveGuestState(pVCpu, pMixedCtx);
    84178425    AssertRCReturn(rc, rc);
    8418     STAM_COUNTER_INC(&pVCpu->hm.s.StatExitGuestBP);
    84198426
    84208427    PVM pVM = pVCpu->CTX_SUFF(pVM);
     
    84428449{
    84438450    VMX_VALIDATE_EXIT_XCPT_HANDLER_PARAMS();
     8451    STAM_COUNTER_INC(&pVCpu->hm.s.StatExitGuestDB);
    84448452
    84458453    int rc = hmR0VmxReadExitQualificationVmcs(pVCpu, pVmxTransient);
     
    84548462    PVM pVM = pVCpu->CTX_SUFF(pVM);
    84558463    rc = DBGFRZTrap01Handler(pVM, pVCpu, CPUMCTX2CORE(pMixedCtx), uDR6);
    8456     STAM_COUNTER_INC(&pVCpu->hm.s.StatExitGuestDB);
    84578464    if (rc == VINF_EM_RAW_GUEST_TRAP)
    84588465    {
     
    85028509    int rc = hmR0VmxSaveGuestControlRegs(pVCpu, pMixedCtx);
    85038510    AssertRCReturn(rc, rc);
     8511
     8512    rc = hmR0VmxSaveGuestGprs(pVCpu, pMixedCtx);
     8513    rc |= hmR0VmxSaveGuestSegmentRegs(pVCpu, pMixedCtx);
     8514    Log(("Rip %04x:%#RX64\n", pMixedCtx->cs.Sel, pMixedCtx->rip));
    85048515
    85058516    /* Lazy FPU loading; Load the guest-FPU state transparently and continue execution of the guest. */
     
    85338544{
    85348545    VMX_VALIDATE_EXIT_XCPT_HANDLER_PARAMS();
     8546    STAM_COUNTER_INC(&pVCpu->hm.s.StatExitGuestGP);
    85358547
    85368548    int rc = VERR_INTERNAL_ERROR_5;
     
    85438555        rc |= hmR0VmxReadExitIntrErrorCodeVmcs(pVCpu, pVmxTransient);
    85448556        rc |= hmR0VmxReadExitInstrLenVmcs(pVCpu, pVmxTransient);
    8545         rc |= hmR0VmxSaveGuestRip(pVCpu, pMixedCtx);
     8557        rc |= hmR0VmxSaveGuestState(pVCpu, pMixedCtx);
    85468558        AssertRCReturn(rc, rc);
    8547         Log(("#GP Gst: RIP %#RX64\n", pMixedCtx->rip));
     8559        Log(("#GP Gst: RIP %#RX64 ErrorCode=%#x CR0=%#RGv CPL=%u\n", pMixedCtx->rip, pVmxTransient->uExitIntrErrorCode,
     8560             pMixedCtx->cr0, CPUMGetGuestCPL(pVCpu)));
    85488561        hmR0VmxSetPendingEvent(pVCpu, VMX_VMCS_CTRL_ENTRY_IRQ_INFO_FROM_EXIT_INT_INFO(pVmxTransient->uExitIntrInfo),
    85498562                               pVmxTransient->cbInstr, pVmxTransient->uExitIntrErrorCode, 0 /* GCPtrFaultAddress */);
     
    85718584        rc = VINF_SUCCESS;
    85728585        Assert(cbOp == pDis->cbInstr);
    8573         Log2(("#GP Disas OpCode=%u CS:EIP %04x:%#RX64\n", pDis->pCurInstr->uOpcode, pMixedCtx->cs.Sel, pMixedCtx->rip));
     8586        Log(("#GP Disas OpCode=%u CS:EIP %04x:%#RX64\n", pDis->pCurInstr->uOpcode, pMixedCtx->cs.Sel, pMixedCtx->rip));
    85748587        switch (pDis->pCurInstr->uOpcode)
    85758588        {
     
    86298642                    break;
    86308643                }
    8631                 Log(("POPF %x -> %RGv mask=%x RIP=%#RX64\n", uEflags.u, pMixedCtx->rsp, uMask, pMixedCtx->rip));
     8644                Log(("POPF %x -> %#RGv mask=%x RIP=%#RX64\n", uEflags.u, pMixedCtx->rsp, uMask, pMixedCtx->rip));
    86328645                pMixedCtx->eflags.u32 =   (pMixedCtx->eflags.u32 & ~(X86_EFL_POPF_BITS & uMask))
    86338646                                        | (uEflags.u32 & X86_EFL_POPF_BITS & uMask);
     
    86788691                    break;
    86798692                }
    8680                 Log(("PUSHF %x -> %RGv\n", uEflags.u, GCPtrStack));
     8693                Log(("PUSHF %x -> %#RGv\n", uEflags.u, GCPtrStack));
    86818694                pMixedCtx->esp               -= cbParm;
    86828695                pMixedCtx->esp               &= uMask;
     
    87478760                rc = VBOXSTRICTRC_VAL(rc2);
    87488761                pVCpu->hm.s.fContextUseFlags |= HM_CHANGED_ALL_GUEST;
    8749                 Log2(("#GP rc=%Rrc\n", rc));
     8762                Log(("#GP rc=%Rrc\n", rc));
    87508763                break;
    87518764            }
     
    87748787    /* Re-inject the exception into the guest. This cannot be a double-fault condition which would have been handled in
    87758788       hmR0VmxCheckExitDueToEventDelivery(). */
     8789    int rc =  hmR0VmxReadExitIntrErrorCodeVmcs(pVCpu, pVmxTransient);
     8790    rc    |= hmR0VmxReadExitInstrLenVmcs(pVCpu, pVmxTransient);
     8791    AssertRCReturn(rc, rc);
     8792    Assert(pVmxTransient->fVmcsFieldsRead & VMX_TRANSIENT_EXIT_INTERRUPTION_INFO);
    87768793    hmR0VmxSetPendingEvent(pVCpu, VMX_VMCS_CTRL_ENTRY_IRQ_INFO_FROM_EXIT_INT_INFO(pVmxTransient->uExitIntrInfo),
    87778794                           pVmxTransient->cbInstr, pVmxTransient->uExitIntrErrorCode, 0 /* GCPtrFaultAddress */);
     
    87898806    int rc = hmR0VmxReadExitQualificationVmcs(pVCpu, pVmxTransient);
    87908807    rc    |= hmR0VmxReadExitIntrInfoVmcs(pVCpu, pVmxTransient);
    8791     rc    |= hmR0VmxReadExitInstrLenVmcs(pVCpu, pVmxTransient);
    87928808    rc    |= hmR0VmxReadExitIntrErrorCodeVmcs(pVCpu, pVmxTransient);
    87938809    AssertRCReturn(rc, rc);
     
    87998815        {
    88008816            pMixedCtx->cr2 = pVmxTransient->uExitQualification;
     8817            pVCpu->hm.s.Event.fPending = false;     /* In case it's a contributory #PF. */
    88018818            hmR0VmxSetPendingEvent(pVCpu, VMX_VMCS_CTRL_ENTRY_IRQ_INFO_FROM_EXIT_INT_INFO(pVmxTransient->uExitIntrInfo),
    8802                                    pVmxTransient->cbInstr, pVmxTransient->uExitIntrErrorCode, pMixedCtx->cr2);
     8819                                   0 /* cbInstr */, pVmxTransient->uExitIntrErrorCode, pMixedCtx->cr2);
     8820            STAM_COUNTER_INC(&pVCpu->hm.s.StatExitGuestPF);
    88038821        }
    88048822        else
    88058823        {
    88068824            /* A guest page-fault occurred during delivery of a page-fault. Inject #DF. */
    8807             Log(("Pending #DF due to vectoring #PF.\n"));
    8808             pVCpu->hm.s.Event.fPending = false;
    8809             rc = hmR0VmxSetPendingXcptDF(pVCpu, pMixedCtx);
     8825            pVCpu->hm.s.Event.fPending = false;     /* A vectoring #PF. */
     8826            hmR0VmxSetPendingXcptDF(pVCpu, pMixedCtx);
     8827            Log(("Pending #DF due to vectoring #PF. NP\n"));
    88108828        }
    88118829        STAM_COUNTER_INC(&pVCpu->hm.s.StatExitGuestPF);
     
    88478865#endif
    88488866
    8849     Assert(!pVmxTransient->fVectoringPF || pVCpu->hm.s.Event.fPending);
    8850 
    88518867    rc = hmR0VmxSaveGuestState(pVCpu, pMixedCtx);
    88528868    AssertRCReturn(rc, rc);
    88538869
     8870    Log(("#PF: cr2=%#RGv cs:rip=%#04x:%#RGv uErrCode %#RX32\n", pVmxTransient->uExitQualification, pMixedCtx->cs.Sel,
     8871         pMixedCtx->rip, pVmxTransient->uExitIntrErrorCode));
     8872
    88548873    TRPMAssertXcptPF(pVCpu, pVmxTransient->uExitQualification, (RTGCUINT)pVmxTransient->uExitIntrErrorCode);
    8855 
    8856     /* Forward it to the trap handler first. */
    88578874    rc = PGMTrap0eHandler(pVCpu, pVmxTransient->uExitIntrErrorCode, CPUMCTX2CORE(pMixedCtx),
    88588875                          (RTGCPTR)pVmxTransient->uExitQualification);
    88598876
    8860     Log(("#PF: cr2=%RGv cs:rip=%04x:%RGv errorcode %#RX32 rc=%d\n", pVmxTransient->uExitQualification, pMixedCtx->cs.Sel,
    8861          pMixedCtx->rip, pVmxTransient->uExitIntrErrorCode, rc));
    8862 
     8877    Log(("#PF: rc=%Rrc\n", rc));
    88638878    if (rc == VINF_SUCCESS)
    88648879    {
     
    88748889    else if (rc == VINF_EM_RAW_GUEST_TRAP)
    88758890    {
    8876         if (RT_LIKELY(!pVmxTransient->fVectoringPF))
     8891        if (!pVmxTransient->fVectoringPF)
    88778892        {
    88788893            /* It's a guest page fault and needs to be reflected to the guest. */
     
    88808895            TRPMResetTrap(pVCpu);
    88818896            pMixedCtx->cr2 = pVmxTransient->uExitQualification;
     8897            pVCpu->hm.s.Event.fPending = false;     /* In case it's a contributory #PF. */
    88828898            hmR0VmxSetPendingEvent(pVCpu, VMX_VMCS_CTRL_ENTRY_IRQ_INFO_FROM_EXIT_INT_INFO(pVmxTransient->uExitIntrInfo),
    88838899                                   0 /* cbInstr */, uGstErrorCode, pMixedCtx->cr2);
     
    88878903            /* A guest page-fault occurred during delivery of a page-fault. Inject #DF. */
    88888904            TRPMResetTrap(pVCpu);
    8889             pVCpu->hm.s.Event.fPending = false;
     8905            pVCpu->hm.s.Event.fPending = false;     /* Clear pending #PF for replace it with #DF. */
    88908906            hmR0VmxSetPendingXcptDF(pVCpu, pMixedCtx);
    88918907            Log(("#PF: Pending #DF due to vectoring #PF\n"));
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