ia64/xen-unstable

changeset 10577:1d17ddd9e45d

[XEN] BUG() places console in sync mode.
Also move the BUG code out of line.
Original patch from Jimi Xenidis.
Signed-off-by: Keir Fraser <keir@xensource.com>
author kfraser@dhcp93.uk.xensource.com
date Wed Jun 28 16:15:36 2006 +0100 (2006-06-28)
parents 25c6ea6d4024
children da8da6e1e1d6
files xen/drivers/char/console.c xen/include/xen/lib.h
line diff
     1.1 --- a/xen/drivers/char/console.c	Wed Jun 28 16:05:27 2006 +0100
     1.2 +++ b/xen/drivers/char/console.c	Wed Jun 28 16:15:36 2006 +0100
     1.3 @@ -741,6 +741,15 @@ void panic(const char *fmt, ...)
     1.4      machine_restart(0);
     1.5  }
     1.6  
     1.7 +void __bug(char *file, int line)
     1.8 +{
     1.9 +    console_start_sync();
    1.10 +    debugtrace_dump();
    1.11 +    printk("BUG at %s:%d\n", file, line);
    1.12 +    FORCE_CRASH();
    1.13 +    for ( ; ; ) ;
    1.14 +}
    1.15 +
    1.16  /*
    1.17   * Local variables:
    1.18   * mode: C
     2.1 --- a/xen/include/xen/lib.h	Wed Jun 28 16:05:27 2006 +0100
     2.2 +++ b/xen/include/xen/lib.h	Wed Jun 28 16:15:36 2006 +0100
     2.3 @@ -8,19 +8,23 @@
     2.4  #include <xen/xmalloc.h>
     2.5  #include <xen/string.h>
     2.6  
     2.7 -#define BUG() do {					\
     2.8 -    debugtrace_dump();                                  \
     2.9 -    printk("BUG at %s:%d\n", __FILE__, __LINE__);	\
    2.10 -    FORCE_CRASH();                                      \
    2.11 -} while ( 0 )
    2.12 -
    2.13 +extern void __bug(char *file, int line) __attribute__((noreturn));
    2.14 +#define BUG() __bug(__FILE__, __LINE__)
    2.15  #define BUG_ON(_p) do { if (_p) BUG(); } while ( 0 )
    2.16  
    2.17  /* Force a compilation error if condition is true */
    2.18  #define BUILD_BUG_ON(condition) ((void)sizeof(char[1 - 2 * !!(condition)]))
    2.19  
    2.20  #ifndef NDEBUG
    2.21 -#define ASSERT(_p) { if ( !(_p) ) { printk("Assertion '%s' failed, line %d, file %s\n", #_p , __LINE__, __FILE__); BUG(); } }
    2.22 +#define ASSERT(_p)                                                      \
    2.23 +    do {                                                                \
    2.24 +        if ( !(_p) )                                                    \
    2.25 +        {                                                               \
    2.26 +            printk("Assertion '%s' failed, line %d, file %s\n", #_p ,   \
    2.27 +                   __LINE__, __FILE__);                                 \
    2.28 +            BUG();                                                      \
    2.29 +        }                                                               \
    2.30 +    } while ( 0 )
    2.31  #else
    2.32  #define ASSERT(_p) ((void)0)
    2.33  #endif