VirtualBox

Changeset 14650 in vbox for trunk/src/VBox/VMM


Ignore:
Timestamp:
Nov 26, 2008 3:25:13 PM (16 years ago)
Author:
vboxsync
Message:

Partial VT-x cleanup.

File:
1 edited

Legend:

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

    r14649 r14650  
    413413
    414414        /* Init TSC offset to zero. */
    415         rc  = VMXWriteVMCS(VMX_VMCS_CTRL_TSC_OFFSET_FULL, 0);
    416 #if HC_ARCH_BITS == 32
    417         rc |= VMXWriteVMCS(VMX_VMCS_CTRL_TSC_OFFSET_HIGH, 0);
    418 #endif
    419         AssertRC(rc);
    420 
    421         rc  = VMXWriteVMCS(VMX_VMCS_CTRL_IO_BITMAP_A_FULL, 0);
    422 #if HC_ARCH_BITS == 32
    423         rc |= VMXWriteVMCS(VMX_VMCS_CTRL_IO_BITMAP_A_HIGH, 0);
    424 #endif
    425         AssertRC(rc);
    426 
    427         rc  = VMXWriteVMCS(VMX_VMCS_CTRL_IO_BITMAP_B_FULL, 0);
    428 #if HC_ARCH_BITS == 32
    429         rc |= VMXWriteVMCS(VMX_VMCS_CTRL_IO_BITMAP_B_HIGH, 0);
    430 #endif
     415        rc = VMXWriteVMCS64(VMX_VMCS_CTRL_TSC_OFFSET_FULL, 0);
     416        AssertRC(rc);
     417
     418        rc = VMXWriteVMCS64(VMX_VMCS_CTRL_IO_BITMAP_A_FULL, 0);
     419        AssertRC(rc);
     420
     421        rc = VMXWriteVMCS64(VMX_VMCS_CTRL_IO_BITMAP_B_FULL, 0);
    431422        AssertRC(rc);
    432423
     
    435426        {
    436427            /* Optional */
    437             rc  = VMXWriteVMCS(VMX_VMCS_CTRL_MSR_BITMAP_FULL, pVM->hwaccm.s.vmx.pMSRBitmapPhys);
    438 #if HC_ARCH_BITS == 32
    439             rc |= VMXWriteVMCS(VMX_VMCS_CTRL_MSR_BITMAP_HIGH, pVM->hwaccm.s.vmx.pMSRBitmapPhys >> 32ULL);
    440 #endif
     428            rc = VMXWriteVMCS64(VMX_VMCS_CTRL_MSR_BITMAP_FULL, pVM->hwaccm.s.vmx.pMSRBitmapPhys);
    441429            AssertRC(rc);
    442430        }
    443431
    444432        /* Clear MSR controls. */
    445         rc  = VMXWriteVMCS(VMX_VMCS_CTRL_VMEXIT_MSR_STORE_FULL, 0);
    446         rc |= VMXWriteVMCS(VMX_VMCS_CTRL_VMEXIT_MSR_LOAD_FULL, 0);
    447         rc |= VMXWriteVMCS(VMX_VMCS_CTRL_VMENTRY_MSR_LOAD_FULL, 0);
    448 #if HC_ARCH_BITS == 32
    449         rc |= VMXWriteVMCS(VMX_VMCS_CTRL_VMEXIT_MSR_STORE_HIGH, 0);
    450         rc |= VMXWriteVMCS(VMX_VMCS_CTRL_VMEXIT_MSR_LOAD_HIGH, 0);
    451         rc |= VMXWriteVMCS(VMX_VMCS_CTRL_VMEXIT_MSR_LOAD_HIGH, 0);
    452 #endif
     433        rc  = VMXWriteVMCS64(VMX_VMCS_CTRL_VMEXIT_MSR_STORE_FULL, 0);
     434        rc |= VMXWriteVMCS64(VMX_VMCS_CTRL_VMEXIT_MSR_LOAD_FULL, 0);
     435        rc |= VMXWriteVMCS64(VMX_VMCS_CTRL_VMENTRY_MSR_LOAD_FULL, 0);
    453436        rc |= VMXWriteVMCS(VMX_VMCS_CTRL_EXIT_MSR_STORE_COUNT, 0);
    454437        rc |= VMXWriteVMCS(VMX_VMCS_CTRL_EXIT_MSR_LOAD_COUNT, 0);
     
    460443            /* Optional */
    461444            rc  = VMXWriteVMCS(VMX_VMCS_CTRL_TPR_THRESHOLD, 0);
    462             rc |= VMXWriteVMCS(VMX_VMCS_CTRL_VAPIC_PAGEADDR_FULL, pVM->hwaccm.s.vmx.pAPICPhys);
    463 #if HC_ARCH_BITS == 32
    464             rc |= VMXWriteVMCS(VMX_VMCS_CTRL_VAPIC_PAGEADDR_HIGH, pVM->hwaccm.s.vmx.pAPICPhys >> 32ULL);
    465 #endif
     445            rc |= VMXWriteVMCS64(VMX_VMCS_CTRL_VAPIC_PAGEADDR_FULL, pVM->hwaccm.s.vmx.pAPICPhys);
    466446            AssertRC(rc);
    467447        }
    468448
    469449        /* Set link pointer to -1. Not currently used. */
    470 #if HC_ARCH_BITS == 32
    471         rc  = VMXWriteVMCS(VMX_VMCS_GUEST_LINK_PTR_FULL, 0xFFFFFFFF);
    472         rc |= VMXWriteVMCS(VMX_VMCS_GUEST_LINK_PTR_HIGH, 0xFFFFFFFF);
    473 #else
    474         rc  = VMXWriteVMCS(VMX_VMCS_GUEST_LINK_PTR_FULL, 0xFFFFFFFFFFFFFFFF);
    475 #endif
     450        rc = VMXWriteVMCS64(VMX_VMCS_GUEST_LINK_PTR_FULL, 0xFFFFFFFFFFFFFFFF);
    476451        AssertRC(rc);
    477452
     
    908883        {
    909884            Pdpe = PGMGstGetPaePDPtr(pVM, i);
    910             int rc = VMXWriteVMCS(VMX_VMCS_GUEST_PDPTR0_FULL + i*2, Pdpe.u);
    911 #if HC_ARCH_BITS == 32
    912             rc    |= VMXWriteVMCS(VMX_VMCS_GUEST_PDPTR0_FULL + i*2 + 1, Pdpe.u >> 32ULL);
    913 #endif
     885            int rc = VMXWriteVMCS64(VMX_VMCS_GUEST_PDPTR0_FULL + i*2, Pdpe.u);
    914886            AssertRC(rc);
    915887        }
     
    12891261                                             | (VMX_EPT_PAGE_WALK_LENGTH_DEFAULT << VMX_EPT_PAGE_WALK_LENGTH_SHIFT);
    12901262
    1291             rc = VMXWriteVMCS(VMX_VMCS_CTRL_EPTP_FULL, pVCpu->hwaccm.s.vmx.GCPhysEPTP);
    1292 #if HC_ARCH_BITS == 32
    1293             rc = VMXWriteVMCS(VMX_VMCS_CTRL_EPTP_HIGH, (uint32_t)(pVCpu->hwaccm.s.vmx.GCPhysEPTP >> 32ULL));
    1294 #endif
     1263            rc = VMXWriteVMCS64(VMX_VMCS_CTRL_EPTP_FULL, pVCpu->hwaccm.s.vmx.GCPhysEPTP);
    12951264            AssertRC(rc);
    12961265
     
    13591328
    13601329        /* IA32_DEBUGCTL MSR. */
    1361         rc  = VMXWriteVMCS(VMX_VMCS_GUEST_DEBUGCTL_FULL,    0);
    1362         rc |= VMXWriteVMCS(VMX_VMCS_GUEST_DEBUGCTL_HIGH,    0);
     1330        rc = VMXWriteVMCS64(VMX_VMCS_GUEST_DEBUGCTL_FULL,    0);
    13631331        AssertRC(rc);
    13641332
     
    13971365    {
    13981366        /* Note: VMX_VMCS_CTRL_PROC_EXEC_CONTROLS_RDTSC_EXIT takes precedence over TSC_OFFSET */
    1399         rc  = VMXWriteVMCS(VMX_VMCS_CTRL_TSC_OFFSET_FULL, u64TSCOffset);
    1400 #if HC_ARCH_BITS == 32
    1401         rc |= VMXWriteVMCS(VMX_VMCS_CTRL_TSC_OFFSET_HIGH, (uint32_t)(u64TSCOffset >> 32ULL));
    1402 #endif
     1367        rc = VMXWriteVMCS64(VMX_VMCS_CTRL_TSC_OFFSET_FULL, u64TSCOffset);
    14031368        AssertRC(rc);
    14041369
     
    23732338        Assert(pVM->hwaccm.s.fNestedPaging);
    23742339
    2375 #if HC_ARCH_BITS == 64
    2376         rc = VMXReadVMCS(VMX_VMCS_EXIT_PHYS_ADDR_FULL, &GCPhys);
    2377         AssertRC(rc);
    2378 #else
    2379         uint32_t val_hi;
    2380         rc = VMXReadVMCS(VMX_VMCS_EXIT_PHYS_ADDR_FULL, &val);
    2381         AssertRC(rc);
    2382         rc = VMXReadVMCS(VMX_VMCS_EXIT_PHYS_ADDR_HIGH, &val_hi);
    2383         AssertRC(rc);
    2384         GCPhys = RT_MAKE_U64(val, val_hi);
    2385 #endif
    2386 
     2340        rc = VMXReadVMCS64(VMX_VMCS_EXIT_PHYS_ADDR_FULL, &GCPhys);
     2341        AssertRC(rc);
    23872342        Assert(((exitQualification >> 7) & 3) != 2);
    23882343
     
    24352390        Assert(pVM->hwaccm.s.fNestedPaging);
    24362391
    2437 #if HC_ARCH_BITS == 64
    2438         rc = VMXReadVMCS(VMX_VMCS_EXIT_PHYS_ADDR_FULL, &GCPhys);
    2439         AssertRC(rc);
    2440 #else
    2441         uint32_t val_hi;
    2442         rc = VMXReadVMCS(VMX_VMCS_EXIT_PHYS_ADDR_FULL, &val);
    2443         AssertRC(rc);
    2444         rc = VMXReadVMCS(VMX_VMCS_EXIT_PHYS_ADDR_HIGH, &val_hi);
    2445         AssertRC(rc);
    2446         GCPhys = RT_MAKE_U64(val, val_hi);
    2447 #endif
     2392        rc = VMXReadVMCS64(VMX_VMCS_EXIT_PHYS_ADDR_FULL, &GCPhys);
     2393        AssertRC(rc);
    24482394
    24492395        Log(("VMX_EXIT_EPT_MISCONFIG for %VGp\n", GCPhys));
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