Changeset 54650 in vbox for trunk/src/VBox/HostDrivers
- Timestamp:
- Mar 5, 2015 1:42:10 PM (10 years ago)
- svn:sync-xref-src-repo-rev:
- 98797
- Location:
- trunk/src/VBox/HostDrivers/Support
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/HostDrivers/Support/SUPDrv.cpp
r54467 r54650 159 159 { "SUPR0ContAlloc", (void *)SUPR0ContAlloc }, 160 160 { "SUPR0ContFree", (void *)SUPR0ContFree }, 161 { "SUPR0ChangeCR4", (void *)SUPR0ChangeCR4 }, 161 162 { "SUPR0EnableVTx", (void *)SUPR0EnableVTx }, 162 163 { "SUPR0SuspendVTxOnCpu", (void *)SUPR0SuspendVTxOnCpu }, … … 3668 3669 3669 3670 /** 3671 * Change CR4 and take care of the kernel CR4 shadow if applicable. 3672 * 3673 * CR4 shadow handling is required for Linux >= 4.0. Calling this function 3674 * instead of ASMSetCR4() is only necessary for semi-permanent CR4 changes 3675 * for code with interrupts enabled. 3676 * 3677 * @returns the old CR4 value. 3678 * 3679 * @param fOrMask bits to be set in CR4. 3680 * @param fAndMask bits to be cleard in CR4. 3681 * 3682 * @remarks Must be called with preemption/interrupts disabled. 3683 */ 3684 SUPR0DECL(RTCCUINTREG) SUPR0ChangeCR4(RTCCUINTREG fOrMask, RTCCUINTREG fAndMask) 3685 { 3686 #ifdef RT_OS_LINUX 3687 return supdrvOSChangeCR4(fOrMask, fAndMask); 3688 #else 3689 RTCCUINTREG uOld = ASMReadCR4(); 3690 RTCCUINTREG uNew = (uOld & fAndMask) | fOrMask; 3691 if (uNew != uOld) 3692 ASMSetCR4(uNew); 3693 return uOld; 3694 #endif 3695 } 3696 3697 3698 /** 3670 3699 * Enables or disabled hardware virtualization extensions using native OS APIs. 3671 3700 * -
trunk/src/VBox/HostDrivers/Support/SUPDrvIOC.h
r54467 r54650 215 215 * - (nothing) 216 216 */ 217 #define SUPDRV_IOC_VERSION 0x001f000 3217 #define SUPDRV_IOC_VERSION 0x001f0004 218 218 219 219 /** SUP_IOCTL_COOKIE. */ -
trunk/src/VBox/HostDrivers/Support/SUPDrvInternal.h
r54581 r54650 808 808 bool VBOXCALL supdrvOSAreTscDeltasInSync(void); 809 809 int VBOXCALL supdrvOSEnableVTx(bool fEnabled); 810 RTCCUINTREG VBOXCALL supdrvOSChangeCR4(RTCCUINTREG fOrMask, RTCCUINTREG fAndMask); 810 811 bool VBOXCALL supdrvOSSuspendVTxOnCpu(void); 811 812 void VBOXCALL supdrvOSResumeVTxOnCpu(bool fSuspended); -
trunk/src/VBox/HostDrivers/Support/SUPLib.cpp
r54467 r54650 280 280 CookieReq.u.In.u32ReqVersion = SUPDRV_IOC_VERSION; 281 281 const uint32_t uMinVersion = (SUPDRV_IOC_VERSION & 0xffff0000) == 0x001f0000 282 ? 0x001f000 3282 ? 0x001f0004 283 283 : SUPDRV_IOC_VERSION & 0xffff0000; 284 284 CookieReq.u.In.u32MinVersion = uMinVersion; -
trunk/src/VBox/HostDrivers/Support/linux/SUPDrv-linux.c
r54581 r54650 69 69 # define SUPDRV_LINUX_HAS_SAFE_MSR_API 70 70 # include <asm/msr.h> 71 # include <iprt/asm-amd64-x86.h>72 # endif71 #endif 72 #include <iprt/asm-amd64-x86.h> 73 73 74 74 … … 823 823 824 824 825 RTCCUINTREG 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 825 845 void VBOXCALL supdrvOSCleanupSession(PSUPDRVDEVEXT pDevExt, PSUPDRVSESSION pSession) 826 846 {
Note:
See TracChangeset
for help on using the changeset viewer.