Changeset 85698 in vbox for trunk/src/VBox/Runtime/r0drv
- Timestamp:
- Aug 11, 2020 5:05:29 PM (4 years ago)
- Location:
- trunk/src/VBox/Runtime/r0drv/linux
- Files:
-
- 14 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Runtime/r0drv/linux/alloc-r0drv-linux.c
r85505 r85698 39 39 40 40 #if (defined(RT_ARCH_AMD64) || defined(DOXYGEN_RUNNING)) && !defined(RTMEMALLOC_EXEC_HEAP) 41 # if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 23) && LINUX_VERSION_CODE < KERNEL_VERSION(5, 8,0)41 # if RTLNX_VER_MIN(2,6,23) && RTLNX_VER_MAX(5,8,0) 42 42 /** 43 43 * Starting with 2.6.23 we can use __get_vm_area and map_vm_area to allocate … … 197 197 * in the free function, if nothing else... 198 198 */ 199 # if LINUX_VERSION_CODE < KERNEL_VERSION(3, 17,0)199 # if RTLNX_VER_MAX(3,17,0) 200 200 struct page **papPagesIterator = papPages; 201 201 # endif … … 203 203 pVmArea->pages = papPages; 204 204 if (!map_vm_area(pVmArea, PAGE_KERNEL_EXEC, 205 # if LINUX_VERSION_CODE < KERNEL_VERSION(3, 17,0)205 # if RTLNX_VER_MAX(3,17,0) 206 206 &papPagesIterator 207 207 # else … … 216 216 } 217 217 /* bail out */ 218 # if LINUX_VERSION_CODE < KERNEL_VERSION(3, 17,0)218 # if RTLNX_VER_MAX(3,17,0) 219 219 pVmArea->nr_pages = papPagesIterator - papPages; 220 220 # endif -
trunk/src/VBox/Runtime/r0drv/linux/initterm-r0drv-linux.c
r82968 r85698 40 40 *********************************************************************************************************************************/ 41 41 /** The IPRT work queue. */ 42 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 5,41)42 #if RTLNX_VER_MIN(2,5,41) 43 43 static struct workqueue_struct *g_prtR0LnxWorkQueue; 44 44 #else … … 58 58 IPRT_LINUX_SAVE_EFL_AC(); 59 59 60 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 5,41)61 # if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6,20)60 #if RTLNX_VER_MIN(2,5,41) 61 # if RTLNX_VER_MIN(2,6,20) 62 62 INIT_WORK(pWork, pfnWorker); 63 63 # else … … 84 84 IPRT_LINUX_SAVE_EFL_AC(); 85 85 86 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 5,41)86 #if RTLNX_VER_MIN(2,5,41) 87 87 flush_workqueue(g_prtR0LnxWorkQueue); 88 88 #else … … 99 99 IPRT_LINUX_SAVE_EFL_AC(); 100 100 101 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 5,41)102 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6,13)101 #if RTLNX_VER_MIN(2,5,41) 102 #if RTLNX_VER_MIN(2,6,13) 103 103 g_prtR0LnxWorkQueue = create_workqueue("iprt-VBoxWQueue"); 104 104 #else … … 119 119 120 120 rtR0LnxWorkqueueFlush(); 121 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 5,41)121 #if RTLNX_VER_MIN(2,5,41) 122 122 destroy_workqueue(g_prtR0LnxWorkQueue); 123 123 g_prtR0LnxWorkQueue = NULL; -
trunk/src/VBox/Runtime/r0drv/linux/memobj-r0drv-linux.c
r85516 r85698 57 57 * This is a must for 5.8+, but we enable it all the way back to 3.2.x for 58 58 * better W^R compliance (fExecutable flag). */ 59 #if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 2,0) || defined(DOXYGEN_RUNNING)59 #if RTLNX_VER_MIN(3,2,0) || defined(DOXYGEN_RUNNING) 60 60 # define IPRT_USE_ALLOC_VM_AREA_FOR_EXEC 61 61 #endif … … 66 66 * It should be safe to use vm_insert_page() older kernels as well. 67 67 */ 68 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6,23)68 #if RTLNX_VER_MIN(2,6,23) 69 69 # define VBOX_USE_INSERT_PAGE 70 70 #endif 71 71 #if defined(CONFIG_X86_PAE) \ 72 72 && ( defined(HAVE_26_STYLE_REMAP_PAGE_RANGE) \ 73 || ( LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 0) \ 74 && LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 11))) 73 || RTLNX_VER_RANGE(2,6,0, 2,6,11) ) 75 74 # define VBOX_USE_PAE_HACK 76 75 #endif 77 76 78 77 /* gfp_t was introduced in 2.6.14, define it for earlier. */ 79 #if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6,14)78 #if RTLNX_VER_MAX(2,6,14) 80 79 # define gfp_t unsigned 81 80 #endif … … 84 83 * Wrappers around mmap_lock/mmap_sem difference. 85 84 */ 86 #if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 8,0)85 #if RTLNX_VER_MIN(5,8,0) 87 86 # define LNX_MM_DOWN_READ(a_pMm) down_read(&(a_pMm)->mmap_lock) 88 87 # define LNX_MM_UP_READ(a_pMm) up_read(&(a_pMm)->mmap_lock) … … 252 251 if (R3PtrFixed != (RTR3PTR)-1) 253 252 { 254 #if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 5,0)253 #if RTLNX_VER_MIN(3,5,0) 255 254 ulAddr = vm_mmap(NULL, R3PtrFixed, cb, fLnxProt, MAP_SHARED | MAP_ANONYMOUS | MAP_FIXED, 0); 256 255 #else … … 262 261 else 263 262 { 264 #if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 5,0)263 #if RTLNX_VER_MIN(3,5,0) 265 264 ulAddr = vm_mmap(NULL, 0, cb, fLnxProt, MAP_SHARED | MAP_ANONYMOUS, 0); 266 265 #else … … 298 297 static void rtR0MemObjLinuxDoMunmap(void *pv, size_t cb, struct task_struct *pTask) 299 298 { 300 #if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 5,0)299 #if RTLNX_VER_MIN(3,5,0) 301 300 Assert(pTask == current); RT_NOREF_PV(pTask); 302 301 vm_munmap((unsigned long)pv, cb); … … 359 358 * For small allocations we'll try contiguous first and then fall back on page by page. 360 359 */ 361 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 4,22)360 #if RTLNX_VER_MIN(2,4,22) 362 361 if ( fContiguous 363 362 || cb <= PAGE_SIZE * 2) … … 418 417 pMemLnx->fExecutable = fExecutable; 419 418 420 #if LINUX_VERSION_CODE < KERNEL_VERSION(4, 5,0)419 #if RTLNX_VER_MAX(4,5,0) 421 420 /* 422 421 * Reserve the pages. … … 475 474 while (iPage-- > 0) 476 475 { 477 #if LINUX_VERSION_CODE < KERNEL_VERSION(4, 5,0)476 #if RTLNX_VER_MAX(4,5,0) 478 477 /* See SetPageReserved() in rtR0MemObjLinuxAllocPages() */ 479 478 ClearPageReserved(pMemLnx->apPages[iPage]); 480 479 #endif 481 #if LINUX_VERSION_CODE < KERNEL_VERSION(2, 4,22)480 #if RTLNX_VER_MAX(2,4,22) 482 481 if (pMemLnx->fExecutable) 483 482 MY_SET_PAGES_NOEXEC(pMemLnx->apPages[iPage], 1); … … 488 487 * Free the pages. 489 488 */ 490 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 4,22)489 #if RTLNX_VER_MIN(2,4,22) 491 490 if (!pMemLnx->fContiguous) 492 491 { … … 545 544 * Use vmap - 2.4.22 and later. 546 545 */ 547 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 4,22)546 #if RTLNX_VER_MIN(2,4,22) 548 547 pgprot_t fPg; 549 548 pgprot_val(fPg) = _PAGE_PRESENT | _PAGE_RW; … … 620 619 static void rtR0MemObjLinuxVUnmap(PRTR0MEMOBJLNX pMemLnx) 621 620 { 622 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 4,22)621 #if RTLNX_VER_MIN(2,4,22) 623 622 # ifdef IPRT_USE_ALLOC_VM_AREA_FOR_EXEC 624 623 if (pMemLnx->pArea) … … 683 682 if (!PageReserved(pMemLnx->apPages[iPage])) 684 683 SetPageDirty(pMemLnx->apPages[iPage]); 685 #if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 6,0)684 #if RTLNX_VER_MIN(4,6,0) 686 685 put_page(pMemLnx->apPages[iPage]); 687 686 #else … … 746 745 int rc; 747 746 748 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 4,22)747 #if RTLNX_VER_MIN(2,4,22) 749 748 rc = rtR0MemObjLinuxAllocPages(&pMemLnx, RTR0MEMOBJTYPE_PAGE, cb, PAGE_SIZE, GFP_HIGHUSER, 750 749 false /* non-contiguous */, fExecutable, VERR_NO_MEMORY); … … 995 994 { 996 995 pgd_t Global; 997 #if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 12,0)996 #if RTLNX_VER_MIN(4,12,0) 998 997 p4d_t Four; 999 998 #endif 1000 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6,11)999 #if RTLNX_VER_MIN(2,6,11) 1001 1000 pud_t Upper; 1002 1001 #endif … … 1013 1012 if (RT_UNLIKELY(pgd_none(u.Global))) 1014 1013 return NULL; 1015 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6,11)1016 # if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 12,0)1014 #if RTLNX_VER_MIN(2,6,11) 1015 # if RTLNX_VER_MIN(4,12,0) 1017 1016 u.Four = *p4d_offset(&u.Global, ulAddr); 1018 1017 if (RT_UNLIKELY(p4d_none(u.Four))) … … 1033 1032 if (RT_UNLIKELY(pud_none(u.Upper))) 1034 1033 return NULL; 1035 # if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6,25)1034 # if RTLNX_VER_MIN(2,6,25) 1036 1035 if (pud_large(u.Upper)) 1037 1036 { … … 1049 1048 if (RT_UNLIKELY(pmd_none(u.Middle))) 1050 1049 return NULL; 1051 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6,0)1050 #if RTLNX_VER_MIN(2,6,0) 1052 1051 if (pmd_large(u.Middle)) 1053 1052 { … … 1060 1059 #endif 1061 1060 1062 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 5,5) || defined(pte_offset_map) /* As usual, RHEL 3 had pte_offset_map earlier. */1061 #if RTLNX_VER_MIN(2,5,5) || defined(pte_offset_map) /* As usual, RHEL 3 had pte_offset_map earlier. */ 1063 1062 pEntry = pte_offset_map(&u.Middle, ulAddr); 1064 1063 #else … … 1068 1067 return NULL; 1069 1068 u.Entry = *pEntry; 1070 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 5,5) || defined(pte_offset_map)1069 #if RTLNX_VER_MIN(2,5,5) || defined(pte_offset_map) 1071 1070 pte_unmap(pEntry); 1072 1071 #endif … … 1120 1119 1121 1120 /* openSUSE Leap 42.3 detection :-/ */ 1122 #if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 4, 0) \ 1123 && LINUX_VERSION_CODE < KERNEL_VERSION(4, 6, 0) \ 1124 && defined(FAULT_FLAG_REMOTE) 1121 #if RTLNX_VER_RANGE(4,4,0, 4,6,0) && defined(FAULT_FLAG_REMOTE) 1125 1122 # define GET_USER_PAGES_API KERNEL_VERSION(4, 10, 0) /* no typo! */ 1126 1123 #else … … 1134 1131 struct task_struct *pTask = rtR0ProcessToLinuxTask(R0Process); 1135 1132 struct vm_area_struct **papVMAs; 1136 PRTR0MEMOBJLNX pMemLnx;1133 PRTR0MEMOBJLNX pMemLnx; 1137 1134 int rc = VERR_NO_MEMORY; 1138 1135 int const fWrite = fAccess & RTMEM_PROT_WRITE ? 1 : 0; … … 1209 1206 cPages, /* How many pages. */ 1210 1207 /* The get_user_pages API change was back-ported to 4.4.168. */ 1211 # if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 4, 168) \ 1212 && LINUX_VERSION_CODE < KERNEL_VERSION(4, 5, 0) 1208 # if RTLNX_VER_RANGE(4,4,168, 4,5,0) 1213 1209 fWrite ? FOLL_WRITE | /* Write to memory. */ 1214 1210 FOLL_FORCE /* force write access. */ … … 1265 1261 if (!PageReserved(pMemLnx->apPages[rc])) 1266 1262 SetPageDirty(pMemLnx->apPages[rc]); 1267 #if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 6,0)1263 #if RTLNX_VER_MIN(4,6,0) 1268 1264 put_page(pMemLnx->apPages[rc]); 1269 1265 #else … … 1375 1371 DECLHIDDEN(int) rtR0MemObjNativeReserveKernel(PPRTR0MEMOBJINTERNAL ppMem, void *pvFixed, size_t cb, size_t uAlignment) 1376 1372 { 1377 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 4,22)1373 #if RTLNX_VER_MIN(2,4,22) 1378 1374 IPRT_LINUX_SAVE_EFL_AC(); 1379 1375 const size_t cPages = cb >> PAGE_SHIFT; … … 1500 1496 if (pMemLnxToMap->cPages) 1501 1497 { 1502 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 4,22)1498 #if RTLNX_VER_MIN(2,4,22) 1503 1499 /* 1504 1500 * Use vmap - 2.4.22 and later. … … 1545 1541 */ 1546 1542 Assert(pMemLnxToMap->Core.enmType == RTR0MEMOBJTYPE_PHYS && !pMemLnxToMap->Core.u.Phys.fAllocated); 1547 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6,25)1543 #if RTLNX_VER_MIN(2,6,25) 1548 1544 /* 1549 1545 * ioremap() defaults to no caching since the 2.6 kernels. … … 1695 1691 for (iPage = offSub >> PAGE_SHIFT; iPage < cPages; iPage++, ulAddrCur += PAGE_SIZE) 1696 1692 { 1697 #if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6,11)1693 #if RTLNX_VER_MAX(2,6,11) 1698 1694 RTHCPHYS Phys = page_to_phys(pMemLnxToMap->apPages[iPage]); 1699 1695 #endif 1700 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6,0) || defined(HAVE_26_STYLE_REMAP_PAGE_RANGE)1696 #if RTLNX_VER_MIN(2,6,0) || defined(HAVE_26_STYLE_REMAP_PAGE_RANGE) 1701 1697 struct vm_area_struct *vma = find_vma(pTask->mm, ulAddrCur); /* this is probably the same for all the pages... */ 1702 1698 AssertBreakStmt(vma, rc = VERR_INTERNAL_ERROR); 1703 1699 #endif 1704 #if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6,0) && defined(RT_ARCH_X86)1700 #if RTLNX_VER_MAX(2,6,0) && defined(RT_ARCH_X86) 1705 1701 /* remap_page_range() limitation on x86 */ 1706 1702 AssertBreakStmt(Phys < _4G, rc = VERR_NO_MEMORY); 1707 1703 #endif 1708 1704 1709 #if defined(VBOX_USE_INSERT_PAGE) && LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6,22)1705 #if defined(VBOX_USE_INSERT_PAGE) && RTLNX_VER_MIN(2,6,22) 1710 1706 rc = vm_insert_page(vma, ulAddrCur, pMemLnxToMap->apPages[iPage]); 1711 1707 /* Thes flags help making 100% sure some bad stuff wont happen (swap, core, ++). 1712 1708 * See remap_pfn_range() in mm/memory.c */ 1713 #if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 7,0)1709 #if RTLNX_VER_MIN(3,7,0) 1714 1710 vma->vm_flags |= VM_DONTEXPAND | VM_DONTDUMP; 1715 1711 #else 1716 1712 vma->vm_flags |= VM_RESERVED; 1717 1713 #endif 1718 #elif LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6,11)1714 #elif RTLNX_VER_MIN(2,6,11) 1719 1715 rc = remap_pfn_range(vma, ulAddrCur, page_to_pfn(pMemLnxToMap->apPages[iPage]), PAGE_SIZE, fPg); 1720 1716 #elif defined(VBOX_USE_PAE_HACK) … … 1722 1718 if (!rc) 1723 1719 rc = rtR0MemObjLinuxFixPte(pTask->mm, ulAddrCur, Phys); 1724 #elif LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6,0) || defined(HAVE_26_STYLE_REMAP_PAGE_RANGE)1720 #elif RTLNX_VER_MIN(2,6,0) || defined(HAVE_26_STYLE_REMAP_PAGE_RANGE) 1725 1721 rc = remap_page_range(vma, ulAddrCur, Phys, PAGE_SIZE, fPg); 1726 1722 #else /* 2.4 */ … … 1750 1746 for (iPage = offSub >> PAGE_SHIFT; iPage < cPages; iPage++, ulAddrCur += PAGE_SIZE, Phys += PAGE_SIZE) 1751 1747 { 1752 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6,0) || defined(HAVE_26_STYLE_REMAP_PAGE_RANGE)1748 #if RTLNX_VER_MIN(2,6,0) || defined(HAVE_26_STYLE_REMAP_PAGE_RANGE) 1753 1749 struct vm_area_struct *vma = find_vma(pTask->mm, ulAddrCur); /* this is probably the same for all the pages... */ 1754 1750 AssertBreakStmt(vma, rc = VERR_INTERNAL_ERROR); 1755 1751 #endif 1756 #if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6,0) && defined(RT_ARCH_X86)1752 #if RTLNX_VER_MAX(2,6,0) && defined(RT_ARCH_X86) 1757 1753 /* remap_page_range() limitation on x86 */ 1758 1754 AssertBreakStmt(Phys < _4G, rc = VERR_NO_MEMORY); 1759 1755 #endif 1760 1756 1761 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6,11)1757 #if RTLNX_VER_MIN(2,6,11) 1762 1758 rc = remap_pfn_range(vma, ulAddrCur, Phys, PAGE_SIZE, fPg); 1763 1759 #elif defined(VBOX_USE_PAE_HACK) … … 1765 1761 if (!rc) 1766 1762 rc = rtR0MemObjLinuxFixPte(pTask->mm, ulAddrCur, Phys); 1767 #elif LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6,0) || defined(HAVE_26_STYLE_REMAP_PAGE_RANGE)1763 #elif RTLNX_VER_MIN(2,6,0) || defined(HAVE_26_STYLE_REMAP_PAGE_RANGE) 1768 1764 rc = remap_page_range(vma, ulAddrCur, Phys, PAGE_SIZE, fPg); 1769 1765 #else /* 2.4 */ … … 1780 1776 1781 1777 #ifdef CONFIG_NUMA_BALANCING 1782 # if LINUX_VERSION_CODE < KERNEL_VERSION(3, 13,0)1778 # if RTLNX_VER_MAX(3,13,0) 1783 1779 # ifdef RHEL_RELEASE_CODE 1784 1780 # if RHEL_RELEASE_CODE < RHEL_RELEASE_VERSION(7, 0) -
trunk/src/VBox/Runtime/r0drv/linux/memuserkernel-r0drv-linux.c
r82968 r85698 67 67 { 68 68 IPRT_LINUX_SAVE_EFL_AC(); 69 #if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 0,0) || defined(RHEL_81)69 #if RTLNX_VER_MIN(5,0,0) || defined(RHEL_81) 70 70 bool fRc = access_ok((void *)R3Ptr, 1); 71 71 #else … … 87 87 #else 88 88 # error "PORT ME" 89 #if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 0,0) || defined(RHEL_81)89 #if RTLNX_VER_MIN(5,0,0) || defined(RHEL_81) 90 90 return !access_ok(pv, 1); 91 91 #else 92 92 return !access_ok(VERIFY_READ, pv, 1); 93 #endif /* LINUX_VERSION_CODE */93 #endif 94 94 #endif 95 95 } … … 113 113 static int rtR0MemKernelCopyLnxWorker(void *pvDst, void const *pvSrc, size_t cb) 114 114 { 115 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 5,55)115 #if RTLNX_VER_MIN(2,5,55) 116 116 /* _ASM_EXTABLE was introduced in 2.6.25 from what I can tell. Using #ifndef 117 117 here since it has to be a macro and you never know what someone might have -
trunk/src/VBox/Runtime/r0drv/linux/mp-r0drv-linux.c
r85602 r85698 43 43 * Defined Constants And Macros * 44 44 *********************************************************************************************************************************/ 45 #if defined(nr_cpumask_bits) || LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6,28)45 #if defined(nr_cpumask_bits) || RTLNX_VER_MIN(2,6,28) 46 46 # define VBOX_NR_CPUMASK_BITS (nr_cpumask_bits) /* same as nr_cpu_ids */ 47 47 #else … … 95 95 { 96 96 #if defined(CONFIG_SMP) 97 # if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6,2) || defined(cpu_possible)97 # if RTLNX_VER_MIN(2,6,2) || defined(cpu_possible) 98 98 return idCpu < VBOX_NR_CPUMASK_BITS && cpu_possible(idCpu); 99 99 # else /* < 2.5.29 */ … … 126 126 { 127 127 #ifdef CONFIG_SMP 128 # if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6,4) || defined(num_possible_cpus)128 # if RTLNX_VER_MIN(2,6,4) || defined(num_possible_cpus) 129 129 return num_possible_cpus(); 130 # elif LINUX_VERSION_CODE < KERNEL_VERSION(2, 5,0)130 # elif RTLNX_VER_MAX(2,5,0) 131 131 return smp_num_cpus; 132 132 # else … … 145 145 { 146 146 #ifdef CONFIG_SMP 147 # if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6,0) || defined(cpu_online)147 # if RTLNX_VER_MIN(2,6,0) || defined(cpu_online) 148 148 return idCpu < VBOX_NR_CPUMASK_BITS && cpu_online(idCpu); 149 149 # else /* 2.4: */ … … 181 181 { 182 182 #ifdef CONFIG_SMP 183 # if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6,0) || defined(num_online_cpus)183 # if RTLNX_VER_MIN(2,6,0) || defined(num_online_cpus) 184 184 return num_online_cpus(); 185 185 # else … … 217 217 #ifdef CONFIG_SMP 218 218 219 # if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6,27)219 # if RTLNX_VER_MIN(2,6,27) 220 220 /** 221 221 * Wrapper between the native linux per-cpu callbacks and PFNRTWORKER, does hit … … 281 281 { 282 282 /* Fire the function on all other CPUs without waiting for completion. */ 283 # if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 3,0)283 # if RTLNX_VER_MIN(5,3,0) 284 284 smp_call_function(rtmpLinuxAllWrapper, &Args, 0 /* wait */); 285 # elif LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6,27)285 # elif RTLNX_VER_MIN(2,6,27) 286 286 int rc = smp_call_function(rtmpLinuxAllWrapper, &Args, 0 /* wait */); 287 287 Assert(!rc); NOREF(rc); … … 337 337 338 338 RTThreadPreemptDisable(&PreemptState); 339 # if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 3,0)339 # if RTLNX_VER_MIN(5,3,0) 340 340 smp_call_function(rtmpLinuxWrapper, &Args, 1 /* wait */); 341 # elif LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6,27)341 # elif RTLNX_VER_MIN(2,6,27) 342 342 int rc = smp_call_function(rtmpLinuxWrapper, &Args, 1 /* wait */); 343 343 Assert(rc == 0); NOREF(rc); … … 357 357 358 358 359 #if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6,27) && defined(CONFIG_SMP)359 #if RTLNX_VER_MAX(2,6,27) && defined(CONFIG_SMP) 360 360 /** 361 361 * Wrapper between the native linux per-cpu callbacks and PFNRTWORKER … … 385 385 int rc; 386 386 RTTHREADPREEMPTSTATE PreemptState = RTTHREADPREEMPTSTATE_INITIALIZER; 387 # if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6,28) /* 2.6.28 introduces CONFIG_CPUMASK_OFFSTACK */387 # if RTLNX_VER_MIN(2,6,28) /* 2.6.28 introduces CONFIG_CPUMASK_OFFSTACK */ 388 388 cpumask_var_t DstCpuMask; 389 # elif LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6,27)389 # elif RTLNX_VER_MIN(2,6,27) 390 390 cpumask_t DstCpuMask; 391 391 # endif … … 397 397 * Prepare the CPU mask before we disable preemption. 398 398 */ 399 # if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6,30)399 # if RTLNX_VER_MIN(2,6,30) 400 400 if (!zalloc_cpumask_var(&DstCpuMask, GFP_KERNEL)) 401 401 return VERR_NO_MEMORY; 402 402 cpumask_set_cpu(idCpu1, DstCpuMask); 403 403 cpumask_set_cpu(idCpu2, DstCpuMask); 404 # elif LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6,28)404 # elif RTLNX_VER_MIN(2,6,28) 405 405 if (!alloc_cpumask_var(&DstCpuMask, GFP_KERNEL)) 406 406 return VERR_NO_MEMORY; … … 408 408 cpumask_set_cpu(idCpu1, DstCpuMask); 409 409 cpumask_set_cpu(idCpu2, DstCpuMask); 410 # elif LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6,27)410 # elif RTLNX_VER_MIN(2,6,27) 411 411 cpus_clear(DstCpuMask); 412 412 cpu_set(idCpu1, DstCpuMask); … … 437 437 Args.cHits = 0; 438 438 439 # if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6,28)439 # if RTLNX_VER_MIN(2,6,28) 440 440 smp_call_function_many(DstCpuMask, rtmpLinuxWrapperPostInc, &Args, !fCallSelf /* wait */); 441 441 rc = 0; 442 # elif LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6,27)442 # elif RTLNX_VER_MIN(2,6,27) 443 443 rc = smp_call_function_mask(DstCpuMask, rtmpLinuxWrapperPostInc, &Args, !fCallSelf /* wait */); 444 444 # else /* older kernels */ … … 481 481 482 482 RTThreadPreemptRestore(&PreemptState);; 483 # if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6,28)483 # if RTLNX_VER_MIN(2,6,28) 484 484 free_cpumask_var(DstCpuMask); 485 485 # endif … … 502 502 503 503 504 #if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6,19) && defined(CONFIG_SMP)504 #if RTLNX_VER_MAX(2,6,19) && defined(CONFIG_SMP) 505 505 /** 506 506 * Wrapper between the native linux per-cpu callbacks and PFNRTWORKER … … 545 545 if (RTMpIsCpuOnline(idCpu)) 546 546 { 547 # if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6,27)547 # if RTLNX_VER_MIN(2,6,27) 548 548 rc = smp_call_function_single(idCpu, rtmpLinuxWrapper, &Args, 1 /* wait */); 549 # elif LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6,19)549 # elif RTLNX_VER_MIN(2,6,19) 550 550 rc = smp_call_function_single(idCpu, rtmpLinuxWrapper, &Args, 0 /* retry */, 1 /* wait */); 551 551 # else /* older kernels */ … … 573 573 574 574 575 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6,19) && defined(CONFIG_SMP)575 #if RTLNX_VER_MIN(2,6,19) && defined(CONFIG_SMP) 576 576 /** 577 577 * Dummy callback used by RTMpPokeCpu. … … 588 588 RTDECL(int) RTMpPokeCpu(RTCPUID idCpu) 589 589 { 590 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6,19)590 #if RTLNX_VER_MIN(2,6,19) 591 591 IPRT_LINUX_SAVE_EFL_AC(); 592 592 int rc; … … 596 596 { 597 597 # ifdef CONFIG_SMP 598 # if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6,27)598 # if RTLNX_VER_MIN(2,6,27) 599 599 rc = smp_call_function_single(idCpu, rtmpLinuxPokeCpuCallback, NULL, 0 /* wait */); 600 # elif LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6,19)600 # elif RTLNX_VER_MIN(2,6,19) 601 601 rc = smp_call_function_single(idCpu, rtmpLinuxPokeCpuCallback, NULL, 0 /* retry */, 0 /* wait */); 602 602 # else /* older kernels */ -
trunk/src/VBox/Runtime/r0drv/linux/mpnotification-r0drv-linux.c
r82968 r85698 38 38 #include "r0drv/mp-r0drv.h" 39 39 40 #if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 10,0)40 #if RTLNX_VER_MIN(4,10,0) 41 41 42 42 static enum cpuhp_state g_rtR0MpOnline; … … 86 86 } 87 87 88 #elif LINUX_VERSION_CODE >= KERNEL_VERSION(2, 5,71) && defined(CONFIG_SMP)88 #elif RTLNX_VER_MIN(2,5,71) && defined(CONFIG_SMP) 89 89 90 90 static int rtMpNotificationLinuxCallback(struct notifier_block *pNotifierBlock, unsigned long ulNativeEvent, void *pvCpu); -
trunk/src/VBox/Runtime/r0drv/linux/rtStrFormatKernelAddress-r0drv-linux.c
r82968 r85698 42 42 signed int cchPrecision, unsigned int fFlags) 43 43 { 44 #if !defined(DEBUG) && LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6,38)44 #if !defined(DEBUG) && RTLNX_VER_MIN(2,6,38) 45 45 RT_NOREF(cchWidth, cchPrecision); 46 46 /* use the Linux kernel function which is able to handle "%pK" */ -
trunk/src/VBox/Runtime/r0drv/linux/the-linux-kernel.h
r85690 r85698 49 49 50 50 51 /** @def RTLNX_VER_MIN 52 * Evaluates to true if the linux kernel version is equal or higher to the 53 * one specfied. */ 54 #define RTLNX_VER_MIN(a_Major, a_Minor, a_Patch) \ 55 (LINUX_VERSION_CODE >= KERNEL_VERSION(a_Major, a_Minor, a_Patch)) 56 /** @def RTLNX_VER_MAX 57 * Evaluates to true if the linux kernel version is less to the one specfied 58 * (exclusive). */ 59 #define RTLNX_VER_MAX(a_Major, a_Minor, a_Patch) \ 60 (LINUX_VERSION_CODE < KERNEL_VERSION(a_Major, a_Minor, a_Patch)) 61 /** @def RTLNX_VER_RANGE 62 * Evaluates to true if the linux kernel version is equal or higher to the given 63 * minimum version and less (but not equal) to the maximum version (exclusive). */ 64 #define RTLNX_VER_RANGE(a_MajorMin, a_MinorMin, a_PatchMin, a_MajorMax, a_MinorMax, a_PatchMax) \ 65 ( LINUX_VERSION_CODE >= KERNEL_VERSION(a_MajorMin, a_MinorMin, a_PatchMin) \ 66 && LINUX_VERSION_CODE < KERNEL_VERSION(a_MajorMax, a_MinorMax, a_PatchMax) ) 67 68 69 #include <linux/version.h> 70 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 33) 51 #include <iprt/linux/version.h> 52 #if RTLNX_VER_MIN(2,6,33) 71 53 # include <generated/autoconf.h> 72 54 #else … … 77 59 78 60 /* We only support 2.4 and 2.6 series kernels */ 79 #if LINUX_VERSION_CODE < KERNEL_VERSION(2, 4,0)61 #if RTLNX_VER_MAX(2,4,0) 80 62 # error Sorry, we do not support 2.3 and earlier kernels. 81 63 #endif 82 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 5, 0) && LINUX_VERSION_CODE < KERNEL_VERSION(2, 6,0)64 #if RTLNX_VER_MIN(2,5,0) && RTLNX_VER_MAX(2,6,0) 83 65 # error Sorry, we do not support 2.5 series kernels (might work though). 84 66 #endif … … 86 68 #if defined(CONFIG_MODVERSIONS) && !defined(MODVERSIONS) 87 69 # define MODVERSIONS 88 # if LINUX_VERSION_CODE < KERNEL_VERSION(2, 5,71)70 # if RTLNX_VER_MAX(2,5,71) 89 71 # include <linux/modversions.h> 90 72 # endif 91 73 #endif 92 74 #ifndef KBUILD_STR 93 # if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6,16)75 # if RTLNX_VER_MAX(2,6,16) 94 76 # define KBUILD_STR(s) s 95 77 # else … … 97 79 # endif 98 80 #endif 99 # if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 3,0)81 # if RTLNX_VER_MIN(3,3,0) 100 82 # include <linux/kconfig.h> /* for macro IS_ENABLED */ 101 83 # endif … … 103 85 #include <linux/spinlock.h> 104 86 #include <linux/slab.h> 105 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6,27)87 #if RTLNX_VER_MIN(2,6,27) 106 88 # include <linux/semaphore.h> 107 89 #else /* older kernels */ … … 109 91 #endif /* older kernels */ 110 92 #include <linux/module.h> 111 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6,0)93 #if RTLNX_VER_MIN(2,6,0) 112 94 # include <linux/moduleparam.h> 113 95 #endif … … 115 97 #include <linux/init.h> 116 98 #include <linux/fs.h> 117 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6,0)99 #if RTLNX_VER_MIN(2,6,0) 118 100 # include <linux/namei.h> 119 101 #endif … … 124 106 #include <linux/sched.h> 125 107 126 #if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 9, 23) && \ 127 LINUX_VERSION_CODE < KERNEL_VERSION(3, 9, 31) 128 #include <linux/splice.h> 129 #endif 130 131 #if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 9, 0) 108 #if RTLNX_VER_RANGE(3,9,23, 3,9,31) 109 # include <linux/splice.h> 110 #endif 111 112 #if RTLNX_VER_MIN(3,9,0) 132 113 # include <linux/sched/rt.h> 133 114 #endif 134 #if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 11,0)115 #if RTLNX_VER_MIN(4,11,0) 135 116 # include <linux/sched/signal.h> 136 117 # include <linux/sched/types.h> 137 118 #endif 138 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6,7)119 #if RTLNX_VER_MIN(2,6,7) 139 120 # include <linux/jiffies.h> 140 121 #endif 141 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6,16)122 #if RTLNX_VER_MIN(2,6,16) 142 123 # include <linux/ktime.h> 143 124 # include <linux/hrtimer.h> 144 125 #endif 145 126 #include <linux/wait.h> 146 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 5,71)127 #if RTLNX_VER_MIN(2,5,71) 147 128 # include <linux/cpu.h> 148 129 # include <linux/notifier.h> 149 130 #endif 150 #if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 1,0)131 #if RTLNX_VER_MIN(5,1,0) 151 132 # include <uapi/linux/mman.h> 152 133 #endif … … 171 152 172 153 /* For thread-context hooks. */ 173 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6,18) && defined(CONFIG_PREEMPT_NOTIFIERS)154 #if RTLNX_VER_MIN(2,6,18) && defined(CONFIG_PREEMPT_NOTIFIERS) 174 155 # include <linux/preempt.h> 175 156 #endif 176 157 177 158 /* for workqueue / task queues. */ 178 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 5,41)159 #if RTLNX_VER_MIN(2,5,41) 179 160 # include <linux/workqueue.h> 180 161 #else … … 182 163 #endif 183 164 184 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6,4)165 #if RTLNX_VER_MIN(2,6,4) 185 166 # include <linux/kthread.h> 186 167 #endif 187 168 188 169 /* for cr4_init_shadow() / cpu_tlbstate. */ 189 #if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 20,0)170 #if RTLNX_VER_MIN(3,20,0) 190 171 # include <asm/tlbflush.h> 191 172 #endif 192 173 193 174 /* for set_pages_x() */ 194 #if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 12,0)175 #if RTLNX_VER_MIN(4,12,0) 195 176 # include <asm/set_memory.h> 196 177 #endif 197 178 198 179 /* for __flush_tlb_all() */ 199 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6,28) && (defined(RT_ARCH_AMD64) || defined(RT_ARCH_X86))180 #if RTLNX_VER_MIN(2,6,28) && (defined(RT_ARCH_AMD64) || defined(RT_ARCH_X86)) 200 181 # include <asm/tlbflush.h> 201 182 #endif 202 183 203 #if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 7,0)184 #if RTLNX_VER_MIN(3,7,0) 204 185 # include <asm/smap.h> 205 186 #else … … 208 189 #endif 209 190 210 #if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6,0)191 #if RTLNX_VER_MAX(2,6,0) 211 192 # ifndef page_to_pfn 212 193 # define page_to_pfn(page) ((page) - mem_map) … … 225 206 * 2.4 / early 2.6 compatibility wrappers 226 207 */ 227 #if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6,7)208 #if RTLNX_VER_MAX(2,6,7) 228 209 229 210 # ifndef MAX_JIFFY_OFFSET … … 231 212 # endif 232 213 233 # if LINUX_VERSION_CODE < KERNEL_VERSION(2, 4, 29) || LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6,0)214 # if RTLNX_VER_MAX(2,4,29) || RTLNX_VER_MIN(2,6,0) 234 215 235 216 DECLINLINE(unsigned int) jiffies_to_msecs(unsigned long cJiffies) … … 266 247 * 2.4 compatibility wrappers 267 248 */ 268 #if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6,0)249 #if RTLNX_VER_MAX(2,6,0) 269 250 270 251 # define prepare_to_wait(q, wait, state) \ … … 300 281 * This sucks soooo badly on x86! Why don't they export __PAGE_KERNEL_EXEC so PAGE_KERNEL_EXEC would be usable? 301 282 */ 302 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6,8) && defined(RT_ARCH_AMD64)283 #if RTLNX_VER_MIN(2,6,8) && defined(RT_ARCH_AMD64) 303 284 # define MY_PAGE_KERNEL_EXEC PAGE_KERNEL_EXEC 304 #elif LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6,8) && defined(PAGE_KERNEL_EXEC) && defined(CONFIG_X86_PAE)285 #elif RTLNX_VER_MIN(2,6,8) && defined(PAGE_KERNEL_EXEC) && defined(CONFIG_X86_PAE) 305 286 # ifdef __PAGE_KERNEL_EXEC 306 287 /* >= 2.6.27 */ … … 320 301 #ifndef NO_REDHAT_HACKS 321 302 /* accounting. */ 322 # if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6,0)303 # if RTLNX_VER_MAX(2,6,0) 323 304 # ifdef VM_ACCOUNT 324 305 # define USE_RHEL4_MUNMAP … … 327 308 328 309 /* backported remap_page_range. */ 329 # if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6,0)310 # if RTLNX_VER_MAX(2,6,0) 330 311 # include <asm/tlb.h> 331 312 # ifdef tlb_vma /* probably not good enough... */ … … 361 342 #endif 362 343 363 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6,25)364 # if LINUX_VERSION_CODE < KERNEL_VERSION(5, 4,0) /* The interface was removed, but we only need it for < 2.4.22, so who cares. */344 #if RTLNX_VER_MIN(2,6,25) 345 # if RTLNX_VER_MAX(5,4,0) /* The interface was removed, but we only need it for < 2.4.22, so who cares. */ 365 346 # define MY_SET_PAGES_EXEC(pPages, cPages) set_pages_x(pPages, cPages) 366 347 # define MY_SET_PAGES_NOEXEC(pPages, cPages) set_pages_nx(pPages, cPages) … … 473 454 * Whether the kernel support high resolution timers (Linux kernel versions 474 455 * 2.6.28 and later (hrtimer_add_expires_ns() & schedule_hrtimeout). */ 475 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6,28)456 #if RTLNX_VER_MIN(2,6,28) 476 457 # define IPRT_LINUX_HAS_HRTIMER 477 458 #endif … … 480 461 * Workqueue stuff, see initterm-r0drv-linux.c. 481 462 */ 482 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 5,41)463 #if RTLNX_VER_MIN(2,5,41) 483 464 typedef struct work_struct RTR0LNXWORKQUEUEITEM; 484 465 #else -
trunk/src/VBox/Runtime/r0drv/linux/thread-r0drv-linux.c
r82968 r85698 34 34 35 35 #include <iprt/asm.h> 36 #if LINUX_VERSION_CODE < KERNEL_VERSION(2, 5,28) || defined(CONFIG_X86_SMAP)36 #if RTLNX_VER_MAX(2,5,28) || defined(CONFIG_X86_SMAP) 37 37 # include <iprt/asm-amd64-x86.h> 38 38 #endif … … 88 88 { 89 89 IPRT_LINUX_SAVE_EFL_AC(); 90 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 4,20)90 #if RTLNX_VER_MIN(2,4,20) 91 91 yield(); 92 92 #else … … 119 119 if (c != 0) 120 120 return false; 121 # if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 5,32)121 # if RTLNX_VER_MIN(2,5,32) 122 122 if (in_atomic()) 123 123 return false; 124 124 # endif 125 # if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 5,28)125 # if RTLNX_VER_MIN(2,5,28) 126 126 if (irqs_disabled()) 127 127 return false; … … 139 139 { 140 140 Assert(hThread == NIL_RTTHREAD); RT_NOREF_PV(hThread); 141 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 5,4)141 #if RTLNX_VER_MIN(2,5,4) 142 142 return !!test_tsk_thread_flag(current, TIF_NEED_RESCHED); 143 143 144 #elif LINUX_VERSION_CODE >= KERNEL_VERSION(2, 4,20)144 #elif RTLNX_VER_MIN(2,4,20) 145 145 return !!need_resched(); 146 146 147 #elif LINUX_VERSION_CODE >= KERNEL_VERSION(2, 1,110)147 #elif RTLNX_VER_MIN(2,1,110) 148 148 return current->need_resched != 0; 149 149 -
trunk/src/VBox/Runtime/r0drv/linux/thread2-r0drv-linux.c
r82968 r85698 37 37 #include "internal/thread.h" 38 38 39 #if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 11,0)39 #if RTLNX_VER_MIN(4,11,0) 40 40 #include <uapi/linux/sched/types.h> 41 41 #endif /* >= KERNEL_VERSION(4, 11, 0) */ … … 55 55 DECLHIDDEN(int) rtThreadNativeSetPriority(PRTTHREADINT pThread, RTTHREADTYPE enmType) 56 56 { 57 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6,11)57 #if RTLNX_VER_MIN(2,6,11) 58 58 /* See comment near MAX_RT_PRIO in linux/sched.h for details on 59 59 sched_priority. */ … … 123 123 124 124 125 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6,4)125 #if RTLNX_VER_MIN(2,6,4) 126 126 /** 127 127 * Native kernel thread wrapper function. … … 143 143 DECLHIDDEN(int) rtThreadNativeCreate(PRTTHREADINT pThreadInt, PRTNATIVETHREAD pNativeThread) 144 144 { 145 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6,4)145 #if RTLNX_VER_MIN(2,6,4) 146 146 struct task_struct *NativeThread; 147 147 IPRT_LINUX_SAVE_EFL_AC(); -
trunk/src/VBox/Runtime/r0drv/linux/threadctxhooks-r0drv-linux.c
r82968 r85698 47 47 * got it backported. 48 48 */ 49 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6,18) && defined(CONFIG_PREEMPT_NOTIFIERS)49 #if RTLNX_VER_MIN(2,6,18) && defined(CONFIG_PREEMPT_NOTIFIERS) 50 50 51 51 … … 73 73 /** The linux callbacks. */ 74 74 struct preempt_ops PreemptOps; 75 #if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 1,19) && defined(RT_ARCH_AMD64)75 #if RTLNX_VER_MIN(3,1,19) && defined(RT_ARCH_AMD64) 76 76 /** Starting with 3.1.19, the linux kernel doesn't restore kernel RFLAGS during 77 77 * task switch, so we have to do that ourselves. (x86 code is not affected.) */ … … 110 110 #if defined(RT_ARCH_AMD64) || defined(RT_ARCH_X86) 111 111 ASMSetFlags(fSavedEFlags); 112 # if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 1,19) && defined(RT_ARCH_AMD64)112 # if RTLNX_VER_MIN(3,1,19) && defined(RT_ARCH_AMD64) 113 113 pThis->fSavedRFlags = fSavedEFlags; 114 114 # endif … … 143 143 144 144 #if defined(RT_ARCH_AMD64) || defined(RT_ARCH_X86) 145 # if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 1,19) && defined(RT_ARCH_AMD64)145 # if RTLNX_VER_MIN(3,1,19) && defined(RT_ARCH_AMD64) 146 146 fSavedEFlags &= ~RT_BIT_64(18) /*X86_EFL_AC*/; 147 147 fSavedEFlags |= pThis->fSavedRFlags & RT_BIT_64(18) /*X86_EFL_AC*/; … … 199 199 pThis->PreemptOps.sched_in = rtThreadCtxHooksLnxSchedIn; 200 200 201 #if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 2,0)201 #if RTLNX_VER_MIN(4,2,0) 202 202 preempt_notifier_inc(); 203 203 #endif … … 236 236 } 237 237 238 #if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 2,0)238 #if RTLNX_VER_MIN(4,2,0) 239 239 preempt_notifier_dec(); 240 240 #endif -
trunk/src/VBox/Runtime/r0drv/linux/time-r0drv-linux.c
r85208 r85698 33 33 #include "internal/iprt.h" 34 34 /* Make sure we have the setting functions we need for RTTimeNow: */ 35 #if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6,16)35 #if RTLNX_VER_MAX(2,6,16) 36 36 # define RTTIME_INCL_TIMEVAL 37 #elif LINUX_VERSION_CODE < KERNEL_VERSION(3, 17,0)37 #elif RTLNX_VER_MAX(3,17,0) 38 38 # define RTTIME_INCL_TIMESPEC 39 39 #endif … … 45 45 DECLINLINE(uint64_t) rtTimeGetSystemNanoTS(void) 46 46 { 47 #if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 6,0)47 #if RTLNX_VER_MIN(5,6,0) 48 48 /* 49 49 * Starting with kernel version 5.6-rc3 only 64-bit time interfaces … … 57 57 return u64; 58 58 59 #elif LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6,16) /* This must match timer-r0drv-linux.c! */59 #elif RTLNX_VER_MIN(2,6,16) /* This must match timer-r0drv-linux.c! */ 60 60 /* 61 61 * Use ktime_get_ts, this is also what clock_gettime(CLOCK_MONOTONIC,) is using. … … 67 67 return u64; 68 68 69 #elif LINUX_VERSION_CODE >= KERNEL_VERSION(2, 5,60)69 #elif RTLNX_VER_MIN(2,5,60) 70 70 /* 71 71 * Seems there is no way of getting to the exact source of … … 189 189 { 190 190 IPRT_LINUX_SAVE_EFL_AC(); 191 #if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 17,0)191 #if RTLNX_VER_MIN(3,17,0) 192 192 struct timespec64 Ts; 193 193 ktime_get_real_ts64(&Ts); /* ktime_get_real_ts64 was added as a macro in 3.17, function since 4.18. */ … … 195 195 return RTTimeSpecSetTimespec64(pTime, &Ts); 196 196 197 #elif LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6,16)197 #elif RTLNX_VER_MIN(2,6,16) 198 198 struct timespec Ts; 199 199 ktime_get_real_ts(&Ts); /* ktime_get_real_ts was removed in Linux 4.20. */ -
trunk/src/VBox/Runtime/r0drv/linux/timer-r0drv-linux.c
r82968 r85698 51 51 #endif 52 52 53 #if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6,31)53 #if RTLNX_VER_MAX(2,6,31) 54 54 # define mod_timer_pinned mod_timer 55 55 # define HRTIMER_MODE_ABS_PINNED HRTIMER_MODE_ABS … … 368 368 if (fPinned) 369 369 { 370 # if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 8,0)370 # if RTLNX_VER_MIN(4,8,0) 371 371 mod_timer(&pSubTimer->u.Std.LnxTimer, pSubTimer->u.Std.ulNextJiffies); 372 372 # else … … 721 721 722 722 723 #if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 15,0)723 #if RTLNX_VER_MIN(4,15,0) 724 724 /** 725 725 * Timer callback function for standard timers. … … 840 840 if (pTimer->fSpecificCpu || pTimer->fAllCpus) 841 841 { 842 # if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 8,0)842 # if RTLNX_VER_MIN(4,8,0) 843 843 mod_timer(&pSubTimer->u.Std.LnxTimer, ulNextJiffies); 844 844 # else … … 903 903 if (pTimer->fSpecificCpu || pTimer->fAllCpus) 904 904 { 905 # if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 8,0)905 # if RTLNX_VER_MIN(4,8,0) 906 906 mod_timer(&pSubTimer->u.Std.LnxTimer, pSubTimer->u.Std.ulNextJiffies); 907 907 # else … … 1520 1520 /* For paranoid reasons, defer actually destroying the semaphore when 1521 1521 in atomic or interrupt context. */ 1522 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 5,32)1522 #if RTLNX_VER_MIN(2,5,32) 1523 1523 if (in_atomic() || in_interrupt()) 1524 1524 #else … … 1621 1621 #endif 1622 1622 { 1623 #if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 15,0)1623 #if RTLNX_VER_MIN(4,15,0) 1624 1624 timer_setup(&pTimer->aSubTimers[iCpu].u.Std.LnxTimer, rtTimerLinuxStdCallback, TIMER_PINNED); 1625 #elif LINUX_VERSION_CODE >= KERNEL_VERSION(4, 8,0)1625 #elif RTLNX_VER_MIN(4,8,0) 1626 1626 init_timer_pinned(&pTimer->aSubTimers[iCpu].u.Std.LnxTimer); 1627 1627 #else 1628 1628 init_timer(&pTimer->aSubTimers[iCpu].u.Std.LnxTimer); 1629 1629 #endif 1630 #if LINUX_VERSION_CODE < KERNEL_VERSION(4, 15,0)1630 #if RTLNX_VER_MAX(4,15,0) 1631 1631 pTimer->aSubTimers[iCpu].u.Std.LnxTimer.data = (unsigned long)&pTimer->aSubTimers[iCpu]; 1632 1632 pTimer->aSubTimers[iCpu].u.Std.LnxTimer.function = rtTimerLinuxStdCallback; … … 1687 1687 #endif 1688 1688 /* */ 1689 #if LINUX_VERSION_CODE < KERNEL_VERSION(4, 9, 0) || LINUX_VERSION_CODE >= KERNEL_VERSION(4, 13,0)1689 #if RTLNX_VER_MAX(4,9,0) || RTLNX_VER_MIN(4,13,0) 1690 1690 /* On 4.9, 4.10 and 4.12 we've observed tstRTR0Timer failures of the omni timer tests 1691 1691 where we get about half of the ticks we want. The failing test is using this value -
trunk/src/VBox/Runtime/r0drv/linux/waitqueue-r0drv-linux.h
r85649 r85698 184 184 * Initialize the wait queue related bits. 185 185 */ 186 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 5,39)186 #if RTLNX_VER_MIN(2,5,39) 187 187 init_wait((&pWait->WaitQE)); 188 188 #else
Note:
See TracChangeset
for help on using the changeset viewer.