diff options
Diffstat (limited to 'include/asm-powerpc/bug.h')
| -rw-r--r-- | include/asm-powerpc/bug.h | 34 |
1 files changed, 15 insertions, 19 deletions
diff --git a/include/asm-powerpc/bug.h b/include/asm-powerpc/bug.h index e4d028e87020..d625ee55f957 100644 --- a/include/asm-powerpc/bug.h +++ b/include/asm-powerpc/bug.h | |||
| @@ -12,20 +12,16 @@ | |||
| 12 | #ifndef __ASSEMBLY__ | 12 | #ifndef __ASSEMBLY__ |
| 13 | 13 | ||
| 14 | #ifdef __powerpc64__ | 14 | #ifdef __powerpc64__ |
| 15 | #define BUG_TABLE_ENTRY(label, line, file, func) \ | 15 | #define BUG_TABLE_ENTRY ".llong" |
| 16 | ".llong " #label "\n .long " #line "\n .llong " #file ", " #func "\n" | 16 | #define BUG_TRAP_OP "tdnei" |
| 17 | #define TRAP_OP(ra, rb) "1: tdnei " #ra ", " #rb "\n" | ||
| 18 | #define DATA_TYPE long long | ||
| 19 | #else | 17 | #else |
| 20 | #define BUG_TABLE_ENTRY(label, line, file, func) \ | 18 | #define BUG_TABLE_ENTRY ".long" |
| 21 | ".long " #label ", " #line ", " #file ", " #func "\n" | 19 | #define BUG_TRAP_OP "twnei" |
| 22 | #define TRAP_OP(ra, rb) "1: twnei " #ra ", " #rb "\n" | ||
| 23 | #define DATA_TYPE int | ||
| 24 | #endif /* __powerpc64__ */ | 20 | #endif /* __powerpc64__ */ |
| 25 | 21 | ||
| 26 | struct bug_entry { | 22 | struct bug_entry { |
| 27 | unsigned long bug_addr; | 23 | unsigned long bug_addr; |
| 28 | int line; | 24 | long line; |
| 29 | const char *file; | 25 | const char *file; |
| 30 | const char *function; | 26 | const char *function; |
| 31 | }; | 27 | }; |
| @@ -43,29 +39,29 @@ struct bug_entry *find_bug(unsigned long bugaddr); | |||
| 43 | #define BUG() do { \ | 39 | #define BUG() do { \ |
| 44 | __asm__ __volatile__( \ | 40 | __asm__ __volatile__( \ |
| 45 | "1: twi 31,0,0\n" \ | 41 | "1: twi 31,0,0\n" \ |
| 46 | ".section __bug_table,\"a\"\n\t" \ | 42 | ".section __bug_table,\"a\"\n" \ |
| 47 | BUG_TABLE_ENTRY(1b,%0,%1,%2) \ | 43 | "\t"BUG_TABLE_ENTRY" 1b,%0,%1,%2\n" \ |
| 48 | ".previous" \ | 44 | ".previous" \ |
| 49 | : : "i" (__LINE__), "i" (__FILE__), "i" (__FUNCTION__)); \ | 45 | : : "i" (__LINE__), "i" (__FILE__), "i" (__FUNCTION__)); \ |
| 50 | } while (0) | 46 | } while (0) |
| 51 | 47 | ||
| 52 | #define BUG_ON(x) do { \ | 48 | #define BUG_ON(x) do { \ |
| 53 | __asm__ __volatile__( \ | 49 | __asm__ __volatile__( \ |
| 54 | TRAP_OP(%0,0) \ | 50 | "1: "BUG_TRAP_OP" %0,0\n" \ |
| 55 | ".section __bug_table,\"a\"\n\t" \ | 51 | ".section __bug_table,\"a\"\n" \ |
| 56 | BUG_TABLE_ENTRY(1b,%1,%2,%3) \ | 52 | "\t"BUG_TABLE_ENTRY" 1b,%1,%2,%3\n" \ |
| 57 | ".previous" \ | 53 | ".previous" \ |
| 58 | : : "r" ((DATA_TYPE)(x)), "i" (__LINE__), \ | 54 | : : "r" ((long)(x)), "i" (__LINE__), \ |
| 59 | "i" (__FILE__), "i" (__FUNCTION__)); \ | 55 | "i" (__FILE__), "i" (__FUNCTION__)); \ |
| 60 | } while (0) | 56 | } while (0) |
| 61 | 57 | ||
| 62 | #define WARN_ON(x) do { \ | 58 | #define WARN_ON(x) do { \ |
| 63 | __asm__ __volatile__( \ | 59 | __asm__ __volatile__( \ |
| 64 | TRAP_OP(%0,0) \ | 60 | "1: "BUG_TRAP_OP" %0,0\n" \ |
| 65 | ".section __bug_table,\"a\"\n\t" \ | 61 | ".section __bug_table,\"a\"\n" \ |
| 66 | BUG_TABLE_ENTRY(1b,%1,%2,%3) \ | 62 | "\t"BUG_TABLE_ENTRY" 1b,%1,%2,%3\n" \ |
| 67 | ".previous" \ | 63 | ".previous" \ |
| 68 | : : "r" ((DATA_TYPE)(x)), \ | 64 | : : "r" ((long)(x)), \ |
| 69 | "i" (__LINE__ + BUG_WARNING_TRAP), \ | 65 | "i" (__LINE__ + BUG_WARNING_TRAP), \ |
| 70 | "i" (__FILE__), "i" (__FUNCTION__)); \ | 66 | "i" (__FILE__), "i" (__FUNCTION__)); \ |
| 71 | } while (0) | 67 | } while (0) |
