diff options
-rw-r--r-- | arch/ppc/kernel/traps.c | 2 | ||||
-rw-r--r-- | arch/ppc64/kernel/traps.c | 4 | ||||
-rw-r--r-- | include/asm-powerpc/bug.h (renamed from include/asm-ppc64/bug.h) | 38 | ||||
-rw-r--r-- | include/asm-ppc/bug.h | 58 |
4 files changed, 28 insertions, 74 deletions
diff --git a/arch/ppc/kernel/traps.c b/arch/ppc/kernel/traps.c index 961ede87be72..82e4d70e6dbb 100644 --- a/arch/ppc/kernel/traps.c +++ b/arch/ppc/kernel/traps.c | |||
@@ -575,7 +575,7 @@ extern struct bug_entry __start___bug_table[], __stop___bug_table[]; | |||
575 | #define module_find_bug(x) NULL | 575 | #define module_find_bug(x) NULL |
576 | #endif | 576 | #endif |
577 | 577 | ||
578 | static struct bug_entry *find_bug(unsigned long bugaddr) | 578 | struct bug_entry *find_bug(unsigned long bugaddr) |
579 | { | 579 | { |
580 | struct bug_entry *bug; | 580 | struct bug_entry *bug; |
581 | 581 | ||
diff --git a/arch/ppc64/kernel/traps.c b/arch/ppc64/kernel/traps.c index 7467ae508e6e..5c4647b2c5f3 100644 --- a/arch/ppc64/kernel/traps.c +++ b/arch/ppc64/kernel/traps.c | |||
@@ -390,12 +390,12 @@ check_bug_trap(struct pt_regs *regs) | |||
390 | /* this is a WARN_ON rather than BUG/BUG_ON */ | 390 | /* this is a WARN_ON rather than BUG/BUG_ON */ |
391 | printk(KERN_ERR "Badness in %s at %s:%d\n", | 391 | printk(KERN_ERR "Badness in %s at %s:%d\n", |
392 | bug->function, bug->file, | 392 | bug->function, bug->file, |
393 | (unsigned int)bug->line & ~BUG_WARNING_TRAP); | 393 | bug->line & ~BUG_WARNING_TRAP); |
394 | show_stack(current, (void *)regs->gpr[1]); | 394 | show_stack(current, (void *)regs->gpr[1]); |
395 | return 1; | 395 | return 1; |
396 | } | 396 | } |
397 | printk(KERN_CRIT "kernel BUG in %s at %s:%d!\n", | 397 | printk(KERN_CRIT "kernel BUG in %s at %s:%d!\n", |
398 | bug->function, bug->file, (unsigned int)bug->line); | 398 | bug->function, bug->file, bug->line); |
399 | return 0; | 399 | return 0; |
400 | } | 400 | } |
401 | 401 | ||
diff --git a/include/asm-ppc64/bug.h b/include/asm-powerpc/bug.h index 160178278861..e4d028e87020 100644 --- a/include/asm-ppc64/bug.h +++ b/include/asm-powerpc/bug.h | |||
@@ -1,5 +1,5 @@ | |||
1 | #ifndef _PPC64_BUG_H | 1 | #ifndef _ASM_POWERPC_BUG_H |
2 | #define _PPC64_BUG_H | 2 | #define _ASM_POWERPC_BUG_H |
3 | 3 | ||
4 | /* | 4 | /* |
5 | * Define an illegal instr to trap on the bug. | 5 | * Define an illegal instr to trap on the bug. |
@@ -11,9 +11,21 @@ | |||
11 | 11 | ||
12 | #ifndef __ASSEMBLY__ | 12 | #ifndef __ASSEMBLY__ |
13 | 13 | ||
14 | #ifdef __powerpc64__ | ||
15 | #define BUG_TABLE_ENTRY(label, line, file, func) \ | ||
16 | ".llong " #label "\n .long " #line "\n .llong " #file ", " #func "\n" | ||
17 | #define TRAP_OP(ra, rb) "1: tdnei " #ra ", " #rb "\n" | ||
18 | #define DATA_TYPE long long | ||
19 | #else | ||
20 | #define BUG_TABLE_ENTRY(label, line, file, func) \ | ||
21 | ".long " #label ", " #line ", " #file ", " #func "\n" | ||
22 | #define TRAP_OP(ra, rb) "1: twnei " #ra ", " #rb "\n" | ||
23 | #define DATA_TYPE int | ||
24 | #endif /* __powerpc64__ */ | ||
25 | |||
14 | struct bug_entry { | 26 | struct bug_entry { |
15 | unsigned long bug_addr; | 27 | unsigned long bug_addr; |
16 | long line; | 28 | int line; |
17 | const char *file; | 29 | const char *file; |
18 | const char *function; | 30 | const char *function; |
19 | }; | 31 | }; |
@@ -32,28 +44,28 @@ struct bug_entry *find_bug(unsigned long bugaddr); | |||
32 | __asm__ __volatile__( \ | 44 | __asm__ __volatile__( \ |
33 | "1: twi 31,0,0\n" \ | 45 | "1: twi 31,0,0\n" \ |
34 | ".section __bug_table,\"a\"\n\t" \ | 46 | ".section __bug_table,\"a\"\n\t" \ |
35 | " .llong 1b,%0,%1,%2\n" \ | 47 | BUG_TABLE_ENTRY(1b,%0,%1,%2) \ |
36 | ".previous" \ | 48 | ".previous" \ |
37 | : : "i" (__LINE__), "i" (__FILE__), "i" (__FUNCTION__)); \ | 49 | : : "i" (__LINE__), "i" (__FILE__), "i" (__FUNCTION__)); \ |
38 | } while (0) | 50 | } while (0) |
39 | 51 | ||
40 | #define BUG_ON(x) do { \ | 52 | #define BUG_ON(x) do { \ |
41 | __asm__ __volatile__( \ | 53 | __asm__ __volatile__( \ |
42 | "1: tdnei %0,0\n" \ | 54 | TRAP_OP(%0,0) \ |
43 | ".section __bug_table,\"a\"\n\t" \ | 55 | ".section __bug_table,\"a\"\n\t" \ |
44 | " .llong 1b,%1,%2,%3\n" \ | 56 | BUG_TABLE_ENTRY(1b,%1,%2,%3) \ |
45 | ".previous" \ | 57 | ".previous" \ |
46 | : : "r" ((long long)(x)), "i" (__LINE__), \ | 58 | : : "r" ((DATA_TYPE)(x)), "i" (__LINE__), \ |
47 | "i" (__FILE__), "i" (__FUNCTION__)); \ | 59 | "i" (__FILE__), "i" (__FUNCTION__)); \ |
48 | } while (0) | 60 | } while (0) |
49 | 61 | ||
50 | #define WARN_ON(x) do { \ | 62 | #define WARN_ON(x) do { \ |
51 | __asm__ __volatile__( \ | 63 | __asm__ __volatile__( \ |
52 | "1: tdnei %0,0\n" \ | 64 | TRAP_OP(%0,0) \ |
53 | ".section __bug_table,\"a\"\n\t" \ | 65 | ".section __bug_table,\"a\"\n\t" \ |
54 | " .llong 1b,%1,%2,%3\n" \ | 66 | BUG_TABLE_ENTRY(1b,%1,%2,%3) \ |
55 | ".previous" \ | 67 | ".previous" \ |
56 | : : "r" ((long long)(x)), \ | 68 | : : "r" ((DATA_TYPE)(x)), \ |
57 | "i" (__LINE__ + BUG_WARNING_TRAP), \ | 69 | "i" (__LINE__ + BUG_WARNING_TRAP), \ |
58 | "i" (__FILE__), "i" (__FUNCTION__)); \ | 70 | "i" (__FILE__), "i" (__FUNCTION__)); \ |
59 | } while (0) | 71 | } while (0) |
@@ -61,9 +73,9 @@ struct bug_entry *find_bug(unsigned long bugaddr); | |||
61 | #define HAVE_ARCH_BUG | 73 | #define HAVE_ARCH_BUG |
62 | #define HAVE_ARCH_BUG_ON | 74 | #define HAVE_ARCH_BUG_ON |
63 | #define HAVE_ARCH_WARN_ON | 75 | #define HAVE_ARCH_WARN_ON |
64 | #endif | 76 | #endif /* CONFIG_BUG */ |
65 | #endif | 77 | #endif /* __ASSEMBLY __ */ |
66 | 78 | ||
67 | #include <asm-generic/bug.h> | 79 | #include <asm-generic/bug.h> |
68 | 80 | ||
69 | #endif | 81 | #endif /* _ASM_POWERPC_BUG_H */ |
diff --git a/include/asm-ppc/bug.h b/include/asm-ppc/bug.h deleted file mode 100644 index 8b34fd682b0d..000000000000 --- a/include/asm-ppc/bug.h +++ /dev/null | |||
@@ -1,58 +0,0 @@ | |||
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 | |||
17 | #ifdef CONFIG_BUG | ||
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 | ||
54 | #endif | ||
55 | |||
56 | #include <asm-generic/bug.h> | ||
57 | |||
58 | #endif | ||