1 | /* $Id: the-linux-kernel.h 66927 2017-05-17 09:42:23Z vboxsync $ */
|
---|
2 | /** @file
|
---|
3 | * IPRT - Include all necessary headers for the Linux kernel.
|
---|
4 | */
|
---|
5 |
|
---|
6 | /*
|
---|
7 | * Copyright (C) 2006-2016 Oracle Corporation
|
---|
8 | *
|
---|
9 | * This file is part of VirtualBox Open Source Edition (OSE), as
|
---|
10 | * available from http://www.virtualbox.org. This file is free software;
|
---|
11 | * you can redistribute it and/or modify it under the terms of the GNU
|
---|
12 | * General Public License (GPL) as published by the Free Software
|
---|
13 | * Foundation, in version 2 as it comes in the "COPYING" file of the
|
---|
14 | * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
|
---|
15 | * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
|
---|
16 | *
|
---|
17 | * The contents of this file may alternatively be used under the terms
|
---|
18 | * of the Common Development and Distribution License Version 1.0
|
---|
19 | * (CDDL) only, as it comes in the "COPYING.CDDL" file of the
|
---|
20 | * VirtualBox OSE distribution, in which case the provisions of the
|
---|
21 | * CDDL are applicable instead of those of the GPL.
|
---|
22 | *
|
---|
23 | * You may elect to license modified versions of this file under the
|
---|
24 | * terms and conditions of either the GPL or the CDDL or both.
|
---|
25 | */
|
---|
26 |
|
---|
27 | #ifndef ___the_linux_kernel_h
|
---|
28 | #define ___the_linux_kernel_h
|
---|
29 |
|
---|
30 | /*
|
---|
31 | * Include iprt/types.h to install the bool wrappers.
|
---|
32 | * Then use the linux bool type for all the stuff include here.
|
---|
33 | */
|
---|
34 | #include <iprt/types.h>
|
---|
35 | #define bool linux_bool
|
---|
36 |
|
---|
37 | #if RT_GNUC_PREREQ(4, 6)
|
---|
38 | # pragma GCC diagnostic push
|
---|
39 | #endif
|
---|
40 | #if RT_GNUC_PREREQ(4, 2)
|
---|
41 | # pragma GCC diagnostic ignored "-Wunused-parameter"
|
---|
42 | # if !defined(__cplusplus) && RT_GNUC_PREREQ(4, 3)
|
---|
43 | # pragma GCC diagnostic ignored "-Wold-style-declaration" /* 2.6.18-411.0.0.0.1.el5/build/include/asm/apic.h:110: warning: 'inline' is not at beginning of declaration [-Wold-style-declaration] */
|
---|
44 | # endif
|
---|
45 | #endif
|
---|
46 |
|
---|
47 | #include <linux/version.h>
|
---|
48 | #if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 33)
|
---|
49 | # include <generated/autoconf.h>
|
---|
50 | #else
|
---|
51 | # ifndef AUTOCONF_INCLUDED
|
---|
52 | # include <linux/autoconf.h>
|
---|
53 | # endif
|
---|
54 | #endif
|
---|
55 |
|
---|
56 | /* We only support 2.4 and 2.6 series kernels */
|
---|
57 | #if LINUX_VERSION_CODE < KERNEL_VERSION(2, 4, 0)
|
---|
58 | # error We only support 2.4 and 2.6 series kernels
|
---|
59 | #endif
|
---|
60 | #if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 5, 0) && LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 0)
|
---|
61 | # error We only support 2.4 and 2.6 series kernels
|
---|
62 | #endif
|
---|
63 |
|
---|
64 | #if defined(CONFIG_MODVERSIONS) && !defined(MODVERSIONS)
|
---|
65 | # define MODVERSIONS
|
---|
66 | # if LINUX_VERSION_CODE < KERNEL_VERSION(2, 5, 71)
|
---|
67 | # include <linux/modversions.h>
|
---|
68 | # endif
|
---|
69 | #endif
|
---|
70 | #ifndef KBUILD_STR
|
---|
71 | # if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 16)
|
---|
72 | # define KBUILD_STR(s) s
|
---|
73 | # else
|
---|
74 | # define KBUILD_STR(s) #s
|
---|
75 | # endif
|
---|
76 | #endif
|
---|
77 | # if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 3, 0)
|
---|
78 | # include <linux/kconfig.h> /* for macro IS_ENABLED */
|
---|
79 | # endif
|
---|
80 | #include <linux/string.h>
|
---|
81 | #include <linux/spinlock.h>
|
---|
82 | #include <linux/slab.h>
|
---|
83 | #if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 27)
|
---|
84 | # include <linux/semaphore.h>
|
---|
85 | #else /* older kernels */
|
---|
86 | # include <asm/semaphore.h>
|
---|
87 | #endif /* older kernels */
|
---|
88 | #include <linux/module.h>
|
---|
89 | #if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 0)
|
---|
90 | # include <linux/moduleparam.h>
|
---|
91 | #endif
|
---|
92 | #include <linux/kernel.h>
|
---|
93 | #include <linux/init.h>
|
---|
94 | #include <linux/fs.h>
|
---|
95 | #if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 0)
|
---|
96 | # include <linux/namei.h>
|
---|
97 | #endif
|
---|
98 | #include <linux/mm.h>
|
---|
99 | #include <linux/pagemap.h>
|
---|
100 | #include <linux/slab.h>
|
---|
101 | #include <linux/time.h>
|
---|
102 | #include <linux/sched.h>
|
---|
103 | #if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 9, 0)
|
---|
104 | # include <linux/sched/rt.h>
|
---|
105 | #endif
|
---|
106 | #if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 11, 0)
|
---|
107 | # include <linux/sched/signal.h>
|
---|
108 | # include <linux/sched/types.h>
|
---|
109 | #endif
|
---|
110 | #if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 7)
|
---|
111 | # include <linux/jiffies.h>
|
---|
112 | #endif
|
---|
113 | #if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 16)
|
---|
114 | # include <linux/ktime.h>
|
---|
115 | # include <linux/hrtimer.h>
|
---|
116 | #endif
|
---|
117 | #include <linux/wait.h>
|
---|
118 | #if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 5, 71)
|
---|
119 | # include <linux/cpu.h>
|
---|
120 | # include <linux/notifier.h>
|
---|
121 | #endif
|
---|
122 | /* For the basic additions module */
|
---|
123 | #include <linux/pci.h>
|
---|
124 | #include <linux/delay.h>
|
---|
125 | #include <linux/interrupt.h>
|
---|
126 | #include <linux/completion.h>
|
---|
127 | #include <linux/compiler.h>
|
---|
128 | #ifndef HAVE_UNLOCKED_IOCTL /* linux/fs.h defines this */
|
---|
129 | # include <linux/smp_lock.h>
|
---|
130 | #endif
|
---|
131 | /* For the shared folders module */
|
---|
132 | #include <linux/vmalloc.h>
|
---|
133 | #define wchar_t linux_wchar_t
|
---|
134 | #include <linux/nls.h>
|
---|
135 | #undef wchar_t
|
---|
136 | #include <asm/mman.h>
|
---|
137 | #include <asm/io.h>
|
---|
138 | #include <asm/uaccess.h>
|
---|
139 | #include <asm/div64.h>
|
---|
140 |
|
---|
141 | /* For thread-context hooks. */
|
---|
142 | #if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 18) && defined(CONFIG_PREEMPT_NOTIFIERS)
|
---|
143 | # include <linux/preempt.h>
|
---|
144 | #endif
|
---|
145 |
|
---|
146 | /* for workqueue / task queues. */
|
---|
147 | #if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 5, 41)
|
---|
148 | # include <linux/workqueue.h>
|
---|
149 | #else
|
---|
150 | # include <linux/tqueue.h>
|
---|
151 | #endif
|
---|
152 |
|
---|
153 | #if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 0)
|
---|
154 | # include <linux/kthread.h>
|
---|
155 | #endif
|
---|
156 |
|
---|
157 | /* for cr4_init_shadow() / cpu_tlbstate. */
|
---|
158 | #if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 20, 0)
|
---|
159 | # include <asm/tlbflush.h>
|
---|
160 | #endif
|
---|
161 |
|
---|
162 | /* for set_pages_x() */
|
---|
163 | #if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 12, 0)
|
---|
164 | # include <asm/set_memory.h>
|
---|
165 | #endif
|
---|
166 |
|
---|
167 | #if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 7, 0)
|
---|
168 | # include <asm/smap.h>
|
---|
169 | #else
|
---|
170 | static inline void clac(void) { }
|
---|
171 | static inline void stac(void) { }
|
---|
172 | #endif
|
---|
173 |
|
---|
174 | #if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 0)
|
---|
175 | # ifndef page_to_pfn
|
---|
176 | # define page_to_pfn(page) ((page) - mem_map)
|
---|
177 | # endif
|
---|
178 | #endif
|
---|
179 |
|
---|
180 | #ifndef DEFINE_WAIT
|
---|
181 | # define DEFINE_WAIT(name) DECLARE_WAITQUEUE(name, current)
|
---|
182 | #endif
|
---|
183 |
|
---|
184 | #ifndef __GFP_NOWARN
|
---|
185 | # define __GFP_NOWARN 0
|
---|
186 | #endif
|
---|
187 |
|
---|
188 | /*
|
---|
189 | * 2.4 / early 2.6 compatibility wrappers
|
---|
190 | */
|
---|
191 | #if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 7)
|
---|
192 |
|
---|
193 | # ifndef MAX_JIFFY_OFFSET
|
---|
194 | # define MAX_JIFFY_OFFSET ((~0UL >> 1)-1)
|
---|
195 | # endif
|
---|
196 |
|
---|
197 | # if LINUX_VERSION_CODE < KERNEL_VERSION(2, 4, 29) || LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 0)
|
---|
198 |
|
---|
199 | DECLINLINE(unsigned int) jiffies_to_msecs(unsigned long cJiffies)
|
---|
200 | {
|
---|
201 | # if HZ <= 1000 && !(1000 % HZ)
|
---|
202 | return (1000 / HZ) * cJiffies;
|
---|
203 | # elif HZ > 1000 && !(HZ % 1000)
|
---|
204 | return (cJiffies + (HZ / 1000) - 1) / (HZ / 1000);
|
---|
205 | # else
|
---|
206 | return (cJiffies * 1000) / HZ;
|
---|
207 | # endif
|
---|
208 | }
|
---|
209 |
|
---|
210 | DECLINLINE(unsigned long) msecs_to_jiffies(unsigned int cMillies)
|
---|
211 | {
|
---|
212 | # if HZ > 1000
|
---|
213 | if (cMillies > jiffies_to_msecs(MAX_JIFFY_OFFSET))
|
---|
214 | return MAX_JIFFY_OFFSET;
|
---|
215 | # endif
|
---|
216 | # if HZ <= 1000 && !(1000 % HZ)
|
---|
217 | return (cMillies + (1000 / HZ) - 1) / (1000 / HZ);
|
---|
218 | # elif HZ > 1000 && !(HZ % 1000)
|
---|
219 | return cMillies * (HZ / 1000);
|
---|
220 | # else
|
---|
221 | return (cMillies * HZ + 999) / 1000;
|
---|
222 | # endif
|
---|
223 | }
|
---|
224 |
|
---|
225 | # endif /* < 2.4.29 || >= 2.6.0 */
|
---|
226 |
|
---|
227 | #endif /* < 2.6.7 */
|
---|
228 |
|
---|
229 | /*
|
---|
230 | * 2.4 compatibility wrappers
|
---|
231 | */
|
---|
232 | #if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 0)
|
---|
233 |
|
---|
234 | # define prepare_to_wait(q, wait, state) \
|
---|
235 | do { \
|
---|
236 | add_wait_queue(q, wait); \
|
---|
237 | set_current_state(state); \
|
---|
238 | } while (0)
|
---|
239 |
|
---|
240 | # define after_wait(wait) \
|
---|
241 | do { \
|
---|
242 | list_del_init(&(wait)->task_list); \
|
---|
243 | } while (0)
|
---|
244 |
|
---|
245 | # define finish_wait(q, wait) \
|
---|
246 | do { \
|
---|
247 | set_current_state(TASK_RUNNING); \
|
---|
248 | remove_wait_queue(q, wait); \
|
---|
249 | } while (0)
|
---|
250 |
|
---|
251 | #else /* >= 2.6.0 */
|
---|
252 |
|
---|
253 | # define after_wait(wait) do {} while (0)
|
---|
254 |
|
---|
255 | #endif /* >= 2.6.0 */
|
---|
256 |
|
---|
257 | /** @def TICK_NSEC
|
---|
258 | * The time between ticks in nsec */
|
---|
259 | #ifndef TICK_NSEC
|
---|
260 | # define TICK_NSEC (1000000000UL / HZ)
|
---|
261 | #endif
|
---|
262 |
|
---|
263 | /*
|
---|
264 | * This sucks soooo badly on x86! Why don't they export __PAGE_KERNEL_EXEC so PAGE_KERNEL_EXEC would be usable?
|
---|
265 | */
|
---|
266 | #if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 8) && defined(RT_ARCH_AMD64)
|
---|
267 | # define MY_PAGE_KERNEL_EXEC PAGE_KERNEL_EXEC
|
---|
268 | #elif LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 8) && defined(PAGE_KERNEL_EXEC) && defined(CONFIG_X86_PAE)
|
---|
269 | # ifdef __PAGE_KERNEL_EXEC
|
---|
270 | /* >= 2.6.27 */
|
---|
271 | # define MY_PAGE_KERNEL_EXEC __pgprot(boot_cpu_has(X86_FEATURE_PGE) ? __PAGE_KERNEL_EXEC | _PAGE_GLOBAL : __PAGE_KERNEL_EXEC)
|
---|
272 | # else
|
---|
273 | # define MY_PAGE_KERNEL_EXEC __pgprot(boot_cpu_has(X86_FEATURE_PGE) ? _PAGE_KERNEL_EXEC | _PAGE_GLOBAL : _PAGE_KERNEL_EXEC)
|
---|
274 | # endif
|
---|
275 | #else
|
---|
276 | # define MY_PAGE_KERNEL_EXEC PAGE_KERNEL
|
---|
277 | #endif
|
---|
278 |
|
---|
279 |
|
---|
280 | /*
|
---|
281 | * The redhat hack section.
|
---|
282 | * - The current hacks are for 2.4.21-15.EL only.
|
---|
283 | */
|
---|
284 | #ifndef NO_REDHAT_HACKS
|
---|
285 | /* accounting. */
|
---|
286 | # if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 0)
|
---|
287 | # ifdef VM_ACCOUNT
|
---|
288 | # define USE_RHEL4_MUNMAP
|
---|
289 | # endif
|
---|
290 | # endif
|
---|
291 |
|
---|
292 | /* backported remap_page_range. */
|
---|
293 | # if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 0)
|
---|
294 | # include <asm/tlb.h>
|
---|
295 | # ifdef tlb_vma /* probably not good enough... */
|
---|
296 | # define HAVE_26_STYLE_REMAP_PAGE_RANGE 1
|
---|
297 | # endif
|
---|
298 | # endif
|
---|
299 |
|
---|
300 | # ifndef RT_ARCH_AMD64
|
---|
301 | /* In 2.6.9-22.ELsmp we have to call change_page_attr() twice when changing
|
---|
302 | * the page attributes from PAGE_KERNEL to something else, because there appears
|
---|
303 | * to be a bug in one of the many patches that redhat applied.
|
---|
304 | * It should be safe to do this on less buggy linux kernels too. ;-)
|
---|
305 | */
|
---|
306 | # define MY_CHANGE_PAGE_ATTR(pPages, cPages, prot) \
|
---|
307 | do { \
|
---|
308 | if (pgprot_val(prot) != pgprot_val(PAGE_KERNEL)) \
|
---|
309 | change_page_attr(pPages, cPages, prot); \
|
---|
310 | change_page_attr(pPages, cPages, prot); \
|
---|
311 | } while (0)
|
---|
312 | # endif /* !RT_ARCH_AMD64 */
|
---|
313 | #endif /* !NO_REDHAT_HACKS */
|
---|
314 |
|
---|
315 | #ifndef MY_CHANGE_PAGE_ATTR
|
---|
316 | # ifdef RT_ARCH_AMD64 /** @todo This is a cheap hack, but it'll get around that 'else BUG();' in __change_page_attr(). */
|
---|
317 | # define MY_CHANGE_PAGE_ATTR(pPages, cPages, prot) \
|
---|
318 | do { \
|
---|
319 | change_page_attr(pPages, cPages, PAGE_KERNEL_NOCACHE); \
|
---|
320 | change_page_attr(pPages, cPages, prot); \
|
---|
321 | } while (0)
|
---|
322 | # else
|
---|
323 | # define MY_CHANGE_PAGE_ATTR(pPages, cPages, prot) change_page_attr(pPages, cPages, prot)
|
---|
324 | # endif
|
---|
325 | #endif
|
---|
326 |
|
---|
327 | #if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 25)
|
---|
328 | # define MY_SET_PAGES_EXEC(pPages, cPages) set_pages_x(pPages, cPages)
|
---|
329 | # define MY_SET_PAGES_NOEXEC(pPages, cPages) set_pages_nx(pPages, cPages)
|
---|
330 | #else
|
---|
331 | # define MY_SET_PAGES_EXEC(pPages, cPages) \
|
---|
332 | do { \
|
---|
333 | if (pgprot_val(MY_PAGE_KERNEL_EXEC) != pgprot_val(PAGE_KERNEL)) \
|
---|
334 | MY_CHANGE_PAGE_ATTR(pPages, cPages, MY_PAGE_KERNEL_EXEC); \
|
---|
335 | } while (0)
|
---|
336 | # define MY_SET_PAGES_NOEXEC(pPages, cPages) \
|
---|
337 | do { \
|
---|
338 | if (pgprot_val(MY_PAGE_KERNEL_EXEC) != pgprot_val(PAGE_KERNEL)) \
|
---|
339 | MY_CHANGE_PAGE_ATTR(pPages, cPages, PAGE_KERNEL); \
|
---|
340 | } while (0)
|
---|
341 | #endif
|
---|
342 |
|
---|
343 | /** @def ONE_MSEC_IN_JIFFIES
|
---|
344 | * The number of jiffies that make up 1 millisecond. Must be at least 1! */
|
---|
345 | #if HZ <= 1000
|
---|
346 | # define ONE_MSEC_IN_JIFFIES 1
|
---|
347 | #elif !(HZ % 1000)
|
---|
348 | # define ONE_MSEC_IN_JIFFIES (HZ / 1000)
|
---|
349 | #else
|
---|
350 | # define ONE_MSEC_IN_JIFFIES ((HZ + 999) / 1000)
|
---|
351 | # error "HZ is not a multiple of 1000, the GIP stuff won't work right!"
|
---|
352 | #endif
|
---|
353 |
|
---|
354 | /*
|
---|
355 | * Stop using the linux bool type.
|
---|
356 | */
|
---|
357 | #undef bool
|
---|
358 |
|
---|
359 | #if RT_GNUC_PREREQ(4, 6)
|
---|
360 | # pragma GCC diagnostic pop
|
---|
361 | #endif
|
---|
362 |
|
---|
363 | /*
|
---|
364 | * There are post-2.6.24 kernels (confusingly with unchanged version number)
|
---|
365 | * which eliminate macros which were marked as deprecated.
|
---|
366 | */
|
---|
367 | #ifndef __attribute_used__
|
---|
368 | #define __attribute_used__ __used
|
---|
369 | #endif
|
---|
370 |
|
---|
371 | /**
|
---|
372 | * Hack for shortening pointers on linux so we can stuff more stuff into the
|
---|
373 | * task_struct::comm field. This is used by the semaphore code but put here
|
---|
374 | * because we don't have any better place atm. Don't use outside IPRT, please.
|
---|
375 | */
|
---|
376 | #ifdef RT_ARCH_AMD64
|
---|
377 | # define IPRT_DEBUG_SEMS_ADDRESS(addr) ( ((long)(addr) & (long)~UINT64_C(0xfffffff000000000)) )
|
---|
378 | #else
|
---|
379 | # define IPRT_DEBUG_SEMS_ADDRESS(addr) ( (long)(addr) )
|
---|
380 | #endif
|
---|
381 |
|
---|
382 | /**
|
---|
383 | * Puts semaphore info into the task_struct::comm field if IPRT_DEBUG_SEMS is
|
---|
384 | * defined.
|
---|
385 | */
|
---|
386 | #ifdef IPRT_DEBUG_SEMS
|
---|
387 | # define IPRT_DEBUG_SEMS_STATE(pThis, chState) \
|
---|
388 | snprintf(current->comm, sizeof(current->comm), "%c%lx", (chState), IPRT_DEBUG_SEMS_ADDRESS(pThis));
|
---|
389 | #else
|
---|
390 | # define IPRT_DEBUG_SEMS_STATE(pThis, chState) do { } while (0)
|
---|
391 | #endif
|
---|
392 |
|
---|
393 | /**
|
---|
394 | * Puts semaphore info into the task_struct::comm field if IPRT_DEBUG_SEMS is
|
---|
395 | * defined.
|
---|
396 | */
|
---|
397 | #ifdef IPRT_DEBUG_SEMS
|
---|
398 | # define IPRT_DEBUG_SEMS_STATE_RC(pThis, chState, rc) \
|
---|
399 | snprintf(current->comm, sizeof(current->comm), "%c%lx:%d", (chState), IPRT_DEBUG_SEMS_ADDRESS(pThis), rc);
|
---|
400 | #else
|
---|
401 | # define IPRT_DEBUG_SEMS_STATE_RC(pThis, chState, rc) do { } while (0)
|
---|
402 | #endif
|
---|
403 |
|
---|
404 | /** @name Macros for preserving EFLAGS.AC on 3.19+/amd64 paranoid.
|
---|
405 | * The AMD 64 switch_to in macro in arch/x86/include/asm/switch_to.h stopped
|
---|
406 | * restoring flags.
|
---|
407 | * @{ */
|
---|
408 | #if defined(CONFIG_X86_SMAP) || defined(RT_STRICT) || defined(IPRT_WITH_EFLAGS_AC_PRESERVING)
|
---|
409 | # include <iprt/asm-amd64-x86.h>
|
---|
410 | # define IPRT_X86_EFL_AC RT_BIT(18)
|
---|
411 | # define IPRT_LINUX_SAVE_EFL_AC() RTCCUINTREG fSavedEfl = ASMGetFlags()
|
---|
412 | # define IPRT_LINUX_RESTORE_EFL_AC() ASMSetFlags(fSavedEfl)
|
---|
413 | # define IPRT_LINUX_RESTORE_EFL_ONLY_AC() ASMChangeFlags(~IPRT_X86_EFL_AC, fSavedEfl & IPRT_X86_EFL_AC)
|
---|
414 | #else
|
---|
415 | # define IPRT_LINUX_SAVE_EFL_AC() do { } while (0)
|
---|
416 | # define IPRT_LINUX_RESTORE_EFL_AC() do { } while (0)
|
---|
417 | # define IPRT_LINUX_RESTORE_EFL_ONLY_AC() do { } while (0)
|
---|
418 | #endif
|
---|
419 | /** @} */
|
---|
420 |
|
---|
421 | /*
|
---|
422 | * There are some conflicting defines in iprt/param.h, sort them out here.
|
---|
423 | */
|
---|
424 | #ifndef ___iprt_param_h
|
---|
425 | # undef PAGE_SIZE
|
---|
426 | # undef PAGE_OFFSET_MASK
|
---|
427 | # include <iprt/param.h>
|
---|
428 | #endif
|
---|
429 |
|
---|
430 | /*
|
---|
431 | * Some global indicator macros.
|
---|
432 | */
|
---|
433 | /** @def IPRT_LINUX_HAS_HRTIMER
|
---|
434 | * Whether the kernel support high resolution timers (Linux kernel versions
|
---|
435 | * 2.6.28 and later (hrtimer_add_expires_ns() & schedule_hrtimeout). */
|
---|
436 | #if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 28)
|
---|
437 | # define IPRT_LINUX_HAS_HRTIMER
|
---|
438 | #endif
|
---|
439 |
|
---|
440 | /*
|
---|
441 | * Workqueue stuff, see initterm-r0drv-linux.c.
|
---|
442 | */
|
---|
443 | #if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 5, 41)
|
---|
444 | typedef struct work_struct RTR0LNXWORKQUEUEITEM;
|
---|
445 | #else
|
---|
446 | typedef struct tq_struct RTR0LNXWORKQUEUEITEM;
|
---|
447 | #endif
|
---|
448 | DECLHIDDEN(void) rtR0LnxWorkqueuePush(RTR0LNXWORKQUEUEITEM *pWork, void (*pfnWorker)(RTR0LNXWORKQUEUEITEM *));
|
---|
449 | DECLHIDDEN(void) rtR0LnxWorkqueueFlush(void);
|
---|
450 |
|
---|
451 |
|
---|
452 | #endif
|
---|