diff options
Diffstat (limited to 'arch/sh/include/asm/bug.h')
-rw-r--r-- | arch/sh/include/asm/bug.h | 35 |
1 files changed, 33 insertions, 2 deletions
diff --git a/arch/sh/include/asm/bug.h b/arch/sh/include/asm/bug.h index c01718040166..6323f864d111 100644 --- a/arch/sh/include/asm/bug.h +++ b/arch/sh/include/asm/bug.h | |||
@@ -2,6 +2,7 @@ | |||
2 | #define __ASM_SH_BUG_H | 2 | #define __ASM_SH_BUG_H |
3 | 3 | ||
4 | #define TRAPA_BUG_OPCODE 0xc33e /* trapa #0x3e */ | 4 | #define TRAPA_BUG_OPCODE 0xc33e /* trapa #0x3e */ |
5 | #define BUGFLAG_UNWINDER (1 << 1) | ||
5 | 6 | ||
6 | #ifdef CONFIG_GENERIC_BUG | 7 | #ifdef CONFIG_GENERIC_BUG |
7 | #define HAVE_ARCH_BUG | 8 | #define HAVE_ARCH_BUG |
@@ -47,7 +48,7 @@ do { \ | |||
47 | "i" (sizeof(struct bug_entry))); \ | 48 | "i" (sizeof(struct bug_entry))); \ |
48 | } while (0) | 49 | } while (0) |
49 | 50 | ||
50 | #define __WARN() \ | 51 | #define __WARN_TAINT(taint) \ |
51 | do { \ | 52 | do { \ |
52 | __asm__ __volatile__ ( \ | 53 | __asm__ __volatile__ ( \ |
53 | "1:\t.short %O0\n" \ | 54 | "1:\t.short %O0\n" \ |
@@ -56,7 +57,7 @@ do { \ | |||
56 | : "n" (TRAPA_BUG_OPCODE), \ | 57 | : "n" (TRAPA_BUG_OPCODE), \ |
57 | "i" (__FILE__), \ | 58 | "i" (__FILE__), \ |
58 | "i" (__LINE__), \ | 59 | "i" (__LINE__), \ |
59 | "i" (BUGFLAG_WARNING), \ | 60 | "i" (BUGFLAG_TAINT(taint)), \ |
60 | "i" (sizeof(struct bug_entry))); \ | 61 | "i" (sizeof(struct bug_entry))); \ |
61 | } while (0) | 62 | } while (0) |
62 | 63 | ||
@@ -72,6 +73,36 @@ do { \ | |||
72 | unlikely(__ret_warn_on); \ | 73 | unlikely(__ret_warn_on); \ |
73 | }) | 74 | }) |
74 | 75 | ||
76 | #define UNWINDER_BUG() \ | ||
77 | do { \ | ||
78 | __asm__ __volatile__ ( \ | ||
79 | "1:\t.short %O0\n" \ | ||
80 | _EMIT_BUG_ENTRY \ | ||
81 | : \ | ||
82 | : "n" (TRAPA_BUG_OPCODE), \ | ||
83 | "i" (__FILE__), \ | ||
84 | "i" (__LINE__), \ | ||
85 | "i" (BUGFLAG_UNWINDER), \ | ||
86 | "i" (sizeof(struct bug_entry))); \ | ||
87 | } while (0) | ||
88 | |||
89 | #define UNWINDER_BUG_ON(x) ({ \ | ||
90 | int __ret_unwinder_on = !!(x); \ | ||
91 | if (__builtin_constant_p(__ret_unwinder_on)) { \ | ||
92 | if (__ret_unwinder_on) \ | ||
93 | UNWINDER_BUG(); \ | ||
94 | } else { \ | ||
95 | if (unlikely(__ret_unwinder_on)) \ | ||
96 | UNWINDER_BUG(); \ | ||
97 | } \ | ||
98 | unlikely(__ret_unwinder_on); \ | ||
99 | }) | ||
100 | |||
101 | #else | ||
102 | |||
103 | #define UNWINDER_BUG BUG | ||
104 | #define UNWINDER_BUG_ON BUG_ON | ||
105 | |||
75 | #endif /* CONFIG_GENERIC_BUG */ | 106 | #endif /* CONFIG_GENERIC_BUG */ |
76 | 107 | ||
77 | #include <asm-generic/bug.h> | 108 | #include <asm-generic/bug.h> |