Xenomai  3.1
wrappers.h
1 /*
2  * Copyright (C) 2005 Philippe Gerum <rpm@xenomai.org>.
3  *
4  * Xenomai is free software; you can redistribute it and/or modify
5  * it under the terms of the GNU General Public License as published
6  * by the Free Software Foundation; either version 2 of the License,
7  * or (at your option) any later version.
8  *
9  * Xenomai is distributed in the hope that it will be useful, but
10  * WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12  * General Public License for more details.
13  *
14  * You should have received a copy of the GNU General Public License
15  * along with Xenomai; if not, write to the Free Software
16  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
17  * 02111-1307, USA.
18  */
19 #ifndef _COBALT_X86_ASM_WRAPPERS_H
20 #define _COBALT_X86_ASM_WRAPPERS_H
21 
22 #include <asm-generic/xenomai/wrappers.h> /* Read the generic portion. */
23 
24 #define __get_user_inatomic __get_user
25 #define __put_user_inatomic __put_user
26 
27 #if LINUX_VERSION_CODE > KERNEL_VERSION(4,9,108) && \
28  LINUX_VERSION_CODE < KERNEL_VERSION(4,10,0)
29 #define IPIPE_X86_FPU_EAGER
30 #endif
31 #if LINUX_VERSION_CODE > KERNEL_VERSION(4,4,137) && \
32  LINUX_VERSION_CODE < KERNEL_VERSION(4,5,0)
33 #define IPIPE_X86_FPU_EAGER
34 #endif
35 #if LINUX_VERSION_CODE >= KERNEL_VERSION(4,14,0)
36 #define IPIPE_X86_FPU_EAGER
37 #endif
38 
39 
40 #if LINUX_VERSION_CODE < KERNEL_VERSION(4,2,0)
41 #include <asm/i387.h>
42 #include <asm/fpu-internal.h>
43 #else
44 #include <asm/fpu/internal.h>
45 #endif
46 
47 #if LINUX_VERSION_CODE < KERNEL_VERSION(4,0,0)
48 
49 static inline void kernel_fpu_disable(void)
50 {
51  __thread_clear_has_fpu(current);
52 }
53 
54 static inline void kernel_fpu_enable(void)
55 {
56 }
57 
58 static inline bool kernel_fpu_disabled(void)
59 {
60  return __thread_has_fpu(current) == 0 && (read_cr0() & X86_CR0_TS) == 0;
61 }
62 #endif /* linux < 4.1.0 */
63 
64 #endif /* _COBALT_X86_ASM_WRAPPERS_H */