]> git.proxmox.com Git - mirror_ubuntu-artful-kernel.git/commitdiff
xen: add raw console write functions for debug
authorJeremy Fitzhardinge <jeremy@goop.org>
Mon, 26 May 2008 22:30:59 +0000 (23:30 +0100)
committerThomas Gleixner <tglx@linutronix.de>
Tue, 27 May 2008 08:11:35 +0000 (10:11 +0200)
Add a couple of functions which can write directly to the Xen console
for debugging.  This output ends up on the host's dom0 console
(assuming it allows the domain to write there).

Signed-off-by: Jeremy Fitzhardinge <jeremy.fitzhardinge@citrix.com>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
drivers/char/hvc_xen.c
include/xen/hvc-console.h

index dd68f8541c2dc4f13c26943607b8574e379bbbc8..e97d9d1683255d64add3dc4d529d642deee57681 100644 (file)
@@ -157,3 +157,29 @@ struct console xenboot_console = {
        .write          = xenboot_write_console,
        .flags          = CON_PRINTBUFFER | CON_BOOT,
 };
+
+void xen_raw_console_write(const char *str)
+{
+       int len = strlen(str);
+
+       while(len > 0) {
+               int rc = HYPERVISOR_console_io(CONSOLEIO_write, len, (char *)str);
+               if (rc <= 0)
+                       break;
+
+               str += rc;
+               len -= rc;
+       }
+}
+
+void xen_raw_printk(const char *fmt, ...)
+{
+       static char buf[512];
+       va_list ap;
+
+       va_start(ap, fmt);
+       vsnprintf(buf, sizeof(buf), fmt, ap);
+       va_end(ap);
+
+       xen_raw_console_write(buf);
+}
index 21c0ecfd786d7a399994838252c99f7fdc6b99c3..efc3237ab990b7cc67ad72868c3222a6bd272a3f 100644 (file)
@@ -3,4 +3,7 @@
 
 extern struct console xenboot_console;
 
+void xen_raw_console_write(const char *str);
+void xen_raw_printk(const char *fmt, ...);
+
 #endif /* XEN_HVC_CONSOLE_H */