diff options
author | Jeremy Fitzhardinge <jeremy@goop.org> | 2008-05-26 18:30:59 -0400 |
---|---|---|
committer | Thomas Gleixner <tglx@linutronix.de> | 2008-05-27 04:11:35 -0400 |
commit | 0acf10d8fbd52926217d3933d196b33fe2468f18 (patch) | |
tree | 938555cc132ffb6ad3bc242e09dc7497a6040007 | |
parent | 3843fc2575e3389f4f0ad0420a720240a5746a5d (diff) |
xen: add raw console write functions for debug
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>
-rw-r--r-- | drivers/char/hvc_xen.c | 26 | ||||
-rw-r--r-- | include/xen/hvc-console.h | 3 |
2 files changed, 29 insertions, 0 deletions
diff --git a/drivers/char/hvc_xen.c b/drivers/char/hvc_xen.c index dd68f8541c2d..e97d9d168325 100644 --- a/drivers/char/hvc_xen.c +++ b/drivers/char/hvc_xen.c | |||
@@ -157,3 +157,29 @@ struct console xenboot_console = { | |||
157 | .write = xenboot_write_console, | 157 | .write = xenboot_write_console, |
158 | .flags = CON_PRINTBUFFER | CON_BOOT, | 158 | .flags = CON_PRINTBUFFER | CON_BOOT, |
159 | }; | 159 | }; |
160 | |||
161 | void xen_raw_console_write(const char *str) | ||
162 | { | ||
163 | int len = strlen(str); | ||
164 | |||
165 | while(len > 0) { | ||
166 | int rc = HYPERVISOR_console_io(CONSOLEIO_write, len, (char *)str); | ||
167 | if (rc <= 0) | ||
168 | break; | ||
169 | |||
170 | str += rc; | ||
171 | len -= rc; | ||
172 | } | ||
173 | } | ||
174 | |||
175 | void xen_raw_printk(const char *fmt, ...) | ||
176 | { | ||
177 | static char buf[512]; | ||
178 | va_list ap; | ||
179 | |||
180 | va_start(ap, fmt); | ||
181 | vsnprintf(buf, sizeof(buf), fmt, ap); | ||
182 | va_end(ap); | ||
183 | |||
184 | xen_raw_console_write(buf); | ||
185 | } | ||
diff --git a/include/xen/hvc-console.h b/include/xen/hvc-console.h index 21c0ecfd786d..efc3237ab990 100644 --- a/include/xen/hvc-console.h +++ b/include/xen/hvc-console.h | |||
@@ -3,4 +3,7 @@ | |||
3 | 3 | ||
4 | extern struct console xenboot_console; | 4 | extern struct console xenboot_console; |
5 | 5 | ||
6 | void xen_raw_console_write(const char *str); | ||
7 | void xen_raw_printk(const char *fmt, ...); | ||
8 | |||
6 | #endif /* XEN_HVC_CONSOLE_H */ | 9 | #endif /* XEN_HVC_CONSOLE_H */ |