Module: xenomai-forge
Branch: master
Commit: 0d1699696e6cef1b3903155e035fb787b901ccb7
URL:    
http://git.xenomai.org/?p=xenomai-forge.git;a=commit;h=0d1699696e6cef1b3903155e035fb787b901ccb7

Author: Philippe Gerum <r...@xenomai.org>
Date:   Mon Aug 20 12:02:47 2012 +0200

cobalt/x86: fix up for kernel 3.4 series

---

 include/asm-x86/bits/pod_32.h |    9 ++++++---
 include/asm-x86/bits/pod_64.h |    1 +
 include/asm-x86/hal_32.h      |    1 -
 include/asm-x86/hal_64.h      |    1 -
 include/asm-x86/wrappers.h    |    9 +++++++++
 5 files changed, 16 insertions(+), 5 deletions(-)

diff --git a/include/asm-x86/bits/pod_32.h b/include/asm-x86/bits/pod_32.h
index fb37682..48bd6c2 100644
--- a/include/asm-x86/bits/pod_32.h
+++ b/include/asm-x86/bits/pod_32.h
@@ -213,14 +213,17 @@ static inline void xnarch_restore_fpu(xnarchtcb_t * tcb)
        } else {
                /* Restore state of FPU only if TS bit in cr0 was clear. */
                if (tcb->cr0_ts) {
+                       wrap_clear_fpu_used(task);
                        stts();
                        return;
                }
 
                if (tcb->ts_usedfpu && !wrap_test_fpu_used(task)) {
-                       /* __switch_to saved the fpu context, no need to restore
-                          it since we are switching to root, where fpu can be
-                          in lazy state. */
+                       /*
+                        * __switch_to saved the fpu context, no need
+                        * to restore it since we are switching to
+                        * root, where fpu can be in lazy state.
+                        */
                        stts();
                        return;
                }
diff --git a/include/asm-x86/bits/pod_64.h b/include/asm-x86/bits/pod_64.h
index 546a4fa..8cb4ba8 100644
--- a/include/asm-x86/bits/pod_64.h
+++ b/include/asm-x86/bits/pod_64.h
@@ -255,6 +255,7 @@ static inline void xnarch_restore_fpu(xnarchtcb_t * tcb)
        } else {
                /* Restore state of FPU only if TS bit in cr0 was clear. */
                if (tcb->cr0_ts) {
+                       wrap_clear_fpu_used(task);
                        stts();
                        return;
                }
diff --git a/include/asm-x86/hal_32.h b/include/asm-x86/hal_32.h
index 1b00fcd..6dfdb55 100644
--- a/include/asm-x86/hal_32.h
+++ b/include/asm-x86/hal_32.h
@@ -74,7 +74,6 @@ static inline __attribute_const__ unsigned long ffnz(unsigned 
long ul)
 }
 
 #ifndef __cplusplus
-#include <asm/system.h>
 #include <asm/io.h>
 #include <asm/timex.h>
 #include <asm/processor.h>
diff --git a/include/asm-x86/hal_64.h b/include/asm-x86/hal_64.h
index ad42c12..96d20ae 100644
--- a/include/asm-x86/hal_64.h
+++ b/include/asm-x86/hal_64.h
@@ -43,7 +43,6 @@ static inline __attribute_const__ unsigned long ffnz(unsigned 
long ul)
 }
 
 #ifndef __cplusplus
-#include <asm/system.h>
 #include <asm/io.h>
 #include <asm/timex.h>
 #include <asm/processor.h>
diff --git a/include/asm-x86/wrappers.h b/include/asm-x86/wrappers.h
index 6e7d932..53ac607 100644
--- a/include/asm-x86/wrappers.h
+++ b/include/asm-x86/wrappers.h
@@ -30,6 +30,7 @@
 #define __get_user_inatomic __get_user
 #define __put_user_inatomic __put_user
 
+#if LINUX_VERSION_CODE < KERNEL_VERSION(3,4,0)
 #ifdef TS_USEDFPU
 
 #define wrap_test_fpu_used(task)                               \
@@ -58,6 +59,14 @@
        } while(0)
 
 #endif /* !defined(TS_USEDFPU) */
+#else /* Linux >= 3.4.0 */
+#include <asm/i387.h>
+#include <asm/fpu-internal.h>
+
+#define wrap_test_fpu_used(task) __thread_has_fpu(task)
+#define wrap_set_fpu_used(task) __thread_set_has_fpu(task)
+#define wrap_clear_fpu_used(task) __thread_clear_has_fpu(task)
+#endif /* Linux >= 3.4.0 */
 
 #define wrap_strncpy_from_user(dstP, srcP, n)          \
        rthal_strncpy_from_user(dstP, srcP, n)


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

Reply via email to