aboutsummaryrefslogtreecommitdiff
path: root/arch/sh/include/asm/bug.h
diff options
context:
space:
mode:
authorPaul Mundt <lethal@linux-sh.org>2009-08-22 03:49:58 +0900
committerPaul Mundt <lethal@linux-sh.org>2009-08-22 03:49:58 +0900
commitc153a58e715e16ffcd6c4b3da7fc6b4a556bf917 (patch)
tree89639b00047f341f5ebf0b2029a861e3718f641f /arch/sh/include/asm/bug.h
parent4ab8f241f6d510470c15b62ac10f6905ff5c97bd (diff)
parent5580e9044df9c0e87861739d8c527006ead92e52 (diff)
Merge branch 'sh/dwarf-unwinder' of git://github.com/mfleming/linux-2.6 into sh/dwarf-unwinder
Diffstat (limited to 'arch/sh/include/asm/bug.h')
-rw-r--r--arch/sh/include/asm/bug.h25
1 files changed, 25 insertions, 0 deletions
diff --git a/arch/sh/include/asm/bug.h b/arch/sh/include/asm/bug.h
index c0171804016..b7d9822fd6c 100644
--- a/arch/sh/include/asm/bug.h
+++ b/arch/sh/include/asm/bug.h
@@ -1,6 +1,7 @@
#ifndef __ASM_SH_BUG_H
#define __ASM_SH_BUG_H
+#define TRAPA_UNWINDER_BUG_OPCODE 0xc33b /* trapa #0x3b */
#define TRAPA_BUG_OPCODE 0xc33e /* trapa #0x3e */
#ifdef CONFIG_GENERIC_BUG
@@ -72,6 +73,30 @@ do { \
unlikely(__ret_warn_on); \
})
+#define UNWINDER_BUG() \
+do { \
+ __asm__ __volatile__ ( \
+ "1:\t.short %O0\n" \
+ _EMIT_BUG_ENTRY \
+ : \
+ : "n" (TRAPA_UNWINDER_BUG_OPCODE), \
+ "i" (__FILE__), \
+ "i" (__LINE__), "i" (0), \
+ "i" (sizeof(struct bug_entry))); \
+} while (0)
+
+#define UNWINDER_BUG_ON(x) ({ \
+ int __ret_unwinder_on = !!(x); \
+ if (__builtin_constant_p(__ret_unwinder_on)) { \
+ if (__ret_unwinder_on) \
+ UNWINDER_BUG(); \
+ } else { \
+ if (unlikely(__ret_unwinder_on)) \
+ UNWINDER_BUG(); \
+ } \
+ unlikely(__ret_unwinder_on); \
+})
+
#endif /* CONFIG_GENERIC_BUG */
#include <asm-generic/bug.h>