Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1 | #ifndef _PPC_BUG_H |
| 2 | #define _PPC_BUG_H |
| 3 | |
| 4 | struct bug_entry { |
| 5 | unsigned long bug_addr; |
| 6 | int line; |
| 7 | const char *file; |
| 8 | const char *function; |
| 9 | }; |
| 10 | |
| 11 | /* |
| 12 | * If this bit is set in the line number it means that the trap |
| 13 | * is for WARN_ON rather than BUG or BUG_ON. |
| 14 | */ |
| 15 | #define BUG_WARNING_TRAP 0x1000000 |
| 16 | |
Matt Mackall | c8538a7 | 2005-05-01 08:59:01 -0700 | [diff] [blame] | 17 | #ifdef CONFIG_BUG |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 18 | #define BUG() do { \ |
| 19 | __asm__ __volatile__( \ |
| 20 | "1: twi 31,0,0\n" \ |
| 21 | ".section __bug_table,\"a\"\n\t" \ |
| 22 | " .long 1b,%0,%1,%2\n" \ |
| 23 | ".previous" \ |
| 24 | : : "i" (__LINE__), "i" (__FILE__), "i" (__FUNCTION__)); \ |
| 25 | } while (0) |
| 26 | |
| 27 | #define BUG_ON(x) do { \ |
| 28 | if (!__builtin_constant_p(x) || (x)) { \ |
| 29 | __asm__ __volatile__( \ |
| 30 | "1: twnei %0,0\n" \ |
| 31 | ".section __bug_table,\"a\"\n\t" \ |
| 32 | " .long 1b,%1,%2,%3\n" \ |
| 33 | ".previous" \ |
| 34 | : : "r" (x), "i" (__LINE__), "i" (__FILE__), \ |
| 35 | "i" (__FUNCTION__)); \ |
| 36 | } \ |
| 37 | } while (0) |
| 38 | |
| 39 | #define WARN_ON(x) do { \ |
| 40 | if (!__builtin_constant_p(x) || (x)) { \ |
| 41 | __asm__ __volatile__( \ |
| 42 | "1: twnei %0,0\n" \ |
| 43 | ".section __bug_table,\"a\"\n\t" \ |
| 44 | " .long 1b,%1,%2,%3\n" \ |
| 45 | ".previous" \ |
| 46 | : : "r" (x), "i" (__LINE__ + BUG_WARNING_TRAP), \ |
| 47 | "i" (__FILE__), "i" (__FUNCTION__)); \ |
| 48 | } \ |
| 49 | } while (0) |
| 50 | |
| 51 | #define HAVE_ARCH_BUG |
| 52 | #define HAVE_ARCH_BUG_ON |
| 53 | #define HAVE_ARCH_WARN_ON |
Matt Mackall | c8538a7 | 2005-05-01 08:59:01 -0700 | [diff] [blame] | 54 | #endif |
| 55 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 56 | #include <asm-generic/bug.h> |
| 57 | |
| 58 | #endif |