Changeset 55318 in vbox for trunk/src/VBox/HostDrivers/Support/darwin
- Timestamp:
- Apr 17, 2015 8:25:49 AM (10 years ago)
- svn:sync-xref-src-repo-rev:
- 99638
- Location:
- trunk
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk
- Property svn:mergeinfo changed
/branches/VBox-4.3 merged: 98913
- Property svn:mergeinfo changed
-
trunk/src/VBox
- Property svn:mergeinfo changed
/branches/VBox-4.3/src/VBox merged: 98913
- Property svn:mergeinfo changed
-
trunk/src/VBox/HostDrivers/Support/darwin/SUPDrv-darwin.cpp
r54581 r55318 52 52 #include <iprt/power.h> 53 53 #include <iprt/dbg.h> 54 #include <iprt/x86.h> 54 55 #include <VBox/err.h> 55 56 #include <VBox/log.h> … … 105 106 static int VBoxDrvDarwinClose(dev_t Dev, int fFlags, int fDevType, struct proc *pProcess); 106 107 static int VBoxDrvDarwinIOCtl(dev_t Dev, u_long iCmd, caddr_t pData, int fFlags, struct proc *pProcess); 108 static int VBoxDrvDarwinIOCtlSMAP(dev_t Dev, u_long iCmd, caddr_t pData, int fFlags, struct proc *pProcess); 107 109 static int VBoxDrvDarwinIOCtlSlow(PSUPDRVSESSION pSession, u_long iCmd, caddr_t pData, struct proc *pProcess); 108 110 … … 113 115 114 116 static void vboxdrvDarwinResolveSymbols(void); 117 static bool vboxdrvDarwinCpuHasSMAP(void); 115 118 116 119 … … 275 278 if (RT_SUCCESS(rc)) 276 279 { 280 if (vboxdrvDarwinCpuHasSMAP()) 281 g_DevCW.d_ioctl = VBoxDrvDarwinIOCtlSMAP; 277 282 /* 278 283 * Registering ourselves as a character device. … … 598 603 599 604 /** 605 * Alternative Device I/O Control entry point on hosts with SMAP support. 606 * 607 * @returns Darwin for slow IOCtls and VBox status code for the fast ones. 608 * @param Dev The device number (major+minor). 609 * @param iCmd The IOCtl command. 610 * @param pData Pointer to the data (if any it's a SUPDRVIOCTLDATA (kernel copy)). 611 * @param fFlags Flag saying we're a character device (like we didn't know already). 612 * @param pProcess The process issuing this request. 613 */ 614 static int VBoxDrvDarwinIOCtlSMAP(dev_t Dev, u_long iCmd, caddr_t pData, int fFlags, struct proc *pProcess) 615 { 616 /* 617 * Allow VBox R0 code to touch R3 memory. Setting the AC bit disables the 618 * SMAP check. 619 */ 620 RTCCUINTREG uFlags = ASMGetFlags(); 621 ASMSetAC(); 622 int rc = VBoxDrvDarwinIOCtl(Dev, iCmd, pData, fFlags, pProcess); 623 ASMSetFlags(uFlags); 624 return rc; 625 } 626 627 628 /** 600 629 * Worker for VBoxDrvDarwinIOCtl that takes the slow IOCtl functions. 601 630 * … … 1286 1315 } 1287 1316 1317 /** 1318 * Check if the CPU has SMAP support. 1319 */ 1320 static bool vboxdrvDarwinCpuHasSMAP(void) 1321 { 1322 uint32_t uMaxId, uEAX, uEBX, uECX, uEDX; 1323 ASMCpuId(0, &uMaxId, &uEBX, &uECX, &uEDX); 1324 if ( ASMIsValidStdRange(uMaxId) 1325 && uMaxId >= 0x00000007) 1326 { 1327 ASMCpuId_Idx_ECX(0x00000007, 0, &uEAX, &uEBX, &uECX, &uEDX); 1328 if (uEBX & X86_CPUID_STEXT_FEATURE_EBX_SMAP) 1329 return true; 1330 } 1331 return false; 1332 } 1288 1333 1289 1334 RTDECL(int) SUPR0Printf(const char *pszFormat, ...)
Note:
See TracChangeset
for help on using the changeset viewer.