Date: Thu, 21 Jun 2012 16:21:31 +0000 (UTC) From: Attilio Rao <attilio@FreeBSD.org> To: src-committers@freebsd.org, svn-src-projects@freebsd.org Subject: svn commit: r237403 - in projects/amd64_xen_pv/sys: amd64/include/xen amd64/xen kern Message-ID: <201206211621.q5LGLVGU023575@svn.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: attilio Date: Thu Jun 21 16:21:31 2012 New Revision: 237403 URL: http://svn.freebsd.org/changeset/base/237403 Log: Until console is not working, redirect the output of panic on the emergency console. This is a bit hackish as it uses an MD interface on MI directly, but this code is thought to be removed soon anyway. Reviewed by: cherry Modified: projects/amd64_xen_pv/sys/amd64/include/xen/xen-os.h projects/amd64_xen_pv/sys/amd64/xen/machdep.c projects/amd64_xen_pv/sys/kern/kern_shutdown.c Modified: projects/amd64_xen_pv/sys/amd64/include/xen/xen-os.h ============================================================================== --- projects/amd64_xen_pv/sys/amd64/include/xen/xen-os.h Thu Jun 21 15:47:06 2012 (r237402) +++ projects/amd64_xen_pv/sys/amd64/include/xen/xen-os.h Thu Jun 21 16:21:31 2012 (r237403) @@ -75,6 +75,7 @@ void bootmem_free(void *ptr, unsigned in #include <sys/types.h> void printk(const char *fmt, ...); +void vprintk(const char *fmt, __va_list ap); /* some function prototypes */ void trap_init(void); Modified: projects/amd64_xen_pv/sys/amd64/xen/machdep.c ============================================================================== --- projects/amd64_xen_pv/sys/amd64/xen/machdep.c Thu Jun 21 15:47:06 2012 (r237402) +++ projects/amd64_xen_pv/sys/amd64/xen/machdep.c Thu Jun 21 16:21:31 2012 (r237403) @@ -1037,12 +1037,19 @@ void printk(const char *fmt, ...) { __va_list ap; + + va_start(ap, fmt); + vprintk(fmt, ap); + va_end(ap); +} + +void +vprintk(const char *fmt, __va_list ap) +{ int retval; static char buf[PRINTK_BUFSIZE]; - va_start(ap, fmt); retval = vsnprintf(buf, PRINTK_BUFSIZE - 1, fmt, ap); - va_end(ap); buf[retval] = 0; (void)HYPERVISOR_console_write(buf, retval); } Modified: projects/amd64_xen_pv/sys/kern/kern_shutdown.c ============================================================================== --- projects/amd64_xen_pv/sys/kern/kern_shutdown.c Thu Jun 21 15:47:06 2012 (r237402) +++ projects/amd64_xen_pv/sys/kern/kern_shutdown.c Thu Jun 21 16:21:31 2012 (r237403) @@ -616,10 +616,18 @@ panic(const char *fmt, ...) panicstr = buf; cngrab(); printf("panic: %s\n", buf); +#ifdef XEN + printk("panic: %s\n", buf); +#endif } else { printf("panic: "); vprintf(fmt, ap); printf("\n"); +#ifdef XEN + printk("panic: "); + vprintk(fmt, ap); + printk("\n"); +#endif } va_end(ap); #ifdef SMP
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201206211621.q5LGLVGU023575>