VirtualBox

Changeset 81161 in vbox for trunk/src/VBox


Ignore:
Timestamp:
Oct 8, 2019 3:21:59 PM (5 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
133795
Message:

SUP, VMM: bugref: 9562 Drop SUPR0GetRawModeUsability. No longer required with removal of raw-mode.

Location:
trunk/src/VBox
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/HostDrivers/Support/SUPDrv.cpp

    r81006 r81161  
    206206    { "SUPR0GetVTSupport",                      (void *)(uintptr_t)SUPR0GetVTSupport },
    207207    { "SUPR0GetVmxUsability",                   (void *)(uintptr_t)SUPR0GetVmxUsability },
    208     { "SUPR0GetRawModeUsability",               (void *)(uintptr_t)SUPR0GetRawModeUsability },
    209208    { "SUPR0LdrIsLockOwnerByMod",               (void *)(uintptr_t)SUPR0LdrIsLockOwnerByMod },
    210209    { "SUPR0LdrLock",                           (void *)(uintptr_t)SUPR0LdrLock },
     
    41114110
    41124111/**
    4113  * Checks if raw-mode is usable on this system.
    4114  *
    4115  * The reasons why raw-mode isn't safe to use are host specific.  For example on
    4116  * Windows the Hyper-V root partition may perhapse not allow important bits in
    4117  * CR4 to be changed, which would make it impossible to do a world switch.
    4118  *
    4119  * @returns VBox status code.
    4120  */
    4121 SUPR0DECL(int) SUPR0GetRawModeUsability(void)
    4122 {
    4123 #ifdef RT_OS_WINDOWS
    4124     return supdrvOSGetRawModeUsability();
    4125 #else
    4126     return VINF_SUCCESS;
    4127 #endif
    4128 }
    4129 
    4130 
    4131 /**
    41324112 * Gets AMD-V and VT-x support for the calling CPU.
    41334113 *
  • trunk/src/VBox/HostDrivers/Support/SUPDrvInternal.h

    r80531 r81161  
    901901void VBOXCALL   supdrvOSResumeVTxOnCpu(bool fSuspended);
    902902int  VBOXCALL   supdrvOSGetCurrentGdtRw(RTHCUINTPTR *pGdtRw);
    903 int  VBOXCALL   supdrvOSGetRawModeUsability(void);
    904903
    905904/**
  • trunk/src/VBox/HostDrivers/Support/win/SUPDrv-win.cpp

    r81106 r81161  
    19031903
    19041904
    1905 /**
    1906  * Checks whether we're allowed by Hyper-V to modify CR4.
    1907  */
    1908 int  VBOXCALL supdrvOSGetRawModeUsability(void)
    1909 {
    1910     int rc = VINF_SUCCESS;
    1911 
    1912 #ifdef RT_ARCH_AMD64
    1913     /*
    1914      * Broadwell running W10 17083.100:
    1915      *        CR4: 0x170678
    1916      *  Evil mask: 0x170638
    1917      *      X86_CR4_SMEP        - evil
    1918      *      X86_CR4_FSGSBASE    - evil
    1919      *      X86_CR4_PCIDE       - evil
    1920      *      X86_CR4_OSXSAVE     - evil
    1921      *      X86_CR4_OSFXSR      - evil
    1922      *      X86_CR4_OSXMMEEXCPT - evil
    1923      *      X86_CR4_PSE         - evil
    1924      *      X86_CR4_PAE         - evil
    1925      *      X86_CR4_MCE         - okay
    1926      *      X86_CR4_DE          - evil
    1927      */
    1928     if (ASMHasCpuId())
    1929     {
    1930         uint32_t cStd = ASMCpuId_EAX(0);
    1931         if (ASMIsValidStdRange(cStd))
    1932         {
    1933             uint32_t uIgn         = 0;
    1934             uint32_t fEdxFeatures = 0;
    1935             uint32_t fEcxFeatures = 0;
    1936             ASMCpuIdExSlow(1, 0, 0, 0, &uIgn, &uIgn, &fEcxFeatures, &fEdxFeatures);
    1937             if (fEcxFeatures & X86_CPUID_FEATURE_ECX_HVP)
    1938             {
    1939                 RTCCUINTREG  const fOldFlags    = ASMIntDisableFlags();
    1940                 RTCCUINTXREG const fCr4         = ASMGetCR4();
    1941 
    1942                 RTCCUINTXREG const fSafeToClear = X86_CR4_TSD      | X86_CR4_DE     | X86_CR4_PGE  | X86_CR4_PCE
    1943                                                 | X86_CR4_FSGSBASE | X86_CR4_PCIDE  | X86_CR4_SMEP | X86_CR4_SMAP
    1944                                                 | X86_CR4_OSXSAVE  | X86_CR4_OSFXSR | X86_CR4_OSXMMEEXCPT;
    1945                 RTCCUINTXREG       fLoadCr4     = fCr4 & ~fSafeToClear;
    1946                 RTCCUINTXREG const fCleared     = fCr4 & fSafeToClear;
    1947                 if (!(fCleared & X86_CR4_TSD) && (fEdxFeatures & X86_CPUID_FEATURE_EDX_TSC))
    1948                     fLoadCr4 |= X86_CR4_TSD;
    1949                 if (!(fCleared & X86_CR4_PGE) && (fEdxFeatures & X86_CPUID_FEATURE_EDX_PGE))
    1950                     fLoadCr4 |= X86_CR4_PGE;
    1951                 __try
    1952                 {
    1953                     ASMSetCR4(fLoadCr4);
    1954                 }
    1955                 __except(EXCEPTION_EXECUTE_HANDLER)
    1956                 {
    1957                     rc = VERR_SUPDRV_NO_RAW_MODE_HYPER_V_ROOT;
    1958                 }
    1959                 if (RT_SUCCESS(rc))
    1960                     ASMSetCR4(fCr4);
    1961                 ASMSetFlags(fOldFlags);
    1962             }
    1963         }
    1964     }
    1965 #endif
    1966     return rc;
    1967 }
    1968 
    1969 
    19701905#define MY_SystemLoadGdiDriverInSystemSpaceInformation  54
    19711906#define MY_SystemUnloadGdiDriverInformation             27
  • trunk/src/VBox/VMM/VMMR0/VMMR0.cpp

    r81153 r81161  
    164164#endif
    165165
    166 /** The result of SUPR0GetRawModeUsability(), set by ModuleInit(). */
    167 int g_rcRawModeUsability = VINF_SUCCESS;
    168 
    169166
    170167/**
     
    257254                                            if (RT_SUCCESS(rc))
    258255                                            {
    259                                                 g_rcRawModeUsability = SUPR0GetRawModeUsability();
    260                                                 if (g_rcRawModeUsability != VINF_SUCCESS)
    261                                                     SUPR0Printf("VMMR0!ModuleInit: SUPR0GetRawModeUsability -> %Rrc\n",
    262                                                                 g_rcRawModeUsability);
    263256                                                LogFlow(("ModuleInit: returns success\n"));
    264257                                                return VINF_SUCCESS;
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