Module: xenomai-2.6
Branch: master
Commit: 7a6e4e1573518ea04681f5c12e8de170de2f2d8a
URL:    
http://git.xenomai.org/?p=xenomai-2.6.git;a=commit;h=7a6e4e1573518ea04681f5c12e8de170de2f2d8a

Author: Gilles Chanteperdrix <gilles.chanteperd...@xenomai.org>
Date:   Wed Jul 25 00:47:02 2012 +0200

hal/x86: adapt to I-pipe core patch for Linux 3.4

---

 include/asm-generic/wrappers.h |    4 ++++
 include/asm-x86/atomic.h       |    1 -
 include/asm-x86/bits/pod_32.h  |    4 +++-
 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_32.h  |    9 +++++++++
 include/asm-x86/wrappers_64.h  |    9 +++++++++
 ksrc/arch/generic/hal.c        |    1 -
 ksrc/arch/x86/hal_32.c         |    1 -
 ksrc/arch/x86/hal_64.c         |    1 -
 ksrc/nucleus/pipe.c            |    1 -
 12 files changed, 26 insertions(+), 8 deletions(-)

diff --git a/include/asm-generic/wrappers.h b/include/asm-generic/wrappers.h
index 3552e43..fb2a13d 100644
--- a/include/asm-generic/wrappers.h
+++ b/include/asm-generic/wrappers.h
@@ -33,6 +33,10 @@
 #endif /* CONFIG_XENO_OPT_HOSTRT || __IPIPE_FEATURE_REQUEST_TICKDEV */
 #include <asm/io.h>
 
+#if LINUX_VERSION_CODE < KERNEL_VERSION(3,4,0)
+#include <asm/system.h>
+#endif /* kernel < 3.4.0 */
+
 #if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,0)
 
 #include <linux/wrapper.h>
diff --git a/include/asm-x86/atomic.h b/include/asm-x86/atomic.h
index cc88de5..2c1f474 100644
--- a/include/asm-x86/atomic.h
+++ b/include/asm-x86/atomic.h
@@ -28,7 +28,6 @@ typedef unsigned long atomic_flags_t;
 
 #include <linux/bitops.h>
 #include <asm/atomic.h>
-#include <asm/system.h>
 #include <asm/xenomai/wrappers.h>
 
 #define xnarch_atomic_set(pcounter,i)  atomic_long_set(pcounter,i)
diff --git a/include/asm-x86/bits/pod_32.h b/include/asm-x86/bits/pod_32.h
index 500d4a5..4c401d0 100644
--- a/include/asm-x86/bits/pod_32.h
+++ b/include/asm-x86/bits/pod_32.h
@@ -236,11 +236,13 @@ 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)) {
+               if (tcb->ts_usedfpu 
+                   && wrap_test_fpu_used(task) == 0) {
                        /* __switch_to saved the fpu context, no need to restore
                           it since we are switching to root, where fpu can be
                           in lazy state. */
diff --git a/include/asm-x86/bits/pod_64.h b/include/asm-x86/bits/pod_64.h
index 772e009..5ee7022 100644
--- a/include/asm-x86/bits/pod_64.h
+++ b/include/asm-x86/bits/pod_64.h
@@ -260,6 +260,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 f61e2ec..f98efc8 100644
--- a/include/asm-x86/hal_32.h
+++ b/include/asm-x86/hal_32.h
@@ -76,7 +76,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 99a5b23..867f5ff 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_32.h b/include/asm-x86/wrappers_32.h
index 76a8189..2f1dcb9 100644
--- a/include/asm-x86/wrappers_32.h
+++ b/include/asm-x86/wrappers_32.h
@@ -93,6 +93,7 @@ typedef phys_addr_t resource_size_t;
                :"1" (addr),"g" ((int)(size)),"g" 
(task_thread_info(task)->addr_limit.seg)); \
        flag == 0; })
 
+#if LINUX_VERSION_CODE < KERNEL_VERSION(3,4,0)
 #ifdef TS_USEDFPU
 #define wrap_test_fpu_used(task)  \
    (task_thread_info(task)->status & TS_USEDFPU)
@@ -115,6 +116,14 @@ do { \
                (task)->thread.has_fpu = 0;     \
        } 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 */
 
 #if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,22)
 #define wrap_iobitmap_base(tss)  (tss)->io_bitmap_base
diff --git a/include/asm-x86/wrappers_64.h b/include/asm-x86/wrappers_64.h
index 1a06ecd..3c190f1 100644
--- a/include/asm-x86/wrappers_64.h
+++ b/include/asm-x86/wrappers_64.h
@@ -81,6 +81,7 @@ typedef union thread_xstate x86_fpustate;
 #define x86_fpustate_ptr(t) ((t)->fpu.state)
 #endif
 
+#if LINUX_VERSION_CODE < KERNEL_VERSION(3,4,0)
 #ifdef TS_USEDFPU
 #define wrap_test_fpu_used(task)  \
    (task_thread_info(task)->status & TS_USEDFPU)
@@ -103,6 +104,14 @@ do { \
                (task)->thread.has_fpu = 0;     \
        } 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 */
 
 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,34)
 #define per_cpu_var(var) (var)
diff --git a/ksrc/arch/generic/hal.c b/ksrc/arch/generic/hal.c
index a6eb752..6453f45 100644
--- a/ksrc/arch/generic/hal.c
+++ b/ksrc/arch/generic/hal.c
@@ -40,7 +40,6 @@
 #else
 #include <asm/hardirq.h>
 #endif
-#include <asm/system.h>
 #include <asm/irq.h>
 #include <asm/xenomai/hal.h>
 #include <stdarg.h>
diff --git a/ksrc/arch/x86/hal_32.c b/ksrc/arch/x86/hal_32.c
index 36affe6..1221065 100644
--- a/ksrc/arch/x86/hal_32.c
+++ b/ksrc/arch/x86/hal_32.c
@@ -44,7 +44,6 @@
 #include <linux/module.h>
 #include <linux/console.h>
 #include <linux/bitops.h>
-#include <asm/system.h>
 #include <asm/hardirq.h>
 #include <asm/desc.h>
 #include <asm/io.h>
diff --git a/ksrc/arch/x86/hal_64.c b/ksrc/arch/x86/hal_64.c
index 9c5c390..b0ef716 100644
--- a/ksrc/arch/x86/hal_64.c
+++ b/ksrc/arch/x86/hal_64.c
@@ -37,7 +37,6 @@
 #include <linux/module.h>
 #include <linux/console.h>
 #include <linux/bitops.h>
-#include <asm/system.h>
 #include <asm/hardirq.h>
 #include <asm/desc.h>
 #include <asm/io.h>
diff --git a/ksrc/nucleus/pipe.c b/ksrc/nucleus/pipe.c
index 064aa52..f6c80f1 100644
--- a/ksrc/nucleus/pipe.c
+++ b/ksrc/nucleus/pipe.c
@@ -29,7 +29,6 @@
 #include <linux/device.h>
 #include <asm/io.h>
 #include <asm/uaccess.h>
-#include <asm/system.h>
 #include <nucleus/pod.h>
 #include <nucleus/heap.h>
 #include <nucleus/pipe.h>


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

Reply via email to