halt/reset on assert?

Andreas Schwab schwab at linux-m68k.org
Sat Apr 2 17:53:13 EST 2011


Evan Lavelle <sa212+lppc at cyconix.com> writes:

> I'd like to use an assert macro in a device driver for an MPC870 using
> ppcboot; something like:
>
> #define MY_ASSERT(expr)                                         \
>    do {                                                         \
>       if(!(expr)) {                                             \
>          printk(                                                \
>             KERN_EMERG                                          \
>             "assertion failure: %s, line %d\n",                 \
>             __FILE__, __LINE__);                                \
>          asm(--ppc halt/reset?)                                 \
>       }                                                         \
>    } while(0)
>
> However, I've got no idea how to halt or reset the processor here. Anyone
> happen to know?

#define MY_ASSERT(expr) BUG_ON(!(expr))

Andreas.

-- 
Andreas Schwab, schwab at linux-m68k.org
GPG Key fingerprint = 58CA 54C7 6D53 942B 1756  01D3 44D5 214B 8276 4ED5
"And now for something completely different."


More information about the Linuxppc-dev mailing list