VirtualBox

Ignore:
Timestamp:
Mar 5, 2015 1:42:10 PM (10 years ago)
Author:
vboxsync
Message:

SUPDrv/VMMR0: properly handle the CR4 shadow register on Linux >= 4.0

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/HostDrivers/Support/linux/SUPDrv-linux.c

    r54581 r54650  
    6969# define SUPDRV_LINUX_HAS_SAFE_MSR_API
    7070# include <asm/msr.h>
    71 # include <iprt/asm-amd64-x86.h>
    72 #endif
     71#endif
     72#include <iprt/asm-amd64-x86.h>
    7373
    7474
     
    823823
    824824
     825RTCCUINTREG VBOXCALL supdrvOSChangeCR4(RTCCUINTREG fOrMask, RTCCUINTREG fAndMask)
     826{
     827#if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 20, 0)
     828    RTCCUINTREG uOld = this_cpu_read(cpu_tlbstate.cr4);
     829    RTCCUINTREG uNew = (uOld & fAndMask) | fOrMask;
     830    if (uNew != uOld)
     831    {
     832        this_cpu_write(cpu_tlbstate.cr4, uNew);
     833        __write_cr4(uNew);
     834    }
     835#else
     836    RTCCUINTREG uOld = ASMGetCR4();
     837    RTCCUINTREG uNew = (uOld & fAndMask) | fOrMask;
     838    if (uNew != uOld)
     839        ASMSetCR4(uNew);
     840#endif
     841    return uOld;
     842}
     843
     844
    825845void VBOXCALL supdrvOSCleanupSession(PSUPDRVDEVEXT pDevExt, PSUPDRVSESSION pSession)
    826846{
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