From: Andi Kleen <a...@linux.intel.com>

May be removed later, but useful for basic sanity checking.

Signed-off-by: Andi Kleen <a...@linux.intel.com>
---
 arch/x86/kernel/Makefile   |    2 ++
 arch/x86/kernel/rtm-test.c |   22 ++++++++++++++++++++++
 2 files changed, 24 insertions(+), 0 deletions(-)
 create mode 100644 arch/x86/kernel/rtm-test.c

diff --git a/arch/x86/kernel/Makefile b/arch/x86/kernel/Makefile
index 7bd3bd3..f46aebd 100644
--- a/arch/x86/kernel/Makefile
+++ b/arch/x86/kernel/Makefile
@@ -114,3 +114,5 @@ ifeq ($(CONFIG_X86_64),y)
        obj-$(CONFIG_PCI_MMCONFIG)      += mmconf-fam10h_64.o
        obj-y                           += vsmp_64.o
 endif
+
+obj-y                                  += rtm-test.o
diff --git a/arch/x86/kernel/rtm-test.c b/arch/x86/kernel/rtm-test.c
new file mode 100644
index 0000000..5e138c1
--- /dev/null
+++ b/arch/x86/kernel/rtm-test.c
@@ -0,0 +1,22 @@
+#include <asm/rtm.h>
+#include <linux/init.h>
+#include <linux/kernel.h>
+
+int x;
+
+static __init int rtm_test(void)
+{
+       unsigned status;
+
+       pr_info("simple rtm test\n");
+       if ((status = _xbegin()) == _XBEGIN_STARTED) {
+               x++;
+               _xend();
+               pr_info("transaction committed\n");
+       } else {
+               pr_info("transaction aborted %x\n", status);
+       }
+       return 0;
+}
+
+device_initcall(rtm_test);
-- 
1.7.7.6

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Reply via email to