VirtualBox

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


Ignore:
Timestamp:
Aug 14, 2009 3:10:12 PM (16 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
51097
Message:

Selectively enable TPR patching for certain Windows guests.

Location:
trunk/src/VBox/VMM
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/VMM/HWACCM.cpp

    r22242 r22263  
    328328     */
    329329    PCFGMNODE pRoot      = CFGMR3GetRoot(pVM);
     330
     331    char *pszOSType = NULL;
     332    rc = CFGMR3QueryStringAlloc(pRoot, "OSType", &pszOSType);
     333    AssertRC(rc);
     334   
     335    pVM->hwaccm.s.fTRPPatchingAllowed = false;
     336    if (pszOSType)
     337    {
     338        /* @todo Not exactly pretty to check strings; VBOXOSTYPE would be better, but that requires quite a bit of API change in Main. */
     339        if (    !RTStrCmp(pszOSType, "WindowsNT4")
     340            ||  !RTStrCmp(pszOSType, "WindowsNT")
     341            ||  !RTStrCmp(pszOSType, "Windows 2000")
     342            ||  !RTStrCmp(pszOSType, "WindowsXP")
     343            ||  !RTStrCmp(pszOSType, "Windows 2003"))
     344        {
     345            /* Only allow TPR patching for NT, Win2k, XP and Windows Server 2003. (32 bits mode)
     346             * (IO-APIC presence is checked later on in HWACCMR3InitFinalizeR0)
     347             *
     348             * We may want to consider adding more guest OSes (Solaris) later on.
     349             */
     350            pVM->hwaccm.s.fTRPPatchingAllowed = true;
     351        }
     352        MMR3HeapFree(pszOSType);
     353    }
     354
    330355    PCFGMNODE pHWVirtExt = CFGMR3GetChild(pRoot, "HWVirtExt/");
    331356    /* Nested paging: disabled by default. */
     
    646671
    647672    pVM->hwaccm.s.fHasIoApic = PDMHasIoApic(pVM);
     673    /* No TPR patching is required when the IO-APIC is not enabled for this VM. */
     674    if (!pVM->hwaccm.s.fHasIoApic)
     675        pVM->hwaccm.s.fTRPPatchingAllowed = false;
    648676
    649677    if (pVM->hwaccm.s.vmx.fSupported)
  • trunk/src/VBox/VMM/HWACCMInternal.h

    r22243 r22263  
    274274    bool                        fHasIoApic;
    275275
     276    /** Set when TPR patching is allowed. */
     277    bool                        fTRPPatchingAllowed;
     278
    276279    /** Explicit alignment padding to make 32-bit gcc align u64RegisterMask
    277280     *  naturally. */
    278     bool                        padding[2];
     281    bool                        padding[1];
    279282
    280283    /** And mask for copying register contents. */
  • trunk/src/VBox/VMM/VMMR0/HWSVMR0.cpp

    r22257 r22263  
    16411641#ifdef VBOX_HWACCM_WITH_GUEST_PATCHING
    16421642            /* Shortcut for APIC TPR reads and writes; 32 bits guests only */
    1643             if (    (uFaultAddress & 0xfff) == 0x080
    1644                 &&  pVM->hwaccm.s.fHasIoApic
     1643            if (    pVM->hwaccm.s.fTRPPatchingAllowed
     1644                &&  (uFaultAddress & 0xfff) == 0x080
    16451645                &&  !(errCode & X86_TRAP_PF_P)  /* not present */
    16461646                &&  CPUMGetGuestCPL(pVCpu, CPUMCTX2CORE(pCtx)) == 0
     
    18091809#ifdef VBOX_HWACCM_WITH_GUEST_PATCHING
    18101810        /* Shortcut for APIC TPR reads and writes; 32 bits guests only */
    1811         if (    (uFaultAddress & 0xfff) == 0x080
    1812             &&  pVM->hwaccm.s.fHasIoApic
     1811        if (    pVM->hwaccm.s.fTRPPatchingAllowed
     1812            &&  (uFaultAddress & 0xfff) == 0x080
    18131813            &&  !(errCode & X86_TRAP_PF_P)  /* not present */
    18141814            &&  CPUMGetGuestCPL(pVCpu, CPUMCTX2CORE(pCtx)) == 0
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