[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-devel] [PATCH 3/3] DO NOT APPLY - test code for this series



---
 xen/arch/x86/traps.c        |   66 +++++++++++++++++++++++++++++++++++++++++++
 xen/arch/x86/x86_64/entry.S |   26 +++++++++++++++++
 2 files changed, 92 insertions(+)

diff --git a/xen/arch/x86/traps.c b/xen/arch/x86/traps.c
index 22cdfc4..c562842 100644
--- a/xen/arch/x86/traps.c
+++ b/xen/arch/x86/traps.c
@@ -3981,6 +3981,72 @@ void asm_domain_crash_synchronous(unsigned long addr)
     __domain_crash_synchronous();
 }
 
+#include <xen/keyhandler.h>
+
+void asm_test_warnframe(void);
+void asm_test_bugframe(void);
+void asm_test_assertframe(void);
+void asm_test_assert_enabled(void);
+void asm_test_assert_disabled(void);
+
+static void do_extreme_debug(unsigned char key, struct cpu_user_regs *regs)
+{
+    printk("'%c' pressed -> Extreme debugging in progress...\n", key);
+
+    switch ( key )
+    {
+    case '1':
+        printk("WARN frame:\n");
+        asm_test_warnframe();
+        printk("Done\n");
+        break;
+
+    case '2':
+        printk("BUG frame:\n");
+        asm_test_bugframe();
+        printk("Done\n");
+        break;
+
+    case '3':
+        printk("ASSERT frame:\n");
+        asm_test_assertframe();
+        printk("Done\n");
+        break;
+
+    case '4':
+        printk("Trip ASSERT_IRQ_ENABLED:\n");
+        asm_test_assert_enabled();
+        printk("Done\n");
+        break;
+
+    case '5':
+        printk("Trip ASSERT_IRQ_DISABLED:\n");
+        asm_test_assert_disabled();
+        printk("Done\n");
+        break;
+
+    default:
+        printk("Nothing\n");
+    }
+}
+
+static struct keyhandler extreme_debug_keyhandler = {
+    .irq_callback = 1,
+    .u.irq_fn = do_extreme_debug,
+    .desc = "Extreme debugging"
+};
+
+static int __init extreme_debug_keyhandler_init(void)
+{
+    register_keyhandler('1', &extreme_debug_keyhandler);
+    register_keyhandler('2', &extreme_debug_keyhandler);
+    register_keyhandler('3', &extreme_debug_keyhandler);
+    register_keyhandler('4', &extreme_debug_keyhandler);
+    register_keyhandler('5', &extreme_debug_keyhandler);
+    return 0;
+}
+__initcall(extreme_debug_keyhandler_init);
+
 /*
  * Local variables:
  * mode: C
diff --git a/xen/arch/x86/x86_64/entry.S b/xen/arch/x86/x86_64/entry.S
index 2d25d57..233483b 100644
--- a/xen/arch/x86/x86_64/entry.S
+++ b/xen/arch/x86/x86_64/entry.S
@@ -13,6 +13,32 @@
 #include <public/xen.h>
 #include <irq_vectors.h>
 
+ENTRY(asm_test_warnframe)
+        WARN()
+        ret
+
+ENTRY(asm_test_bugframe)
+        BUG()
+        ret
+
+ENTRY(asm_test_assertframe)
+       ASSERT_FAILED("asm assert frame")
+       ret
+
+ENTRY(asm_test_assert_enabled)
+        pushfq
+        cli
+       ASSERT_INTERRUPTS_ENABLED
+        popfq
+       ret
+
+ENTRY(asm_test_assert_disabled)
+        pushfq
+        sti
+       ASSERT_INTERRUPTS_DISABLED
+        popfq
+       ret
+
         ALIGN
 /* %rbx: struct vcpu */
 switch_to_kernel:
-- 
1.7.10.4


_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
http://lists.xen.org/xen-devel


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.