Module: xenomai-gch
Branch: for-forge
Commit: 036d57b82ee242b92dee76c64d802904c87db956
URL:    
http://git.xenomai.org/?p=xenomai-gch.git;a=commit;h=036d57b82ee242b92dee76c64d802904c87db956

Author: Gilles Chanteperdrix <gilles.chanteperd...@xenomai.org>
Date:   Fri Oct 25 20:16:47 2013 +0200

cobalt/fpu: change xnarch_handle_fpu_fault interface

Pass the current FPU holder to allow enabling XNFPU dynamically.
Also pass the faults information for architectures which need to fiddle
with the PC register to restart the faulting instruction.

---

 kernel/cobalt/arch/arm/include/asm/xenomai/thread.h      |    4 +++-
 kernel/cobalt/arch/blackfin/include/asm/xenomai/thread.h |    4 +++-
 kernel/cobalt/arch/nios2/include/asm/xenomai/thread.h    |    4 +++-
 kernel/cobalt/arch/powerpc/include/asm/xenomai/thread.h  |    4 +++-
 kernel/cobalt/arch/sh/include/asm/xenomai/thread.h       |    4 +++-
 kernel/cobalt/arch/x86/include/asm/xenomai/thread.h      |    7 +++++--
 kernel/cobalt/arch/x86/thread.c                          |    3 ++-
 kernel/cobalt/shadow.c                                   |    4 +++-
 8 files changed, 25 insertions(+), 9 deletions(-)

diff --git a/kernel/cobalt/arch/arm/include/asm/xenomai/thread.h 
b/kernel/cobalt/arch/arm/include/asm/xenomai/thread.h
index 8b54b97..8c42775 100644
--- a/kernel/cobalt/arch/arm/include/asm/xenomai/thread.h
+++ b/kernel/cobalt/arch/arm/include/asm/xenomai/thread.h
@@ -124,7 +124,9 @@ static inline void xnarch_leave_root(struct xnthread *root) 
{ }
 
 #endif /* !CONFIG_XENO_HW_FPU */
 
-static inline int xnarch_handle_fpu_fault(struct xnthread *thread)
+static inline int 
+xnarch_handle_fpu_fault(struct xnthread *from, 
+                       struct xnthread *to, struct ipipe_trap_data *d)
 {
        return 0;
 }
diff --git a/kernel/cobalt/arch/blackfin/include/asm/xenomai/thread.h 
b/kernel/cobalt/arch/blackfin/include/asm/xenomai/thread.h
index 601fc4b..6c630e7 100644
--- a/kernel/cobalt/arch/blackfin/include/asm/xenomai/thread.h
+++ b/kernel/cobalt/arch/blackfin/include/asm/xenomai/thread.h
@@ -62,7 +62,9 @@ static inline void xnarch_enable_fpu(struct xnthread 
*current_thread) { }
 static inline void xnarch_save_fpu(struct xnthread *thread) { }
 static inline void xnarch_restore_fpu(struct xnthread *thread) { }
 
-static inline int xnarch_handle_fpu_fault(struct xnthread *thread)
+static inline int 
+xnarch_handle_fpu_fault(struct xnthread *from, 
+                       struct xnthread *to, struct ipipe_trap_data *d)
 {
        return 0;
 }
diff --git a/kernel/cobalt/arch/nios2/include/asm/xenomai/thread.h 
b/kernel/cobalt/arch/nios2/include/asm/xenomai/thread.h
index 775b92a..05de3c2 100644
--- a/kernel/cobalt/arch/nios2/include/asm/xenomai/thread.h
+++ b/kernel/cobalt/arch/nios2/include/asm/xenomai/thread.h
@@ -57,7 +57,9 @@ static inline void xnarch_enable_fpu(struct xnthread *thread) 
{ }
 static inline void xnarch_save_fpu(struct xnthread *thread) { }
 static inline void xnarch_restore_fpu(struct xnthread *thread) { }
 
-static inline int xnarch_handle_fpu_fault(struct xnthread *thread)
+static inline int 
+xnarch_handle_fpu_fault(struct xnthread *from, 
+                       struct xnthread *to, struct ipipe_trap_data *d)
 {
        return 0;
 }
diff --git a/kernel/cobalt/arch/powerpc/include/asm/xenomai/thread.h 
b/kernel/cobalt/arch/powerpc/include/asm/xenomai/thread.h
index 07a17cf..7504fba 100644
--- a/kernel/cobalt/arch/powerpc/include/asm/xenomai/thread.h
+++ b/kernel/cobalt/arch/powerpc/include/asm/xenomai/thread.h
@@ -77,7 +77,9 @@ static inline void xnarch_init_shadow_tcb(struct xnthread 
*thread) { }
 
 #endif  /* !CONFIG_XENO_HW_FPU */
 
-static inline int xnarch_handle_fpu_fault(struct xnthread *thread)
+static inline int 
+xnarch_handle_fpu_fault(struct xnthread *from, 
+                       struct xnthread *to, struct ipipe_trap_data *d)
 {
        return 0;
 }
diff --git a/kernel/cobalt/arch/sh/include/asm/xenomai/thread.h 
b/kernel/cobalt/arch/sh/include/asm/xenomai/thread.h
index 2c7fe88..9a78124 100644
--- a/kernel/cobalt/arch/sh/include/asm/xenomai/thread.h
+++ b/kernel/cobalt/arch/sh/include/asm/xenomai/thread.h
@@ -70,7 +70,9 @@ static inline void xnarch_init_shadow_tcb(struct xnthread 
*thread) { }
 
 #endif /* !CONFIG_XENO_HW_FPU */
 
-static inline int xnarch_handle_fpu_fault(struct xnthread *thread)
+static inline int 
+xnarch_handle_fpu_fault(struct xnthread *from, 
+                       struct xnthread *to, struct ipipe_trap_data *d)
 {
        return 0;
 }
diff --git a/kernel/cobalt/arch/x86/include/asm/xenomai/thread.h 
b/kernel/cobalt/arch/x86/include/asm/xenomai/thread.h
index 570d9b5..938b25d 100644
--- a/kernel/cobalt/arch/x86/include/asm/xenomai/thread.h
+++ b/kernel/cobalt/arch/x86/include/asm/xenomai/thread.h
@@ -69,7 +69,8 @@ static inline int xnarch_shadow_p(struct xnarchtcb *tcb, 
struct task_struct *tas
 void xnarch_save_fpu(struct xnthread *thread);
 void xnarch_restore_fpu(struct xnthread *thread);
 void xnarch_enable_fpu(struct xnthread *thread);
-int xnarch_handle_fpu_fault(struct xnthread *thread);
+int xnarch_handle_fpu_fault(struct xnthread *from, 
+                       struct xnthread *to, struct ipipe_trap_data *d);
 
 #else /* !CONFIG_XENO_HW_FPU */
 
@@ -77,7 +78,9 @@ static inline void xnarch_save_fpu(struct xnthread *thread) { 
}
 static inline void xnarch_restore_fpu(struct xnthread *thread) { }
 static inline void xnarch_enable_fpu(struct xnthread *thread) { }
 
-static inline int xnarch_handle_fpu_fault(struct xnthread *thread)
+static inline int
+xnarch_handle_fpu_fault(struct xnthread *from, 
+                       struct xnthread *to, struct ipipe_trap_data *d)
 {
        return 0;
 }
diff --git a/kernel/cobalt/arch/x86/thread.c b/kernel/cobalt/arch/x86/thread.c
index c2c0aba..f262ebf 100644
--- a/kernel/cobalt/arch/x86/thread.c
+++ b/kernel/cobalt/arch/x86/thread.c
@@ -219,7 +219,8 @@ static inline void __do_restore_i387(x86_fpustate *fpup)
 #endif /* CONFIG_X86_64 */
 }
 
-int xnarch_handle_fpu_fault(struct xnthread *thread)
+int xnarch_handle_fpu_fault(struct xnthread *from, 
+                       struct xnthread *to, struct ipipe_trap_data *d)
 {
        struct xnarchtcb *tcb = xnthread_archtcb(to);
        struct task_struct *p = tcb->core.host_task;
diff --git a/kernel/cobalt/shadow.c b/kernel/cobalt/shadow.c
index c858777..148bdc6 100644
--- a/kernel/cobalt/shadow.c
+++ b/kernel/cobalt/shadow.c
@@ -2607,11 +2607,13 @@ static inline int handle_exception(struct 
ipipe_trap_data *d)
                   xnarch_fault_trap(d));
 
        if (xnarch_fault_fpu_p(d)) {
+#ifdef CONFIG_XENO_HW_FPU
                /* FPU exception received in primary mode. */
-               if (xnarch_handle_fpu_fault(thread)) {
+               if (xnarch_handle_fpu_fault(sched->fpuholder, thread, d)) {
                        sched->fpuholder = thread;
                        return 1;
                }
+#endif /* CONFIG_XENO_HW_FPU */
                print_symbol("invalid use of FPU in Xenomai context at %s\n",
                             xnarch_fault_pc(d));
        }


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

Reply via email to