2005-04-17 02:20:36 +04:00
|
|
|
#ifndef _PARISC_BUG_H
|
|
|
|
#define _PARISC_BUG_H
|
|
|
|
|
2006-12-16 18:16:50 +03:00
|
|
|
/*
|
|
|
|
* Tell the user there is some problem.
|
|
|
|
* The offending file and line are encoded in the __bug_table section.
|
|
|
|
*/
|
|
|
|
|
2005-05-01 19:59:01 +04:00
|
|
|
#ifdef CONFIG_BUG
|
2005-04-17 02:20:36 +04:00
|
|
|
#define HAVE_ARCH_BUG
|
2006-12-16 18:16:50 +03:00
|
|
|
#define HAVE_ARCH_WARN_ON
|
|
|
|
|
|
|
|
/* the break instruction is used as BUG() marker. */
|
|
|
|
#define PARISC_BUG_BREAK_ASM "break 0x1f, 0x1fff"
|
|
|
|
#define PARISC_BUG_BREAK_INSN 0x03ffe01f /* PARISC_BUG_BREAK_ASM */
|
|
|
|
|
|
|
|
#ifdef CONFIG_64BIT
|
|
|
|
#define ASM_ULONG_INSN ".dword"
|
|
|
|
#else
|
|
|
|
#define ASM_ULONG_INSN ".word"
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef CONFIG_DEBUG_BUGVERBOSE
|
|
|
|
#define BUG() \
|
|
|
|
do { \
|
|
|
|
asm volatile("\n" \
|
|
|
|
"1:\t" PARISC_BUG_BREAK_ASM "\n" \
|
|
|
|
"\t.pushsection __bug_table,\"a\"\n" \
|
|
|
|
"2:\t" ASM_ULONG_INSN " 1b, %c0\n" \
|
|
|
|
"\t.short %c1, %c2\n" \
|
|
|
|
"\t.org 2b+%c3\n" \
|
|
|
|
"\t.popsection" \
|
|
|
|
: : "i" (__FILE__), "i" (__LINE__), \
|
|
|
|
"i" (0), "i" (sizeof(struct bug_entry)) ); \
|
|
|
|
for(;;) ; \
|
|
|
|
} while(0)
|
|
|
|
|
|
|
|
#else
|
|
|
|
#define BUG() \
|
|
|
|
do { \
|
|
|
|
asm volatile(PARISC_BUG_BREAK_ASM : : ); \
|
|
|
|
for(;;) ; \
|
|
|
|
} while(0)
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#define __WARN() \
|
|
|
|
do { \
|
|
|
|
asm volatile("\n" \
|
|
|
|
"1:\t" PARISC_BUG_BREAK_ASM "\n" \
|
|
|
|
"\t.pushsection __bug_table,\"a\"\n" \
|
|
|
|
"2:\t" ASM_ULONG_INSN " 1b, %c0\n" \
|
|
|
|
"\t.short %c1, %c2\n" \
|
|
|
|
"\t.org 2b+%c3\n" \
|
|
|
|
"\t.popsection" \
|
|
|
|
: : "i" (__FILE__), "i" (__LINE__), \
|
|
|
|
"i" (BUGFLAG_WARNING), \
|
|
|
|
"i" (sizeof(struct bug_entry)) ); \
|
|
|
|
} while(0)
|
|
|
|
|
|
|
|
|
|
|
|
#define WARN_ON(x) ({ \
|
|
|
|
typeof(x) __ret_warn_on = (x); \
|
|
|
|
if (__builtin_constant_p(__ret_warn_on)) { \
|
|
|
|
if (__ret_warn_on) \
|
|
|
|
__WARN(); \
|
|
|
|
} else { \
|
|
|
|
if (unlikely(__ret_warn_on)) \
|
|
|
|
__WARN(); \
|
|
|
|
} \
|
|
|
|
unlikely(__ret_warn_on); \
|
|
|
|
})
|
|
|
|
|
2005-05-01 19:59:01 +04:00
|
|
|
#endif
|
2005-04-17 02:20:36 +04:00
|
|
|
|
|
|
|
#include <asm-generic/bug.h>
|
|
|
|
#endif
|
2006-12-16 18:16:50 +03:00
|
|
|
|