VirtualBox

Changeset 45487 in vbox for trunk


Ignore:
Timestamp:
Apr 11, 2013 4:01:22 PM (12 years ago)
Author:
vboxsync
Message:

VMMR0/HMVMXR0: Fix LDTR usable bit, fixes NetBSD guests.

File:
1 edited

Legend:

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

    r45481 r45487  
    24262426            Assert(!(u32TprThreshold & 0xfffffff0));            /* Bits 31:4 MBZ. */
    24272427
    2428             Log(("Getting TPR=%d Threshold=%u\n", pVCpu->hm.s.vmx.pbVirtApic[0x80], u32TprThreshold));
    24292428            rc = VMXWriteVmcs32(VMX_VMCS32_CTRL_TPR_THRESHOLD, u32TprThreshold);
    24302429            AssertRCReturn(rc, rc);
     
    34423441        /* The unusable bit is specific to VT-x, if it's a null selector mark it as an unusable segment. */
    34433442        uint32_t u32Access = 0;
    3444         if (!(pCtx->ldtr.Attr.u & VMX_SEL_UNUSABLE))
     3443        if (!pCtx->ldtr.Attr.u)
    34453444            u32Access = VMX_SEL_UNUSABLE;
    34463445        else
     
    55595558                break;
    55605559        }
     5560        Log(("Converting pending HM event to TRPM trap uVector=%#x enmTrapType=%d\n", uVector, enmTrapType));
    55615561        int rc = TRPMAssertTrap(pVCpu, uVector, enmTrapType);
    55625562        AssertRC(rc);
    55635563        if (fErrorCodeValid)
    55645564            TRPMSetErrorCode(pVCpu, uErrorCode);
    5565 
    5566         /* Clear the VT-x state bits now that TRPM has the information. */
     5565        AssertRC(rc);
    55675566        pVCpu->hm.s.Event.fPending = false;
    5568         rc = VMXWriteVmcs32(VMX_VMCS32_CTRL_ENTRY_INTERRUPTION_INFO, 0);
    5569         AssertRC(rc);
    5570     }
     5567    }
     5568
     5569    /* Clear the VT-x state bits to prevent any stale injection. */
     5570    int rc2 = VMXWriteVmcs32(VMX_VMCS32_CTRL_ENTRY_INTERRUPTION_INFO, 0);
     5571    AssertRC(rc2);
    55715572}
    55725573
     
    57865787    if (pVCpu->hm.s.Event.fPending)
    57875788    {
     5789        Log(("Pending event\n"));
    57885790        int rc = hmR0VmxInjectEventVmcs(pVM, pVCpu, pMixedCtx, pVCpu->hm.s.Event.u64IntrInfo, 0 /* cbInstr */,
    57895791                                    pVCpu->hm.s.Event.u32ErrCode);
     
    58035805        uIntrInfo |= (1 << VMX_EXIT_INTERRUPTION_INFO_VALID_SHIFT);
    58045806        uIntrInfo |= (VMX_EXIT_INTERRUPTION_INFO_TYPE_NMI << VMX_EXIT_INTERRUPTION_INFO_TYPE_SHIFT);
     5807        Log(("Injecting NMI\n"));
    58055808        int rc = hmR0VmxInjectEventVmcs(pVM, pVCpu, pMixedCtx, uIntrInfo, 0 /* cbInstr */, 0 /* u32ErrCode */);
    58065809        AssertRCReturn(rc, rc);
     
    58295832                if (RT_SUCCESS(rc))
    58305833                {
     5834                    Log(("PDMGetInterrupt: u8Interrupt=%#x\n", u8Interrupt));
    58315835                    /* Convert pending interrupt from PIC/APIC into TRPM and handle it below. */
    58325836                    rc = TRPMAssertTrap(pVCpu, u8Interrupt, TRPM_HARDWARE_INT);
     
    58575861        && TRPMHasTrap(pVCpu))
    58585862    {
     5863        Log(("Injecting TRPM trap\n"));
    58595864        rc = hmR0VmxInjectTRPMTrap(pVM, pVCpu, pMixedCtx);
     5865        Assert(!TRPMHasTrap(pVCpu));
    58605866        AssertRCReturn(rc, rc);
    58615867    }
     
    64466452    /* Load the required guest state bits (for guest-state changes in the inner execution loop). */
    64476453    Assert(!(pVCpu->hm.s.fContextUseFlags & HM_CHANGED_HOST_CONTEXT));
    6448     Log(("LoadFlags=%#RX32\n", pVCpu->hm.s.fContextUseFlags));
     6454    Log4(("LoadFlags=%#RX32\n", pVCpu->hm.s.fContextUseFlags));
    64496455    int rc = VINF_SUCCESS;
    64506456    if (pVCpu->hm.s.fContextUseFlags == HM_CHANGED_GUEST_RIP)
     
    65816587            && pVmxTransient->u8GuestTpr != pVCpu->hm.s.vmx.pbVirtApic[0x80])
    65826588        {
    6583             Log(("Setting TPR=%d\n", pVCpu->hm.s.vmx.pbVirtApic[0x80]));
    65846589            rc = PDMApicSetTPR(pVCpu, pVCpu->hm.s.vmx.pbVirtApic[0x80]);
    65856590            AssertRC(rc);
     
    76717676                    pVCpu->hm.s.fContextUseFlags |= HM_CHANGED_GUEST_CR0;
    76727677                    break;
    7673                 case 2: /* CR2 */
    7674                     Log(("CR2 write rc=%d\n", rc));
    7675                     break;
    76767678                case 3: /* CR3 */
    76777679                    Assert(!pVM->hm.s.fNestedPaging || !CPUMIsGuestPagingEnabledEx(pMixedCtx));
     
    80368038                                                  CPUMCTX2CORE(pMixedCtx), GCPhys);
    80378039            rc = VBOXSTRICTRC_VAL(rc2);
    8038             Log(("ApicAccess %RGp %#x\n", GCPhys, VMX_EXIT_QUALIFICATION_APIC_ACCESS_OFFSET(pVmxTransient->uExitQualification)));
     8040            Log(("ApicAccess %RGp %#x rc=%d\n", GCPhys,
     8041                 VMX_EXIT_QUALIFICATION_APIC_ACCESS_OFFSET(pVmxTransient->uExitQualification), rc));
    80398042            if (   rc == VINF_SUCCESS
    80408043                || rc == VERR_PAGE_TABLE_NOT_PRESENT
     
    83158318    }
    83168319
    8317     Assert(rc == VINF_SUCCESS || rc == VINF_EM_RESET);
     8320    Assert(rc == VINF_SUCCESS || rc == VINF_EM_RESET || rc == VINF_EM_RAW_GUEST_TRAP || rc == VINF_EM_DBG_BREAKPOINT);
    83188321    return rc;
    83198322}
     
    84288431        rc |= hmR0VmxReadExitIntrErrorCodeVmcs(pVCpu, pVmxTransient);
    84298432        rc |= hmR0VmxReadExitInstrLenVmcs(pVCpu, pVmxTransient);
     8433        rc |= hmR0VmxSaveGuestRip(pVM, pVCpu, pMixedCtx);
     8434        Log(("#GP Gst: RIP %#RX64\n", pMixedCtx->rip));
    84308435        rc |= hmR0VmxInjectEventVmcs(pVM, pVCpu, pMixedCtx,
    84318436                                        VMX_VMCS_CTRL_ENTRY_IRQ_INFO_FROM_EXIT_INT_INFO(pVmxTransient->uExitIntrInfo),
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