- Timestamp:
- Oct 24, 2010 12:29:42 PM (14 years ago)
- Location:
- trunk/src/VBox/HostDrivers/Support
- Files:
-
- 1 added
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/HostDrivers/Support/Makefile.kmk
r32183 r33375 315 315 VBoxDrv_DEFS := VBOX_WITH_HOST_VMX IN_RT_R0 IN_SUP_R0 SUPDRV_WITH_RELEASE_LOGGER VBOX_SVN_REV=$(VBOX_SVN_REV) 316 316 VBoxDrv_DEFS.debug = DEBUG_DARWIN_GIP 317 VBoxDrv_INCS = . 317 VBoxDrv_INCS = . $(VBoxDrv_0_OUTDIR) 318 318 VBoxDrv_LIBS = $(PATH_LIB)/RuntimeR0Drv$(VBOX_SUFF_LIB) 319 319 #VBoxDrv_LDFLAGS = -v -Wl,-whyload -Wl,-v -Wl,-whatsloaded … … 322 322 SUPDrvSem.c \ 323 323 $(KBUILD_TARGET)/SUPDrv-$(KBUILD_TARGET).cpp 324 325 ifdef VBOX_WITH_DTRACE_R0DRV 326 VBoxDrv_DEFS += VBOX_WITH_DTRACE 327 VBoxDrv_INTERMEDIATES += $(VBoxDrv_0_OUTDIR)/SUPDrv-dtrace.h 328 VBoxDrv_CLEAN += $(VBoxDrv_0_OUTDIR)/SUPDrv-dtrace.h $(VBoxDrv_0_OUTDIR)/SUPDrv-dtrace.tmp 329 $$(VBoxDrv_0_OUTDIR)/SUPDrv-dtrace.h: $(PATH_SUB_CURRENT)/SUPDrv-dtrace.d | $$(dir $$@) 330 dtrace -C -h -o [email protected] -s $< 331 $(SED) -e '/<unistd\.h>/d' [email protected] --output $@ 332 $(RM) -f [email protected] 333 endif 324 334 325 335 INSTALLS += VBoxDrv.kext -
trunk/src/VBox/HostDrivers/Support/SUPDrv.c
r33269 r33375 62 62 #include <VBox/hwacc_vmx.h> 63 63 #include <VBox/x86.h> 64 65 #ifdef VBOX_WITH_DTRACE 66 # include "SUPDrv-dtrace.h" 67 #else 68 # define VBOXDRV_SUPDRV_SESSION_CREATE(pvSession, fUser) do { } while (0) 69 # define VBOXDRV_SUPDRV_SESSION_CLOSE(pvSession) do { } while (0) 70 # define VBOXDRV_SUPDRV_IOCCLOSE(pvSession) do { } while (0) 71 # define VBOXDRV_SUPDRV_IOCTL_ENTRY(pvSession, uIOCtl, pvReqHdr) do { } while (0) 72 # define VBOXDRV_SUPDRV_IOCTL_RETURN(pvSession, uIOCtl, pvReqHdr, rcRet, rcReq) do { } while (0) 73 #endif 64 74 65 75 /* … … 653 663 } 654 664 665 VBOXDRV_SUPDRV_SESSION_CREATE(pSession, fUser); 655 666 LogFlow(("Created session %p initial cookie=%#x\n", pSession, pSession->u32Cookie)); 656 667 return VINF_SUCCESS; … … 679 690 void VBOXCALL supdrvCloseSession(PSUPDRVDEVEXT pDevExt, PSUPDRVSESSION pSession) 680 691 { 692 VBOXDRV_SUPDRV_SESSION_CLOSE(pSession); 693 681 694 /* 682 695 * Cleanup the session first. … … 1016 1029 int VBOXCALL supdrvIOCtl(uintptr_t uIOCtl, PSUPDRVDEVEXT pDevExt, PSUPDRVSESSION pSession, PSUPREQHDR pReqHdr) 1017 1030 { 1031 VBOXDRV_SUPDRV_IOCTL_ENTRY(pSession, uIOCtl, pReqHdr); 1032 1018 1033 /* 1019 1034 * Validate the request. … … 1026 1041 OSDBGPRINT(("vboxdrv: Bad ioctl request header; cbIn=%#lx cbOut=%#lx fFlags=%#lx\n", 1027 1042 (long)pReqHdr->cbIn, (long)pReqHdr->cbOut, (long)pReqHdr->fFlags)); 1043 VBOXDRV_SUPDRV_IOCTL_RETURN(pSession, uIOCtl, pReqHdr, VERR_INVALID_PARAMETER, VINF_SUCCESS); 1028 1044 return VERR_INVALID_PARAMETER; 1029 1045 } … … 1033 1049 { 1034 1050 OSDBGPRINT(("SUP_IOCTL_COOKIE: bad cookie %#lx\n", (long)pReqHdr->u32Cookie)); 1051 VBOXDRV_SUPDRV_IOCTL_RETURN(pSession, uIOCtl, pReqHdr, VERR_INVALID_PARAMETER, VINF_SUCCESS); 1035 1052 return VERR_INVALID_PARAMETER; 1036 1053 } … … 1040 1057 { 1041 1058 OSDBGPRINT(("vboxdrv: bad cookie %#lx / %#lx.\n", (long)pReqHdr->u32Cookie, (long)pReqHdr->u32SessionCookie)); 1059 VBOXDRV_SUPDRV_IOCTL_RETURN(pSession, uIOCtl, pReqHdr, VERR_INVALID_PARAMETER, VINF_SUCCESS); 1042 1060 return VERR_INVALID_PARAMETER; 1043 1061 } … … 1052 1070 OSDBGPRINT(( #Name ": Invalid input/output sizes. cbIn=%ld expected %ld. cbOut=%ld expected %ld.\n", \ 1053 1071 (long)pReq->Hdr.cbIn, (long)(cbInExpect), (long)pReq->Hdr.cbOut, (long)(cbOutExpect))); \ 1072 VBOXDRV_SUPDRV_IOCTL_RETURN(pSession, uIOCtl, pReqHdr, VERR_INVALID_PARAMETER, VERR_INVALID_PARAMETER); \ 1054 1073 return pReq->Hdr.rc = VERR_INVALID_PARAMETER; \ 1055 1074 } \ … … 1064 1083 OSDBGPRINT(( #Name ": Invalid input/output sizes. cbIn=%ld expected %ld.\n", \ 1065 1084 (long)pReq->Hdr.cbIn, (long)(cbInExpect))); \ 1085 VBOXDRV_SUPDRV_IOCTL_RETURN(pSession, uIOCtl, pReqHdr, VERR_INVALID_PARAMETER, VERR_INVALID_PARAMETER); \ 1066 1086 return pReq->Hdr.rc = VERR_INVALID_PARAMETER; \ 1067 1087 } \ … … 1074 1094 OSDBGPRINT(( #Name ": Invalid input/output sizes. cbOut=%ld expected %ld.\n", \ 1075 1095 (long)pReq->Hdr.cbOut, (long)(cbOutExpect))); \ 1096 VBOXDRV_SUPDRV_IOCTL_RETURN(pSession, uIOCtl, pReqHdr, VERR_INVALID_PARAMETER, VERR_INVALID_PARAMETER); \ 1076 1097 return pReq->Hdr.rc = VERR_INVALID_PARAMETER; \ 1077 1098 } \ … … 1083 1104 { \ 1084 1105 OSDBGPRINT(( #Name ": %s\n", #expr)); \ 1106 VBOXDRV_SUPDRV_IOCTL_RETURN(pSession, uIOCtl, pReqHdr, VERR_INVALID_PARAMETER, VERR_INVALID_PARAMETER); \ 1085 1107 return pReq->Hdr.rc = VERR_INVALID_PARAMETER; \ 1086 1108 } \ … … 1092 1114 { \ 1093 1115 OSDBGPRINT( fmt ); \ 1116 VBOXDRV_SUPDRV_IOCTL_RETURN(pSession, uIOCtl, pReqHdr, VERR_INVALID_PARAMETER, VERR_INVALID_PARAMETER); \ 1094 1117 return pReq->Hdr.rc = VERR_INVALID_PARAMETER; \ 1095 1118 } \ … … 1110 1133 OSDBGPRINT(("SUP_IOCTL_COOKIE: invalid magic %.16s\n", pReq->u.In.szMagic)); 1111 1134 pReq->Hdr.rc = VERR_INVALID_MAGIC; 1135 VBOXDRV_SUPDRV_IOCTL_RETURN(pSession, uIOCtl, pReqHdr, VINF_SUCCESS, VERR_INVALID_MAGIC); 1112 1136 return 0; 1113 1137 } … … 1127 1151 pReq->u.Out.cFunctions = 0; 1128 1152 pReq->Hdr.rc = VERR_PERMISSION_DENIED; 1153 VBOXDRV_SUPDRV_IOCTL_RETURN(pSession, uIOCtl, pReqHdr, VINF_SUCCESS, VERR_PERMISSION_DENIED); 1129 1154 return 0; 1130 1155 } … … 1147 1172 pReq->u.Out.cFunctions = 0; 1148 1173 pReq->Hdr.rc = VERR_VERSION_MISMATCH; 1174 VBOXDRV_SUPDRV_IOCTL_RETURN(pSession, uIOCtl, pReqHdr, VINF_SUCCESS, pReq->Hdr.rc); 1149 1175 return 0; 1150 1176 } … … 1163 1189 pReq->u.Out.cFunctions = sizeof(g_aFunctions) / sizeof(g_aFunctions[0]); 1164 1190 pReq->Hdr.rc = VINF_SUCCESS; 1191 VBOXDRV_SUPDRV_IOCTL_RETURN(pSession, uIOCtl, pReqHdr, VINF_SUCCESS, pReq->Hdr.rc); 1165 1192 return 0; 1166 1193 } … … 1176 1203 memcpy(&pReq->u.Out.aFunctions[0], g_aFunctions, sizeof(g_aFunctions)); 1177 1204 pReq->Hdr.rc = VINF_SUCCESS; 1205 VBOXDRV_SUPDRV_IOCTL_RETURN(pSession, uIOCtl, pReqHdr, VINF_SUCCESS, pReq->Hdr.rc); 1178 1206 return 0; 1179 1207 } … … 1192 1220 if (RT_FAILURE(pReq->Hdr.rc)) 1193 1221 pReq->Hdr.cbOut = sizeof(pReq->Hdr); 1222 VBOXDRV_SUPDRV_IOCTL_RETURN(pSession, uIOCtl, pReqHdr, VINF_SUCCESS, pReq->Hdr.rc); 1194 1223 return 0; 1195 1224 } … … 1203 1232 /* execute */ 1204 1233 pReq->Hdr.rc = SUPR0UnlockMem(pSession, pReq->u.In.pvR3); 1234 VBOXDRV_SUPDRV_IOCTL_RETURN(pSession, uIOCtl, pReqHdr, VINF_SUCCESS, pReq->Hdr.rc); 1205 1235 return 0; 1206 1236 } … … 1216 1246 if (RT_FAILURE(pReq->Hdr.rc)) 1217 1247 pReq->Hdr.cbOut = sizeof(pReq->Hdr); 1248 VBOXDRV_SUPDRV_IOCTL_RETURN(pSession, uIOCtl, pReqHdr, VINF_SUCCESS, pReq->Hdr.rc); 1218 1249 return 0; 1219 1250 } … … 1227 1258 /* execute */ 1228 1259 pReq->Hdr.rc = SUPR0ContFree(pSession, (RTHCUINTPTR)pReq->u.In.pvR3); 1260 VBOXDRV_SUPDRV_IOCTL_RETURN(pSession, uIOCtl, pReqHdr, VINF_SUCCESS, pReq->Hdr.rc); 1229 1261 return 0; 1230 1262 } … … 1247 1279 /* execute */ 1248 1280 pReq->Hdr.rc = supdrvIOCtl_LdrOpen(pDevExt, pSession, pReq); 1281 VBOXDRV_SUPDRV_IOCTL_RETURN(pSession, uIOCtl, pReqHdr, VINF_SUCCESS, pReq->Hdr.rc); 1249 1282 return 0; 1250 1283 } … … 1287 1320 /* execute */ 1288 1321 pReq->Hdr.rc = supdrvIOCtl_LdrLoad(pDevExt, pSession, pReq); 1322 VBOXDRV_SUPDRV_IOCTL_RETURN(pSession, uIOCtl, pReqHdr, VINF_SUCCESS, pReq->Hdr.rc); 1289 1323 return 0; 1290 1324 } … … 1298 1332 /* execute */ 1299 1333 pReq->Hdr.rc = supdrvIOCtl_LdrFree(pDevExt, pSession, pReq); 1334 VBOXDRV_SUPDRV_IOCTL_RETURN(pSession, uIOCtl, pReqHdr, VINF_SUCCESS, pReq->Hdr.rc); 1300 1335 return 0; 1301 1336 } … … 1310 1345 /* execute */ 1311 1346 pReq->Hdr.rc = supdrvIOCtl_LdrGetSymbol(pDevExt, pSession, pReq); 1347 VBOXDRV_SUPDRV_IOCTL_RETURN(pSession, uIOCtl, pReqHdr, VINF_SUCCESS, pReq->Hdr.rc); 1312 1348 return 0; 1313 1349 } … … 1353 1389 Log4(("SUP_IOCTL_CALL_VMMR0: rc=%Rrc op=%u out=%u arg=%RX64 p/t=%RTproc/%RTthrd\n", 1354 1390 pReq->Hdr.rc, pReq->u.In.uOperation, pReq->Hdr.cbOut, pReq->u.In.u64Arg, RTProcSelf(), RTThreadNativeSelf())); 1391 VBOXDRV_SUPDRV_IOCTL_RETURN(pSession, uIOCtl, pReqHdr, VINF_SUCCESS, pReq->Hdr.rc); 1355 1392 return 0; 1356 1393 } … … 1365 1402 pReq->Hdr.rc = VINF_SUCCESS; 1366 1403 pReq->u.Out.enmMode = SUPR0GetPagingMode(); 1404 VBOXDRV_SUPDRV_IOCTL_RETURN(pSession, uIOCtl, pReqHdr, VINF_SUCCESS, pReq->Hdr.rc); 1367 1405 return 0; 1368 1406 } … … 1379 1417 if (RT_FAILURE(pReq->Hdr.rc)) 1380 1418 pReq->Hdr.cbOut = sizeof(pReq->Hdr); 1419 VBOXDRV_SUPDRV_IOCTL_RETURN(pSession, uIOCtl, pReqHdr, VINF_SUCCESS, pReq->Hdr.rc); 1381 1420 return 0; 1382 1421 } … … 1390 1429 /* execute */ 1391 1430 pReq->Hdr.rc = SUPR0LowFree(pSession, (RTHCUINTPTR)pReq->u.In.pvR3); 1431 VBOXDRV_SUPDRV_IOCTL_RETURN(pSession, uIOCtl, pReqHdr, VINF_SUCCESS, pReq->Hdr.rc); 1392 1432 return 0; 1393 1433 } … … 1403 1443 if (RT_SUCCESS(pReq->Hdr.rc)) 1404 1444 pReq->u.Out.pGipR0 = pDevExt->pGip; 1445 VBOXDRV_SUPDRV_IOCTL_RETURN(pSession, uIOCtl, pReqHdr, VINF_SUCCESS, pReq->Hdr.rc); 1405 1446 return 0; 1406 1447 } … … 1414 1455 /* execute */ 1415 1456 pReq->Hdr.rc = SUPR0GipUnmap(pSession); 1457 VBOXDRV_SUPDRV_IOCTL_RETURN(pSession, uIOCtl, pReqHdr, VINF_SUCCESS, pReq->Hdr.rc); 1416 1458 return 0; 1417 1459 } … … 1429 1471 pSession->pVM = pReq->u.In.pVMR0; 1430 1472 pReq->Hdr.rc = VINF_SUCCESS; 1473 VBOXDRV_SUPDRV_IOCTL_RETURN(pSession, uIOCtl, pReqHdr, VINF_SUCCESS, pReq->Hdr.rc); 1431 1474 return 0; 1432 1475 } … … 1452 1495 if (RT_FAILURE(pReq->Hdr.rc)) 1453 1496 pReq->Hdr.cbOut = sizeof(pReq->Hdr); 1497 VBOXDRV_SUPDRV_IOCTL_RETURN(pSession, uIOCtl, pReqHdr, VINF_SUCCESS, pReq->Hdr.rc); 1454 1498 return 0; 1455 1499 } … … 1470 1514 if (RT_FAILURE(pReq->Hdr.rc)) 1471 1515 pReq->Hdr.cbOut = sizeof(pReq->Hdr); 1516 VBOXDRV_SUPDRV_IOCTL_RETURN(pSession, uIOCtl, pReqHdr, VINF_SUCCESS, pReq->Hdr.rc); 1472 1517 return 0; 1473 1518 } … … 1486 1531 /* execute */ 1487 1532 pReq->Hdr.rc = SUPR0PageProtect(pSession, pReq->u.In.pvR3, pReq->u.In.pvR0, pReq->u.In.offSub, pReq->u.In.cbSub, pReq->u.In.fProt); 1533 VBOXDRV_SUPDRV_IOCTL_RETURN(pSession, uIOCtl, pReqHdr, VINF_SUCCESS, pReq->Hdr.rc); 1488 1534 return 0; 1489 1535 } … … 1497 1543 /* execute */ 1498 1544 pReq->Hdr.rc = SUPR0PageFree(pSession, pReq->u.In.pvR3); 1545 VBOXDRV_SUPDRV_IOCTL_RETURN(pSession, uIOCtl, pReqHdr, VINF_SUCCESS, pReq->Hdr.rc); 1499 1546 return 0; 1500 1547 } … … 1521 1568 /* execute */ 1522 1569 pReq->Hdr.rc = supdrvIOCtl_CallServiceModule(pDevExt, pSession, pReq); 1570 VBOXDRV_SUPDRV_IOCTL_RETURN(pSession, uIOCtl, pReqHdr, VINF_SUCCESS, pReq->Hdr.rc); 1523 1571 return 0; 1524 1572 } … … 1543 1591 /* execute */ 1544 1592 pReq->Hdr.rc = supdrvIOCtl_LoggerSettings(pDevExt, pSession, pReq); 1593 VBOXDRV_SUPDRV_IOCTL_RETURN(pSession, uIOCtl, pReqHdr, VINF_SUCCESS, pReq->Hdr.rc); 1545 1594 return 0; 1546 1595 } … … 1575 1624 break; 1576 1625 } 1626 VBOXDRV_SUPDRV_IOCTL_RETURN(pSession, uIOCtl, pReqHdr, VINF_SUCCESS, pReq->Hdr.rc); 1577 1627 return 0; 1578 1628 } … … 1637 1687 break; 1638 1688 } 1689 VBOXDRV_SUPDRV_IOCTL_RETURN(pSession, uIOCtl, pReqHdr, VINF_SUCCESS, pReq->Hdr.rc); 1639 1690 return 0; 1640 1691 } … … 1788 1839 if (RT_FAILURE(pReq->Hdr.rc)) 1789 1840 pReq->Hdr.cbOut = sizeof(pReq->Hdr); 1841 VBOXDRV_SUPDRV_IOCTL_RETURN(pSession, uIOCtl, pReqHdr, VINF_SUCCESS, pReq->Hdr.rc); 1790 1842 return 0; 1791 1843 } … … 1795 1847 break; 1796 1848 } 1849 VBOXDRV_SUPDRV_IOCTL_RETURN(pSession, uIOCtl, pReqHdr, VERR_GENERAL_FAILURE, VERR_GENERAL_FAILURE); 1797 1850 return VERR_GENERAL_FAILURE; 1798 1851 }
Note:
See TracChangeset
for help on using the changeset viewer.