Module: xenomai-gch
Branch: for-2.4
Commit: 0eb56df1398bb2d3f780ee8114deb632b8315e83
URL:    
http://git.xenomai.org/?p=xenomai-gch.git;a=commit;h=0eb56df1398bb2d3f780ee8114deb632b8315e83

Author: Philippe Gerum <r...@xenomai.org>
Date:   Thu Dec 31 17:02:25 2009 +0100

x86: fix build of NMI watchdog support

---

 ksrc/arch/x86/hal_32.c |   10 +++++++---
 ksrc/arch/x86/nmi_32.c |   16 ++++++++++++++++
 2 files changed, 23 insertions(+), 3 deletions(-)

diff --git a/ksrc/arch/x86/hal_32.c b/ksrc/arch/x86/hal_32.c
index e8e1258..79b7c83 100644
--- a/ksrc/arch/x86/hal_32.c
+++ b/ksrc/arch/x86/hal_32.c
@@ -107,7 +107,7 @@ extern void show_registers(struct pt_regs *regs);
 
 extern spinlock_t nmi_print_lock;
 
-void die_nmi(struct pt_regs *regs, const char *msg)
+void die_nmi(const char *msg, struct pt_regs *regs, int do_panic)
 {
        spin_lock(&nmi_print_lock);
        /*
@@ -124,7 +124,11 @@ void die_nmi(struct pt_regs *regs, const char *msg)
        do_exit(SIGSEGV);
 }
 
-#endif /* Linux < 2.6 */
+#elif LINUX_VERSION_CODE < KERNEL_VERSION(2,6,27)
+#define die_nmi(msg, regs, do_panic)   die_nmi(regs, msg)
+#else /* Linux >= 2.6.27 */
+#include <asm/nmi.h>
+#endif /* Linux >= 2.6.27 */
 
 void rthal_latency_above_max(struct pt_regs *regs)
 {
@@ -136,7 +140,7 @@ void rthal_latency_above_max(struct pt_regs *regs)
                         sizeof(buf),
                         "NMI watchdog detected timer latency above %u us\n",
                         rthal_maxlat_us);
-               die_nmi(regs, buf);
+               die_nmi(buf, regs, 1);
        }
 }
 
diff --git a/ksrc/arch/x86/nmi_32.c b/ksrc/arch/x86/nmi_32.c
index bbe3226..5e4bbed 100644
--- a/ksrc/arch/x86/nmi_32.c
+++ b/ksrc/arch/x86/nmi_32.c
@@ -29,7 +29,23 @@
 #include <linux/version.h>
 #include <linux/nmi.h>
 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0)
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,32)
+#include <asm/perf_event.h>
+#elif LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,31)
+#include <asm/perf_counter.h>
+#elif LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,19)
+#include <asm/intel_arch_perfmon.h>
+#else /* Linux < 2.6.19 */
 #include <asm/nmi.h>
+#endif /* Linux < 2.6.19 */
+#else /* Linux < 2.6 */
+#define X86_FEATURE_ARCH_PERFMON (3*32+11) /* Intel Architecture PerfMon */
+#define rdmsrl(reg, val)                                       \
+       ({                                                      \
+               unsigned val1, val2;                            \
+               rdmsr(reg, val1, val2);                         \
+               asm ( "": "=A"(val) : "a"(val1), "d"(val2));    \
+       })
 #endif /* Linux < 2.6 */
 #include <asm/msr.h>
 #include <asm/xenomai/hal.h>


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

Reply via email to