Skip to content

Commit

Permalink
xen: add raw console write functions for debug
Browse files Browse the repository at this point in the history
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 <[email protected]>
Signed-off-by: Thomas Gleixner <[email protected]>
  • Loading branch information
jsgf authored and KAGA-KOKO committed May 27, 2008
1 parent 3843fc2 commit 0acf10d
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 0 deletions.
26 changes: 26 additions & 0 deletions drivers/char/hvc_xen.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
3 changes: 3 additions & 0 deletions include/xen/hvc-console.h
Original file line number Diff line number Diff line change
Expand Up @@ -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 */

0 comments on commit 0acf10d

Please sign in to comment.