Changeset 57276 in vbox for trunk/src/VBox/Runtime
- Timestamp:
- Aug 11, 2015 2:39:19 PM (10 years ago)
- Location:
- trunk/src/VBox/Runtime/r0drv/linux
- Files:
-
- 19 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Runtime/r0drv/linux/RTLogWriteDebugger-r0drv-linux.c
r56290 r57276 36 36 RTDECL(void) RTLogWriteDebugger(const char *pch, size_t cb) 37 37 { 38 IPRT_LINUX_SAVE_EFL_AC(); 38 39 printk("%.*s", (int)cb, pch); 40 IPRT_LINUX_RESTORE_EFL_AC(); 39 41 } 40 42 RT_EXPORT_SYMBOL(RTLogWriteDebugger); -
trunk/src/VBox/Runtime/r0drv/linux/alloc-r0drv-linux.c
r56290 r57276 235 235 { 236 236 PRTMEMHDR pHdr; 237 IPRT_LINUX_SAVE_EFL_AC(); 237 238 238 239 /* … … 298 299 } 299 300 if (RT_UNLIKELY(!pHdr)) 301 { 302 IPRT_LINUX_RESTORE_EFL_AC(); 300 303 return VERR_NO_MEMORY; 304 } 301 305 302 306 /* … … 309 313 310 314 *ppHdr = pHdr; 315 IPRT_LINUX_RESTORE_EFL_AC(); 311 316 return VINF_SUCCESS; 312 317 } … … 318 323 DECLHIDDEN(void) rtR0MemFree(PRTMEMHDR pHdr) 319 324 { 325 IPRT_LINUX_SAVE_EFL_AC(); 326 320 327 pHdr->u32Magic += 1; 321 328 if (pHdr->fFlags & RTMEMHDR_FLAG_KMALLOC) … … 346 353 else 347 354 vfree(pHdr); 355 356 IPRT_LINUX_RESTORE_EFL_AC(); 348 357 } 349 358 … … 384 393 unsigned cPages; 385 394 struct page *paPages; 395 void *pvRet; 396 IPRT_LINUX_SAVE_EFL_AC(); 386 397 387 398 /* … … 435 446 } 436 447 *pPhys = page_to_phys(paPages); 437 return phys_to_virt(page_to_phys(paPages)); 438 } 439 448 pvRet = phys_to_virt(page_to_phys(paPages)); 449 } 450 else 451 pvRet = NULL; 452 453 IPRT_LINUX_RESTORE_EFL_AC(); 440 454 return NULL; 441 455 } … … 457 471 unsigned iPage; 458 472 struct page *paPages; 473 IPRT_LINUX_SAVE_EFL_AC(); 459 474 460 475 /* validate */ … … 479 494 } 480 495 __free_pages(paPages, cOrder); 496 IPRT_LINUX_RESTORE_EFL_AC(); 481 497 } 482 498 } -
trunk/src/VBox/Runtime/r0drv/linux/assert-r0drv-linux.c
r56290 r57276 43 43 DECLHIDDEN(void) rtR0AssertNativeMsg1(const char *pszExpr, unsigned uLine, const char *pszFile, const char *pszFunction) 44 44 { 45 IPRT_LINUX_SAVE_EFL_AC(); 45 46 printk(KERN_EMERG 46 47 "\r\n!!Assertion Failed!!\r\n" … … 48 49 "Location : %s(%d) %s\r\n", 49 50 pszExpr, pszFile, uLine, pszFunction); 51 IPRT_LINUX_RESTORE_EFL_AC(); 50 52 } 51 53 … … 54 56 { 55 57 char szMsg[256]; 58 IPRT_LINUX_SAVE_EFL_AC(); 56 59 57 60 RTStrPrintfV(szMsg, sizeof(szMsg) - 1, pszFormat, va); … … 60 63 61 64 NOREF(fInitial); 65 IPRT_LINUX_RESTORE_EFL_AC(); 62 66 } 63 67 -
trunk/src/VBox/Runtime/r0drv/linux/initterm-r0drv-linux.c
r56290 r57276 63 63 DECLHIDDEN(void) rtR0LnxWorkqueuePush(RTR0LNXWORKQUEUEITEM *pWork, void (*pfnWorker)(RTR0LNXWORKQUEUEITEM *)) 64 64 { 65 IPRT_LINUX_SAVE_EFL_AC(); 66 65 67 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 5, 41) 66 68 # if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 20) … … 74 76 queue_task(pWork, &g_rtR0LnxWorkQueue); 75 77 #endif 78 79 IPRT_LINUX_RESTORE_EFL_AC(); 76 80 } 77 81 … … 85 89 DECLHIDDEN(void) rtR0LnxWorkqueueFlush(void) 86 90 { 91 IPRT_LINUX_SAVE_EFL_AC(); 92 87 93 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 5, 41) 88 94 flush_workqueue(g_prtR0LnxWorkQueue); … … 90 96 run_task_queue(&g_rtR0LnxWorkQueue); 91 97 #endif 98 99 IPRT_LINUX_RESTORE_EFL_AC(); 92 100 } 93 101 … … 95 103 DECLHIDDEN(int) rtR0InitNative(void) 96 104 { 105 int rc = VINF_SUCCESS; 106 IPRT_LINUX_SAVE_EFL_AC(); 107 97 108 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 5, 41) 98 109 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 13) … … 102 113 #endif 103 114 if (!g_prtR0LnxWorkQueue) 104 r eturnVERR_NO_MEMORY;115 rc = VERR_NO_MEMORY; 105 116 #endif 106 117 107 return VINF_SUCCESS; 118 IPRT_LINUX_RESTORE_EFL_AC(); 119 return rc; 108 120 } 109 121 … … 111 123 DECLHIDDEN(void) rtR0TermNative(void) 112 124 { 125 IPRT_LINUX_SAVE_EFL_AC(); 126 113 127 rtR0LnxWorkqueueFlush(); 114 128 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 5, 41) … … 118 132 119 133 rtR0MemExecCleanup(); 134 135 IPRT_LINUX_RESTORE_EFL_AC(); 120 136 } 121 137 -
trunk/src/VBox/Runtime/r0drv/linux/memobj-r0drv-linux.c
r56290 r57276 548 548 DECLHIDDEN(int) rtR0MemObjNativeFree(RTR0MEMOBJ pMem) 549 549 { 550 IPRT_LINUX_SAVE_EFL_AC(); 550 551 PRTR0MEMOBJLNX pMemLnx = (PRTR0MEMOBJLNX)pMem; 551 552 … … 626 627 return VERR_INTERNAL_ERROR; 627 628 } 629 IPRT_LINUX_RESTORE_EFL_ONLY_AC(); 628 630 return VINF_SUCCESS; 629 631 } … … 632 634 DECLHIDDEN(int) rtR0MemObjNativeAllocPage(PPRTR0MEMOBJINTERNAL ppMem, size_t cb, bool fExecutable) 633 635 { 636 IPRT_LINUX_SAVE_EFL_AC(); 634 637 PRTR0MEMOBJLNX pMemLnx; 635 638 int rc; … … 648 651 { 649 652 *ppMem = &pMemLnx->Core; 653 IPRT_LINUX_RESTORE_EFL_AC(); 650 654 return rc; 651 655 } … … 655 659 } 656 660 661 IPRT_LINUX_RESTORE_EFL_AC(); 657 662 return rc; 658 663 } … … 661 666 DECLHIDDEN(int) rtR0MemObjNativeAllocLow(PPRTR0MEMOBJINTERNAL ppMem, size_t cb, bool fExecutable) 662 667 { 668 IPRT_LINUX_SAVE_EFL_AC(); 663 669 PRTR0MEMOBJLNX pMemLnx; 664 670 int rc; … … 688 694 { 689 695 *ppMem = &pMemLnx->Core; 696 IPRT_LINUX_RESTORE_EFL_AC(); 690 697 return rc; 691 698 } … … 695 702 } 696 703 704 IPRT_LINUX_RESTORE_EFL_AC(); 697 705 return rc; 698 706 } … … 701 709 DECLHIDDEN(int) rtR0MemObjNativeAllocCont(PPRTR0MEMOBJINTERNAL ppMem, size_t cb, bool fExecutable) 702 710 { 711 IPRT_LINUX_SAVE_EFL_AC(); 703 712 PRTR0MEMOBJLNX pMemLnx; 704 713 int rc; … … 731 740 pMemLnx->Core.u.Cont.Phys = page_to_phys(pMemLnx->apPages[0]); 732 741 *ppMem = &pMemLnx->Core; 742 IPRT_LINUX_RESTORE_EFL_AC(); 733 743 return rc; 734 744 } … … 738 748 } 739 749 750 IPRT_LINUX_RESTORE_EFL_AC(); 740 751 return rc; 741 752 } … … 809 820 { 810 821 int rc; 822 IPRT_LINUX_SAVE_EFL_AC(); 811 823 812 824 /* … … 844 856 rc = rtR0MemObjLinuxAllocPhysSub2(ppMem, enmType, cb, uAlignment, PhysHighest, GFP_DMA); 845 857 } 858 IPRT_LINUX_RESTORE_EFL_AC(); 846 859 return rc; 847 860 } … … 954 967 DECLHIDDEN(int) rtR0MemObjNativeEnterPhys(PPRTR0MEMOBJINTERNAL ppMem, RTHCPHYS Phys, size_t cb, uint32_t uCachePolicy) 955 968 { 969 IPRT_LINUX_SAVE_EFL_AC(); 970 956 971 /* 957 972 * All we need to do here is to validate that we can use … … 964 979 pMemLnx = (PRTR0MEMOBJLNX)rtR0MemObjNew(sizeof(*pMemLnx), RTR0MEMOBJTYPE_PHYS, NULL, cb); 965 980 if (!pMemLnx) 981 { 982 IPRT_LINUX_RESTORE_EFL_AC(); 966 983 return VERR_NO_MEMORY; 984 } 967 985 968 986 pMemLnx->Core.u.Phys.PhysBase = PhysAddr; … … 971 989 Assert(!pMemLnx->cPages); 972 990 *ppMem = &pMemLnx->Core; 991 IPRT_LINUX_RESTORE_EFL_AC(); 973 992 return VINF_SUCCESS; 974 993 } … … 977 996 DECLHIDDEN(int) rtR0MemObjNativeLockUser(PPRTR0MEMOBJINTERNAL ppMem, RTR3PTR R3Ptr, size_t cb, uint32_t fAccess, RTR0PROCESS R0Process) 978 997 { 998 IPRT_LINUX_SAVE_EFL_AC(); 979 999 const int cPages = cb >> PAGE_SHIFT; 980 1000 struct task_struct *pTask = rtR0ProcessToLinuxTask(R0Process); … … 997 1017 pMemLnx = (PRTR0MEMOBJLNX)rtR0MemObjNew(RT_OFFSETOF(RTR0MEMOBJLNX, apPages[cPages]), RTR0MEMOBJTYPE_LOCK, (void *)R3Ptr, cb); 998 1018 if (!pMemLnx) 1019 { 1020 IPRT_LINUX_RESTORE_EFL_AC(); 999 1021 return VERR_NO_MEMORY; 1022 } 1000 1023 1001 1024 papVMAs = (struct vm_area_struct **)RTMemAlloc(sizeof(*papVMAs) * cPages); … … 1048 1071 *ppMem = &pMemLnx->Core; 1049 1072 1073 IPRT_LINUX_RESTORE_EFL_AC(); 1050 1074 return VINF_SUCCESS; 1051 1075 } … … 1068 1092 1069 1093 rtR0MemObjDelete(&pMemLnx->Core); 1094 IPRT_LINUX_RESTORE_EFL_AC(); 1070 1095 return rc; 1071 1096 } … … 1074 1099 DECLHIDDEN(int) rtR0MemObjNativeLockKernel(PPRTR0MEMOBJINTERNAL ppMem, void *pv, size_t cb, uint32_t fAccess) 1075 1100 { 1101 IPRT_LINUX_SAVE_EFL_AC(); 1076 1102 void *pvLast = (uint8_t *)pv + cb - 1; 1077 1103 size_t const cPages = cb >> PAGE_SHIFT; … … 1106 1132 pMemLnx = (PRTR0MEMOBJLNX)rtR0MemObjNew(RT_OFFSETOF(RTR0MEMOBJLNX, apPages[cPages]), RTR0MEMOBJTYPE_LOCK, pv, cb); 1107 1133 if (!pMemLnx) 1134 { 1135 IPRT_LINUX_RESTORE_EFL_AC(); 1108 1136 return VERR_NO_MEMORY; 1137 } 1109 1138 1110 1139 /* … … 1147 1176 *ppMem = &pMemLnx->Core; 1148 1177 1178 IPRT_LINUX_RESTORE_EFL_AC(); 1149 1179 return VINF_SUCCESS; 1150 1180 } 1151 1181 1152 1182 rtR0MemObjDelete(&pMemLnx->Core); 1183 IPRT_LINUX_RESTORE_EFL_AC(); 1153 1184 return rc; 1154 1185 } … … 1158 1189 { 1159 1190 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 4, 22) 1191 IPRT_LINUX_SAVE_EFL_AC(); 1160 1192 const size_t cPages = cb >> PAGE_SHIFT; 1161 1193 struct page *pDummyPage; … … 1172 1204 */ 1173 1205 pDummyPage = alloc_page(GFP_HIGHUSER | __GFP_NOWARN); 1174 if ( !pDummyPage)1175 return VERR_NO_MEMORY;1176 papPages = RTMemAlloc(sizeof(*papPages) * cPages);1177 if (papPages)1178 {1179 void *pv;1180 size_t iPage = cPages;1181 while (iPage-- > 0)1182 papPages[iPage] = pDummyPage;1206 if (pDummyPage) 1207 { 1208 papPages = RTMemAlloc(sizeof(*papPages) * cPages); 1209 if (papPages) 1210 { 1211 void *pv; 1212 size_t iPage = cPages; 1213 while (iPage-- > 0) 1214 papPages[iPage] = pDummyPage; 1183 1215 # ifdef VM_MAP 1184 pv = vmap(papPages, cPages, VM_MAP, PAGE_KERNEL_RO);1216 pv = vmap(papPages, cPages, VM_MAP, PAGE_KERNEL_RO); 1185 1217 # else 1186 pv = vmap(papPages, cPages, VM_ALLOC, PAGE_KERNEL_RO);1218 pv = vmap(papPages, cPages, VM_ALLOC, PAGE_KERNEL_RO); 1187 1219 # endif 1188 RTMemFree(papPages); 1189 if (pv) 1190 { 1191 PRTR0MEMOBJLNX pMemLnx = (PRTR0MEMOBJLNX)rtR0MemObjNew(sizeof(*pMemLnx), RTR0MEMOBJTYPE_RES_VIRT, pv, cb); 1192 if (pMemLnx) 1193 { 1194 pMemLnx->Core.u.ResVirt.R0Process = NIL_RTR0PROCESS; 1195 pMemLnx->cPages = 1; 1196 pMemLnx->apPages[0] = pDummyPage; 1197 *ppMem = &pMemLnx->Core; 1198 return VINF_SUCCESS; 1199 } 1200 vunmap(pv); 1201 } 1202 } 1203 __free_page(pDummyPage); 1220 RTMemFree(papPages); 1221 if (pv) 1222 { 1223 PRTR0MEMOBJLNX pMemLnx = (PRTR0MEMOBJLNX)rtR0MemObjNew(sizeof(*pMemLnx), RTR0MEMOBJTYPE_RES_VIRT, pv, cb); 1224 if (pMemLnx) 1225 { 1226 pMemLnx->Core.u.ResVirt.R0Process = NIL_RTR0PROCESS; 1227 pMemLnx->cPages = 1; 1228 pMemLnx->apPages[0] = pDummyPage; 1229 *ppMem = &pMemLnx->Core; 1230 IPRT_LINUX_RESTORE_EFL_AC(); 1231 return VINF_SUCCESS; 1232 } 1233 vunmap(pv); 1234 } 1235 } 1236 __free_page(pDummyPage); 1237 } 1238 IPRT_LINUX_RESTORE_EFL_AC(); 1204 1239 return VERR_NO_MEMORY; 1205 1240 … … 1216 1251 DECLHIDDEN(int) rtR0MemObjNativeReserveUser(PPRTR0MEMOBJINTERNAL ppMem, RTR3PTR R3PtrFixed, size_t cb, size_t uAlignment, RTR0PROCESS R0Process) 1217 1252 { 1253 IPRT_LINUX_SAVE_EFL_AC(); 1218 1254 PRTR0MEMOBJLNX pMemLnx; 1219 1255 void *pv; … … 1233 1269 pv = rtR0MemObjLinuxDoMmap(R3PtrFixed, cb, uAlignment, pTask, RTMEM_PROT_NONE); 1234 1270 if (pv == (void *)-1) 1271 { 1272 IPRT_LINUX_RESTORE_EFL_AC(); 1235 1273 return VERR_NO_MEMORY; 1274 } 1236 1275 1237 1276 pMemLnx = (PRTR0MEMOBJLNX)rtR0MemObjNew(sizeof(*pMemLnx), RTR0MEMOBJTYPE_RES_VIRT, pv, cb); … … 1239 1278 { 1240 1279 rtR0MemObjLinuxDoMunmap(pv, cb, pTask); 1280 IPRT_LINUX_RESTORE_EFL_AC(); 1241 1281 return VERR_NO_MEMORY; 1242 1282 } … … 1244 1284 pMemLnx->Core.u.ResVirt.R0Process = R0Process; 1245 1285 *ppMem = &pMemLnx->Core; 1286 IPRT_LINUX_RESTORE_EFL_AC(); 1246 1287 return VINF_SUCCESS; 1247 1288 } … … 1255 1296 PRTR0MEMOBJLNX pMemLnxToMap = (PRTR0MEMOBJLNX)pMemToMap; 1256 1297 PRTR0MEMOBJLNX pMemLnx; 1298 IPRT_LINUX_SAVE_EFL_AC(); 1257 1299 1258 1300 /* Fail if requested to do something we can't. */ … … 1326 1368 pMemLnx->Core.u.Mapping.R0Process = NIL_RTR0PROCESS; 1327 1369 *ppMem = &pMemLnx->Core; 1370 IPRT_LINUX_RESTORE_EFL_AC(); 1328 1371 return VINF_SUCCESS; 1329 1372 } … … 1331 1374 } 1332 1375 1376 IPRT_LINUX_RESTORE_EFL_AC(); 1333 1377 return rc; 1334 1378 } … … 1395 1439 RTHCPHYS DummyPhys; 1396 1440 #endif 1441 IPRT_LINUX_SAVE_EFL_AC(); 1397 1442 1398 1443 /* … … 1410 1455 pDummyPage = alloc_page(GFP_USER | __GFP_NOWARN); 1411 1456 if (!pDummyPage) 1457 { 1458 IPRT_LINUX_RESTORE_EFL_AC(); 1412 1459 return VERR_NO_MEMORY; 1460 } 1413 1461 SetPageReserved(pDummyPage); 1414 1462 DummyPhys = page_to_phys(pDummyPage); … … 1564 1612 pMemLnx->Core.u.Mapping.R0Process = R0Process; 1565 1613 *ppMem = &pMemLnx->Core; 1614 IPRT_LINUX_RESTORE_EFL_AC(); 1566 1615 return VINF_SUCCESS; 1567 1616 } … … 1578 1627 #endif 1579 1628 1629 IPRT_LINUX_RESTORE_EFL_AC(); 1580 1630 return rc; 1581 1631 } -
trunk/src/VBox/Runtime/r0drv/linux/memuserkernel-r0drv-linux.c
r56290 r57276 38 38 RTR0DECL(int) RTR0MemUserCopyFrom(void *pvDst, RTR3PTR R3PtrSrc, size_t cb) 39 39 { 40 IPRT_LINUX_SAVE_EFL_AC(); 40 41 if (RT_LIKELY(copy_from_user(pvDst, (void *)R3PtrSrc, cb) == 0)) 42 { 43 IPRT_LINUX_RESTORE_EFL_AC(); 41 44 return VINF_SUCCESS; 45 } 46 IPRT_LINUX_RESTORE_EFL_AC(); 42 47 return VERR_ACCESS_DENIED; 43 48 } … … 47 52 RTR0DECL(int) RTR0MemUserCopyTo(RTR3PTR R3PtrDst, void const *pvSrc, size_t cb) 48 53 { 54 IPRT_LINUX_SAVE_EFL_AC(); 49 55 if (RT_LIKELY(copy_to_user((void *)R3PtrDst, pvSrc, cb) == 0)) 56 { 57 IPRT_LINUX_RESTORE_EFL_AC(); 50 58 return VINF_SUCCESS; 59 } 60 IPRT_LINUX_RESTORE_EFL_AC(); 51 61 return VERR_ACCESS_DENIED; 52 62 } … … 56 66 RTR0DECL(bool) RTR0MemUserIsValidAddr(RTR3PTR R3Ptr) 57 67 { 58 return access_ok(VERIFY_READ, (void *)R3Ptr, 1); 68 IPRT_LINUX_SAVE_EFL_AC(); 69 bool fRc = access_ok(VERIFY_READ, (void *)R3Ptr, 1); 70 IPRT_LINUX_RESTORE_EFL_AC(); 71 return fRc; 59 72 } 60 73 RT_EXPORT_SYMBOL(RTR0MemUserIsValidAddr); … … 114 127 # endif /* !_ASM_EXTABLE */ 115 128 int rc; 129 IPRT_LINUX_SAVE_EFL_AC(); /* paranoia */ 116 130 if (!cb) 117 131 return VINF_SUCCESS; … … 136 150 "3" (cb) 137 151 : "memory"); 152 IPRT_LINUX_RESTORE_EFL_AC(); 138 153 return rc; 139 154 #else -
trunk/src/VBox/Runtime/r0drv/linux/mp-r0drv-linux.c
r56290 r57276 249 249 RTDECL(int) RTMpOnAll(PFNRTMPWORKER pfnWorker, void *pvUser1, void *pvUser2) 250 250 { 251 IPRT_LINUX_SAVE_EFL_AC(); 251 252 int rc; 252 253 RTMPARGS Args; … … 301 302 302 303 RTThreadPreemptRestore(&PreemptState); 304 IPRT_LINUX_RESTORE_EFL_AC(); 303 305 return VINF_SUCCESS; 304 306 } … … 308 310 RTDECL(int) RTMpOnOthers(PFNRTMPWORKER pfnWorker, void *pvUser1, void *pvUser2) 309 311 { 312 IPRT_LINUX_SAVE_EFL_AC(); 310 313 int rc; 311 314 RTMPARGS Args; … … 327 330 328 331 Assert(rc == 0); NOREF(rc); 332 IPRT_LINUX_RESTORE_EFL_AC(); 329 333 return VINF_SUCCESS; 330 334 } … … 356 360 RTDECL(int) RTMpOnPair(RTCPUID idCpu1, RTCPUID idCpu2, uint32_t fFlags, PFNRTMPWORKER pfnWorker, void *pvUser1, void *pvUser2) 357 361 { 362 IPRT_LINUX_SAVE_EFL_AC(); 358 363 int rc; 359 364 RTTHREADPREEMPTSTATE PreemptState = RTTHREADPREEMPTSTATE_INITIALIZER; … … 443 448 rc = VERR_CPU_NOT_FOUND; 444 449 RTThreadPreemptRestore(&PreemptState);; 450 IPRT_LINUX_RESTORE_EFL_AC(); 445 451 return rc; 446 452 } … … 478 484 RTDECL(int) RTMpOnSpecific(RTCPUID idCpu, PFNRTMPWORKER pfnWorker, void *pvUser1, void *pvUser2) 479 485 { 486 IPRT_LINUX_SAVE_EFL_AC(); 480 487 int rc; 481 488 RTMPARGS Args; … … 517 524 518 525 NOREF(rc); 526 IPRT_LINUX_RESTORE_EFL_AC(); 519 527 return rc; 520 528 } … … 539 547 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 19) 540 548 int rc; 549 IPRT_LINUX_SAVE_EFL_AC(); 541 550 542 551 if (!RTMpIsCpuPossible(idCpu)) … … 554 563 NOREF(rc); 555 564 Assert(rc == 0); 565 IPRT_LINUX_RESTORE_EFL_AC(); 556 566 return VINF_SUCCESS; 557 567 -
trunk/src/VBox/Runtime/r0drv/linux/mpnotification-r0drv-linux.c
r54808 r57276 174 174 { 175 175 int rc; 176 IPRT_LINUX_SAVE_EFL_AC(); 176 177 177 178 # ifdef CPU_DOWN_FAILED … … 180 181 181 182 rc = register_cpu_notifier(&g_NotifierBlock); 183 IPRT_LINUX_RESTORE_EFL_AC(); 182 184 AssertMsgReturn(!rc, ("%d\n", rc), RTErrConvertFromErrno(rc)); 183 185 return VINF_SUCCESS; … … 187 189 DECLHIDDEN(void) rtR0MpNotificationNativeTerm(void) 188 190 { 191 IPRT_LINUX_SAVE_EFL_AC(); 189 192 unregister_cpu_notifier(&g_NotifierBlock); 193 IPRT_LINUX_RESTORE_EFL_AC(); 190 194 } 191 195 -
trunk/src/VBox/Runtime/r0drv/linux/semevent-r0drv-linux.c
r56290 r57276 73 73 { 74 74 PRTSEMEVENTINTERNAL pThis; 75 IPRT_LINUX_SAVE_EFL_AC(); 75 76 76 77 AssertReturn(!(fFlags & ~(RTSEMEVENT_FLAGS_NO_LOCK_VAL | RTSEMEVENT_FLAGS_BOOTSTRAP_HACK)), VERR_INVALID_PARAMETER); … … 87 88 88 89 *phEventSem = pThis; 90 IPRT_LINUX_RESTORE_EFL_AC(); 89 91 return VINF_SUCCESS; 90 92 } … … 118 120 RTDECL(int) RTSemEventDestroy(RTSEMEVENT hEventSem) 119 121 { 122 IPRT_LINUX_SAVE_EFL_AC(); 123 120 124 /* 121 125 * Validate input. … … 135 139 wake_up_all(&pThis->Head); 136 140 rtR0SemEventLnxRelease(pThis); 141 142 IPRT_LINUX_RESTORE_EFL_AC(); 137 143 return VINF_SUCCESS; 138 144 } … … 142 148 RTDECL(int) RTSemEventSignal(RTSEMEVENT hEventSem) 143 149 { 150 IPRT_LINUX_SAVE_EFL_AC(); 151 144 152 /* 145 153 * Validate input. … … 157 165 158 166 rtR0SemEventLnxRelease(pThis); 167 IPRT_LINUX_RESTORE_EFL_AC(); 159 168 return VINF_SUCCESS; 160 169 } … … 195 204 * We have to wait. 196 205 */ 206 IPRT_LINUX_SAVE_EFL_AC(); 197 207 RTR0SEMLNXWAIT Wait; 198 208 rc = rtR0SemLnxWaitInit(&Wait, fFlags, uTimeout, &pThis->Head); … … 231 241 IPRT_DEBUG_SEMS_STATE_RC(pThis, 'E', rc); 232 242 } 243 IPRT_LINUX_RESTORE_EFL_AC(); 233 244 } 234 245 -
trunk/src/VBox/Runtime/r0drv/linux/semeventmulti-r0drv-linux.c
r56290 r57276 96 96 { 97 97 PRTSEMEVENTMULTIINTERNAL pThis; 98 IPRT_LINUX_SAVE_EFL_AC(); 98 99 99 100 AssertReturn(!(fFlags & ~RTSEMEVENTMULTI_FLAGS_NO_LOCK_VAL), VERR_INVALID_PARAMETER); … … 107 108 108 109 *phEventMultiSem = pThis; 110 IPRT_LINUX_RESTORE_EFL_AC(); 109 111 return VINF_SUCCESS; 110 112 } 113 IPRT_LINUX_RESTORE_EFL_AC(); 111 114 return VERR_NO_MEMORY; 112 115 } … … 144 147 RTDECL(int) RTSemEventMultiDestroy(RTSEMEVENTMULTI hEventMultiSem) 145 148 { 149 IPRT_LINUX_SAVE_EFL_AC(); 150 146 151 /* 147 152 * Validate input. … … 162 167 wake_up_all(&pThis->Head); 163 168 rtR0SemEventMultiLnxRelease(pThis); 169 170 IPRT_LINUX_RESTORE_EFL_AC(); 164 171 return VINF_SUCCESS; 165 172 } … … 169 176 RTDECL(int) RTSemEventMultiSignal(RTSEMEVENTMULTI hEventMultiSem) 170 177 { 178 IPRT_LINUX_SAVE_EFL_AC(); 171 179 uint32_t fNew; 172 180 uint32_t fOld; … … 198 206 199 207 rtR0SemEventMultiLnxRelease(pThis); 208 IPRT_LINUX_RESTORE_EFL_AC(); 200 209 return VINF_SUCCESS; 201 210 } … … 261 270 */ 262 271 RTR0SEMLNXWAIT Wait; 272 IPRT_LINUX_SAVE_EFL_AC(); 263 273 rc = rtR0SemLnxWaitInit(&Wait, fFlags, uTimeout, &pThis->Head); 264 274 if (RT_SUCCESS(rc)) … … 296 306 IPRT_DEBUG_SEMS_STATE_RC(pThis, 'E', rc); 297 307 } 308 IPRT_LINUX_RESTORE_EFL_AC(); 298 309 } 299 310 -
trunk/src/VBox/Runtime/r0drv/linux/semfastmutex-r0drv-linux.c
r56290 r57276 64 64 RTDECL(int) RTSemFastMutexCreate(PRTSEMFASTMUTEX phFastMtx) 65 65 { 66 IPRT_LINUX_SAVE_EFL_AC(); 67 66 68 /* 67 69 * Allocate. … … 82 84 83 85 *phFastMtx = pThis; 86 IPRT_LINUX_RESTORE_EFL_AC(); 84 87 return VINF_SUCCESS; 85 88 } … … 107 110 RTDECL(int) RTSemFastMutexRequest(RTSEMFASTMUTEX hFastMtx) 108 111 { 112 IPRT_LINUX_SAVE_EFL_AC(); 113 109 114 /* 110 115 * Validate. … … 121 126 ASMAtomicUoWriteSize(&pThis->Owner, RTThreadNativeSelf()); 122 127 #endif 128 129 IPRT_LINUX_RESTORE_EFL_ONLY_AC(); 123 130 return VINF_SUCCESS; 124 131 } … … 128 135 RTDECL(int) RTSemFastMutexRelease(RTSEMFASTMUTEX hFastMtx) 129 136 { 137 IPRT_LINUX_SAVE_EFL_AC(); 138 130 139 /* 131 140 * Validate. … … 141 150 up(&pThis->Semaphore); 142 151 IPRT_DEBUG_SEMS_STATE(pThis, 'u'); 152 153 IPRT_LINUX_RESTORE_EFL_ONLY_AC(); 143 154 return VINF_SUCCESS; 144 155 } -
trunk/src/VBox/Runtime/r0drv/linux/semmutex-r0drv-linux.c
r56290 r57276 87 87 RTDECL(int) RTSemMutexCreate(PRTSEMMUTEX phMtx) 88 88 { 89 IPRT_LINUX_SAVE_EFL_AC(); 90 89 91 /* 90 92 * Allocate. … … 116 118 PRTSEMMUTEXLNXWAITER pCur; 117 119 unsigned long fSavedIrq; 120 IPRT_LINUX_SAVE_EFL_AC(); 118 121 119 122 /* … … 251 254 unsigned long fSavedIrq; 252 255 int rc; 256 IPRT_LINUX_SAVE_EFL_AC(); 253 257 254 258 /* … … 290 294 */ 291 295 else 292 return rtSemMutexLinuxRequestSleep(pThis, cMillies, fInterruptible, fSavedIrq); 296 { 297 rc = rtSemMutexLinuxRequestSleep(pThis, cMillies, fInterruptible, fSavedIrq); 298 IPRT_LINUX_RESTORE_EFL_ONLY_AC(); 299 return rc; 300 } 293 301 294 302 IPRT_DEBUG_SEMS_STATE_RC(pThis, 'M', rc); 295 303 spin_unlock_irqrestore(&pThis->Spinlock, fSavedIrq); 304 IPRT_LINUX_RESTORE_EFL_ONLY_AC(); 296 305 return rc; 297 306 } … … 332 341 unsigned long fSavedIrq; 333 342 int rc; 343 IPRT_LINUX_SAVE_EFL_AC(); 334 344 335 345 /* … … 367 377 368 378 AssertRC(rc); 379 IPRT_LINUX_RESTORE_EFL_AC(); 369 380 return rc; 370 381 } … … 377 388 unsigned long fSavedIrq; 378 389 bool fOwned; 390 IPRT_LINUX_SAVE_EFL_AC(); 379 391 380 392 /* … … 392 404 spin_unlock_irqrestore(&pThis->Spinlock, fSavedIrq); 393 405 406 IPRT_LINUX_RESTORE_EFL_AC(); 394 407 return fOwned; 395 408 -
trunk/src/VBox/Runtime/r0drv/linux/spinlock-r0drv-linux.c
r56290 r57276 74 74 RTDECL(int) RTSpinlockCreate(PRTSPINLOCK pSpinlock, uint32_t fFlags, const char *pszName) 75 75 { 76 IPRT_LINUX_SAVE_EFL_AC(); 76 77 PRTSPINLOCKINTERNAL pThis; 77 78 AssertReturn(fFlags == RTSPINLOCK_FLAGS_INTERRUPT_SAFE || fFlags == RTSPINLOCK_FLAGS_INTERRUPT_UNSAFE, VERR_INVALID_PARAMETER); … … 98 99 99 100 *pSpinlock = pThis; 101 IPRT_LINUX_RESTORE_EFL_AC(); 100 102 return VINF_SUCCESS; 101 103 } … … 141 143 } 142 144 else 145 { 146 IPRT_LINUX_SAVE_EFL_AC(); 143 147 spin_lock(&pThis->Spinlock); 148 IPRT_LINUX_RESTORE_EFL_ONLY_AC(); 149 } 144 150 #ifdef CONFIG_PROVE_LOCKING 145 151 lockdep_on(); … … 169 175 } 170 176 else 177 { 178 IPRT_LINUX_SAVE_EFL_AC(); 171 179 spin_unlock(&pThis->Spinlock); 180 IPRT_LINUX_RESTORE_EFL_ONLY_AC(); 181 } 172 182 #ifdef CONFIG_PROVE_LOCKING 173 183 lockdep_on(); -
trunk/src/VBox/Runtime/r0drv/linux/the-linux-kernel.h
r56290 r57276 386 386 # include <iprt/asm-amd64-x86.h> 387 387 # define IPRT_X86_EFL_AC RT_BIT(18) 388 # define IPRT_LINUX_SAVE_EFL_AC() RTCCUINTREG fSavedEfl = ASMGetFlags() ;388 # define IPRT_LINUX_SAVE_EFL_AC() RTCCUINTREG fSavedEfl = ASMGetFlags() 389 389 # define IPRT_LINUX_RESTORE_EFL_AC() ASMSetFlags(fSavedEfl) 390 390 # define IPRT_LINUX_RESTORE_EFL_ONLY_AC() ASMSetFlags((ASMGetFlags() & ~IPRT_X86_EFL_AC) | (fSavedEfl & IPRT_X86_EFL_AC)) -
trunk/src/VBox/Runtime/r0drv/linux/thread-r0drv-linux.c
r55861 r57276 60 60 static int rtR0ThreadLnxSleepCommon(RTMSINTERVAL cMillies) 61 61 { 62 IPRT_LINUX_SAVE_EFL_AC(); 62 63 long cJiffies = msecs_to_jiffies(cMillies); 63 64 set_current_state(TASK_INTERRUPTIBLE); 64 65 cJiffies = schedule_timeout(cJiffies); 66 IPRT_LINUX_RESTORE_EFL_AC(); 65 67 if (!cJiffies) 66 68 return VINF_SUCCESS; … … 85 87 RTDECL(bool) RTThreadYield(void) 86 88 { 89 IPRT_LINUX_SAVE_EFL_AC(); 87 90 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 4, 20) 88 91 yield(); … … 93 96 schedule(); 94 97 #endif 98 IPRT_LINUX_RESTORE_EFL_AC(); 95 99 return true; 96 100 } -
trunk/src/VBox/Runtime/r0drv/linux/thread2-r0drv-linux.c
r56290 r57276 138 138 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 4) 139 139 struct task_struct *NativeThread; 140 IPRT_LINUX_SAVE_EFL_AC(); 140 141 141 142 RT_ASSERT_PREEMPTIBLE(); … … 143 144 NativeThread = kthread_run(rtThreadNativeMain, pThreadInt, "iprt-%s", pThreadInt->szName); 144 145 145 if (IS_ERR(NativeThread)) 146 return VERR_GENERAL_FAILURE; 147 148 *pNativeThread = (RTNATIVETHREAD)NativeThread; 149 return VINF_SUCCESS; 146 if (!IS_ERR(NativeThread)) 147 { 148 *pNativeThread = (RTNATIVETHREAD)NativeThread; 149 IPRT_LINUX_RESTORE_EFL_AC(); 150 return VINF_SUCCESS; 151 } 152 IPRT_LINUX_RESTORE_EFL_AC(); 153 return VERR_GENERAL_FAILURE; 150 154 #else 151 155 return VERR_NOT_IMPLEMENTED; -
trunk/src/VBox/Runtime/r0drv/linux/threadctxhooks-r0drv-linux.c
r56955 r57276 167 167 RTDECL(int) RTThreadCtxHookCreate(PRTTHREADCTXHOOK phCtxHook, uint32_t fFlags, PFNRTTHREADCTXHOOK pfnCallback, void *pvUser) 168 168 { 169 IPRT_LINUX_SAVE_EFL_AC(); 170 169 171 /* 170 172 * Validate input. … … 181 183 pThis = (PRTTHREADCTXHOOKINT)RTMemAllocZ(sizeof(*pThis)); 182 184 if (RT_UNLIKELY(!pThis)) 185 { 186 IPRT_LINUX_RESTORE_EFL_AC(); 183 187 return VERR_NO_MEMORY; 188 } 184 189 pThis->u32Magic = RTTHREADCTXHOOKINT_MAGIC; 185 190 pThis->hOwner = RTThreadNativeSelf(); … … 196 201 197 202 *phCtxHook = pThis; 203 IPRT_LINUX_RESTORE_EFL_AC(); 198 204 return VINF_SUCCESS; 199 205 } … … 203 209 RTDECL(int ) RTThreadCtxHookDestroy(RTTHREADCTXHOOK hCtxHook) 204 210 { 211 IPRT_LINUX_SAVE_EFL_AC(); 212 205 213 /* 206 214 * Validate input. … … 232 240 RTMemFree(pThis); 233 241 242 IPRT_LINUX_RESTORE_EFL_AC(); 234 243 return VINF_SUCCESS; 235 244 } … … 250 259 if (!pThis->fEnabled) 251 260 { 261 IPRT_LINUX_SAVE_EFL_AC(); 252 262 Assert(pThis->PreemptOps.sched_out == rtThreadCtxHooksLnxSchedOut); 253 263 Assert(pThis->PreemptOps.sched_in == rtThreadCtxHooksLnxSchedIn); … … 260 270 preempt_notifier_register(&pThis->LnxPreemptNotifier); 261 271 preempt_enable(); 272 273 IPRT_LINUX_RESTORE_EFL_AC(); 262 274 } 263 275 … … 284 296 */ 285 297 if (pThis->fEnabled) 298 { 299 IPRT_LINUX_SAVE_EFL_AC(); 286 300 rtThreadCtxHookDisable(pThis); 301 IPRT_LINUX_RESTORE_EFL_AC(); 302 } 287 303 } 288 304 return VINF_SUCCESS; -
trunk/src/VBox/Runtime/r0drv/linux/time-r0drv-linux.c
r56290 r57276 170 170 RTDECL(PRTTIMESPEC) RTTimeNow(PRTTIMESPEC pTime) 171 171 { 172 IPRT_LINUX_SAVE_EFL_AC(); 172 173 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 16) 173 174 struct timespec Ts; 174 175 ktime_get_real_ts(&Ts); 176 IPRT_LINUX_RESTORE_EFL_AC(); 175 177 return RTTimeSpecSetTimespec(pTime, &Ts); 176 178 … … 178 180 struct timeval Tv; 179 181 do_gettimeofday(&Tv); 182 IPRT_LINUX_RESTORE_EFL_AC(); 180 183 return RTTimeSpecSetTimeval(pTime, &Tv); 181 184 #endif -
trunk/src/VBox/Runtime/r0drv/linux/timer-r0drv-linux.c
r56290 r57276 1186 1186 RTTIMERLINUXSTARTONCPUARGS Args; 1187 1187 int rc2; 1188 IPRT_LINUX_SAVE_EFL_AC(); 1188 1189 1189 1190 /* … … 1203 1204 */ 1204 1205 if (pTimer->fAllCpus) 1205 return rtTimerLnxOmniStart(pTimer, &Args); 1206 { 1207 rc2 = rtTimerLnxOmniStart(pTimer, &Args); 1208 IPRT_LINUX_RESTORE_EFL_AC(); 1209 return rc2; 1210 } 1206 1211 #endif 1207 1212 … … 1234 1239 } 1235 1240 } 1241 IPRT_LINUX_RESTORE_EFL_AC(); 1236 1242 return VINF_SUCCESS; 1237 1243 } … … 1243 1249 { 1244 1250 ASMAtomicWriteBool(&pTimer->fSuspended, false); 1251 IPRT_LINUX_RESTORE_EFL_AC(); 1245 1252 return VINF_SUCCESS; 1246 1253 } … … 1249 1256 default: 1250 1257 AssertMsgFailed(("%d\n", enmState)); 1258 IPRT_LINUX_RESTORE_EFL_AC(); 1251 1259 return VERR_INTERNAL_ERROR_4; 1252 1260 } … … 1329 1337 * Validate. 1330 1338 */ 1339 IPRT_LINUX_SAVE_EFL_AC(); 1331 1340 AssertPtrReturn(pTimer, VERR_INVALID_HANDLE); 1332 1341 AssertReturn(pTimer->u32Magic == RTTIMER_MAGIC, VERR_INVALID_HANDLE); … … 1337 1346 1338 1347 rtTimerLnxStop(pTimer, false /*fForDestroy*/); 1348 1349 IPRT_LINUX_RESTORE_EFL_AC(); 1339 1350 return VINF_SUCCESS; 1340 1351 } … … 1346 1357 unsigned long cJiffies; 1347 1358 unsigned long flFlags; 1359 IPRT_LINUX_SAVE_EFL_AC(); 1348 1360 1349 1361 /* … … 1365 1377 { 1366 1378 ASMAtomicWriteU64(&pTimer->u64NanoInterval, u64NanoInterval); 1379 IPRT_LINUX_RESTORE_EFL_AC(); 1367 1380 return VINF_SUCCESS; 1368 1381 } … … 1385 1398 ASMAtomicWriteU64(&pTimer->u64NanoInterval, u64NanoInterval); 1386 1399 spin_unlock_irqrestore(&pTimer->ChgIntLock, flFlags); 1400 IPRT_LINUX_RESTORE_EFL_AC(); 1387 1401 return VINF_SUCCESS; 1388 1402 } … … 1393 1407 { 1394 1408 bool fCanDestroy; 1409 IPRT_LINUX_SAVE_EFL_AC(); 1395 1410 1396 1411 /* … … 1460 1475 } 1461 1476 1477 IPRT_LINUX_RESTORE_EFL_AC(); 1462 1478 return VINF_SUCCESS; 1463 1479 } … … 1471 1487 unsigned cCpus; 1472 1488 int rc; 1489 IPRT_LINUX_SAVE_EFL_AC(); 1473 1490 1474 1491 rtR0LnxWorkqueueFlush(); /* for 2.4 */ … … 1479 1496 */ 1480 1497 if (!RTTIMER_FLAGS_ARE_VALID(fFlags)) 1498 { 1499 IPRT_LINUX_RESTORE_EFL_AC(); 1481 1500 return VERR_INVALID_PARAMETER; 1501 } 1482 1502 if ( (fFlags & RTTIMER_FLAGS_CPU_SPECIFIC) 1483 1503 && (fFlags & RTTIMER_FLAGS_CPU_ALL) != RTTIMER_FLAGS_CPU_ALL 1484 1504 && !RTMpIsCpuPossible(RTMpCpuIdFromSetIndex(fFlags & RTTIMER_FLAGS_CPU_MASK))) 1505 { 1506 IPRT_LINUX_RESTORE_EFL_AC(); 1485 1507 return VERR_CPU_NOT_FOUND; 1508 } 1486 1509 1487 1510 /* … … 1494 1517 cCpus = RTMpGetMaxCpuId() + 1; 1495 1518 Assert(cCpus <= RTCPUSET_MAX_CPUS); /* On linux we have a 1:1 relationship between cpuid and set index. */ 1496 AssertReturn (u64NanoInterval, VERR_NOT_IMPLEMENTED); /* We don't implement single shot on all cpus, sorry. */1519 AssertReturnStmt(u64NanoInterval, IPRT_LINUX_RESTORE_EFL_AC(), VERR_NOT_IMPLEMENTED); /* We don't implement single shot on all cpus, sorry. */ 1497 1520 } 1498 1521 #endif … … 1501 1524 RTMEMALLOCEX_FLAGS_ZEROED | RTMEMALLOCEX_FLAGS_ANY_CTX_FREE, (void **)&pTimer); 1502 1525 if (RT_FAILURE(rc)) 1526 { 1527 IPRT_LINUX_RESTORE_EFL_AC(); 1503 1528 return rc; 1529 } 1504 1530 1505 1531 /* … … 1568 1594 { 1569 1595 RTTimerDestroy(pTimer); 1596 IPRT_LINUX_RESTORE_EFL_AC(); 1570 1597 return rc; 1571 1598 } … … 1575 1602 RTTIMERLNX_LOG(("create %p hires=%d fFlags=%#x cCpus=%u\n", pTimer, pTimer->fHighRes, fFlags, cCpus)); 1576 1603 *ppTimer = pTimer; 1604 IPRT_LINUX_RESTORE_EFL_AC(); 1577 1605 return VINF_SUCCESS; 1578 1606 } … … 1585 1613 * querying the resolution of the high res timers? */ 1586 1614 struct timespec Ts; 1587 int rc = hrtimer_get_res(CLOCK_MONOTONIC, &Ts); 1615 int rc; 1616 IPRT_LINUX_SAVE_EFL_AC(); 1617 rc = hrtimer_get_res(CLOCK_MONOTONIC, &Ts); 1618 IPRT_LINUX_RESTORE_EFL_AC(); 1588 1619 if (!rc) 1589 1620 {
Note:
See TracChangeset
for help on using the changeset viewer.