|
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-devel] [PATCH 5/5] Test harness for new printk formatting
---
xen/arch/x86/irq.c | 36 ++++++++++++++++++++++++++++++++++++
1 file changed, 36 insertions(+)
diff --git a/xen/arch/x86/irq.c b/xen/arch/x86/irq.c
index c2e5629..6a447ff 100644
--- a/xen/arch/x86/irq.c
+++ b/xen/arch/x86/irq.c
@@ -2485,3 +2485,39 @@ bool_t hvm_domain_use_pirq(const struct domain *d, const
struct pirq *pirq)
return is_hvm_domain(d) && pirq &&
pirq->arch.hvm.emuirq != IRQ_UNBOUND;
}
+
+static void test_printk(unsigned char key)
+{
+ char buffer[8] = { 0 };
+ char buffer2[3] = { 0 };
+
+ printk("In %s()\n", __func__);
+ printk("Some symbols: '%ps' '%pS'\n", _p(printk), _p(printk));
+ printk("More symbols: '%ps' '%pS'\n", _p(test_printk), _p(test_printk));
+ printk("Invalid: '%ps' '%pS'\n", _p(NULL), _p(NULL));
+ printk("Partial: '%ps' '%pS'\n", _p(((unsigned long)test_printk + 0x20)),
+ _p(((unsigned long)test_printk + 0x20)));
+
+ snprintf(buffer, sizeof buffer, "%pS", _p(test_printk));
+ printk("Test printing into 8 byte buffer '%s'\n", buffer);
+
+ snprintf(buffer, sizeof buffer, "%ps", _p(test_printk));
+ printk("Test printing into 8 byte buffer '%s'\n", buffer);
+
+ snprintf(buffer2, sizeof buffer2, "%ps",
+ _p(((unsigned long)test_printk + 0x20)));
+ printk("Test printing into 3 byte buffer '%s'\n", buffer2);
+}
+
+static struct keyhandler test_printk_keyhandler = {
+ .diagnostic = 1,
+ .u.fn = test_printk,
+ .desc = "Test new printk formatting options"
+};
+
+static int __init setup_test_printk(void)
+{
+ register_keyhandler('6', &test_printk_keyhandler);
+ return 0;
+}
+__initcall(setup_test_printk);
--
1.7.10.4
_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
http://lists.xen.org/xen-devel
|
![]() |
Lists.xenproject.org is hosted with RackSpace, monitoring our |