Xenomai  3.0.5
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,2,0)
28 #include <asm/i387.h>
29 #include <asm/fpu-internal.h>
30 #else
31 #include <asm/fpu/internal.h>
32 #endif
33 
34 #if LINUX_VERSION_CODE < KERNEL_VERSION(4,0,0)
35 
36 static inline void kernel_fpu_disable(void)
37 {
38  __thread_clear_has_fpu(current);
39 }
40 
41 static inline void kernel_fpu_enable(void)
42 {
43 }
44 
45 static inline bool kernel_fpu_disabled(void)
46 {
47  return __thread_has_fpu(current) == 0 && (read_cr0() & X86_CR0_TS) == 0;
48 }
49 #endif /* linux < 4.1.0 */
50 
51 #endif /* _COBALT_X86_ASM_WRAPPERS_H */