Module: xenomai-3
Branch: stable-3.0.x
Commit: 1e1f31743865b78e3aa7285b46bb6c0923d56768
URL:    
http://git.xenomai.org/?p=xenomai-3.git;a=commit;h=1e1f31743865b78e3aa7285b46bb6c0923d56768

Author: Philippe Gerum <r...@xenomai.org>
Date:   Tue May  2 10:18:00 2017 +0200

cobalt/x86: fixups for kernel 4.6+

---

 kernel/cobalt/arch/x86/include/asm/xenomai/syscall32.h |    4 ++--
 kernel/cobalt/arch/x86/thread.c                        |   12 +++++++++++-
 kernel/cobalt/include/asm-generic/xenomai/wrappers.h   |    4 ++++
 3 files changed, 17 insertions(+), 3 deletions(-)

diff --git a/kernel/cobalt/arch/x86/include/asm/xenomai/syscall32.h 
b/kernel/cobalt/arch/x86/include/asm/xenomai/syscall32.h
index 4fc1be8..35a7b0d 100644
--- a/kernel/cobalt/arch/x86/include/asm/xenomai/syscall32.h
+++ b/kernel/cobalt/arch/x86/include/asm/xenomai/syscall32.h
@@ -98,13 +98,13 @@
 #define __COBALT_SYSNR32emu(__reg)                                     \
        ({                                                              \
                long __nr = __reg;                                      \
-               if (current_thread_info()->status & TS_COMPAT)          \
+               if (in_ia32_syscall())                                  \
                        __nr += __COBALT_IA32_BASE;                     \
                __nr;                                                   \
        })
 
 #define __COBALT_COMPAT32emu(__reg)                                    \
-       ((current_thread_info()->status & TS_COMPAT) ? __COBALT_COMPAT_BIT : 0)
+       (in_ia32_syscall() ? __COBALT_COMPAT_BIT : 0)
 
 #if __NR_COBALT_SYSCALLS > __COBALT_IA32_BASE
 #error "__NR_COBALT_SYSCALLS > __COBALT_IA32_BASE"
diff --git a/kernel/cobalt/arch/x86/thread.c b/kernel/cobalt/arch/x86/thread.c
index 9e1dea2..256fa86 100644
--- a/kernel/cobalt/arch/x86/thread.c
+++ b/kernel/cobalt/arch/x86/thread.c
@@ -28,6 +28,16 @@
 
 static struct kmem_cache *xstate_cache;
 
+#if LINUX_VERSION_CODE < KERNEL_VERSION(4,7,0)
+#define fpu_kernel_xstate_size xstate_size
+#endif
+
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(4,6,0)
+#define cpu_has_xmm boot_cpu_has(X86_FEATURE_XMM)
+#define cpu_has_fxsr boot_cpu_has(X86_FEATURE_FXSR)
+#define cpu_has_xsave boot_cpu_has(X86_FEATURE_XSAVE)
+#endif
+
 #if LINUX_VERSION_CODE < KERNEL_VERSION(4,2,0)
 #include <asm/i387.h>
 #include <asm/fpu-internal.h>
@@ -461,7 +471,7 @@ void xnarch_init_shadow_tcb(struct xnthread *thread)
 int mach_x86_thread_init(void)
 {
        xstate_cache = kmem_cache_create("cobalt_x86_xstate",
-                                        xstate_size,
+                                        fpu_kernel_xstate_size,
                                         x86_xstate_alignment,
                                         SLAB_NOTRACK, NULL);
        if (xstate_cache == NULL)
diff --git a/kernel/cobalt/include/asm-generic/xenomai/wrappers.h 
b/kernel/cobalt/include/asm-generic/xenomai/wrappers.h
index 0f9ab14..c9e6e87 100644
--- a/kernel/cobalt/include/asm-generic/xenomai/wrappers.h
+++ b/kernel/cobalt/include/asm-generic/xenomai/wrappers.h
@@ -38,6 +38,10 @@
  *   symbol, so that obsolete wrappers can be spotted.
  */
 
+#if LINUX_VERSION_CODE < KERNEL_VERSION(4,6,0)
+#define in_ia32_syscall() (current_thread_info()->status & TS_COMPAT)
+#endif
+
 #if LINUX_VERSION_CODE < KERNEL_VERSION(3,19,0)
 #define user_msghdr msghdr
 #endif


_______________________________________________
Xenomai-git mailing list
Xenomai-git@xenomai.org
https://xenomai.org/mailman/listinfo/xenomai-git

Reply via email to