linux/arch/parisc/include/asm/bug.h
<<
>>
Prefs
   1#ifndef _PARISC_BUG_H
   2#define _PARISC_BUG_H
   3
   4#include <linux/kernel.h>       /* for BUGFLAG_TAINT */
   5
   6/*
   7 * Tell the user there is some problem.
   8 * The offending file and line are encoded in the __bug_table section.
   9 */
  10
  11#ifdef CONFIG_BUG
  12#define HAVE_ARCH_BUG
  13#define HAVE_ARCH_WARN_ON
  14
  15/* the break instruction is used as BUG() marker.  */
  16#define PARISC_BUG_BREAK_ASM    "break 0x1f, 0x1fff"
  17#define PARISC_BUG_BREAK_INSN   0x03ffe01f  /* PARISC_BUG_BREAK_ASM */
  18
  19#if defined(CONFIG_64BIT)
  20#define ASM_WORD_INSN           ".dword\t"
  21#else
  22#define ASM_WORD_INSN           ".word\t"
  23#endif
  24
  25#ifdef CONFIG_DEBUG_BUGVERBOSE
  26#define BUG()                                                           \
  27        do {                                                            \
  28                asm volatile("\n"                                       \
  29                             "1:\t" PARISC_BUG_BREAK_ASM "\n"           \
  30                             "\t.pushsection __bug_table,\"a\"\n"       \
  31                             "2:\t" ASM_WORD_INSN "1b, %c0\n"           \
  32                             "\t.short %c1, %c2\n"                      \
  33                             "\t.org 2b+%c3\n"                          \
  34                             "\t.popsection"                            \
  35                             : : "i" (__FILE__), "i" (__LINE__),        \
  36                             "i" (0), "i" (sizeof(struct bug_entry)) ); \
  37                unreachable();                                          \
  38        } while(0)
  39
  40#else
  41#define BUG()                                                           \
  42        do {                                                            \
  43                asm volatile(PARISC_BUG_BREAK_ASM : : );                \
  44                unreachable();                                          \
  45        } while(0)
  46#endif
  47
  48#ifdef CONFIG_DEBUG_BUGVERBOSE
  49#define __WARN_TAINT(taint)                                             \
  50        do {                                                            \
  51                asm volatile("\n"                                       \
  52                             "1:\t" PARISC_BUG_BREAK_ASM "\n"           \
  53                             "\t.pushsection __bug_table,\"a\"\n"       \
  54                             "2:\t" ASM_WORD_INSN "1b, %c0\n"           \
  55                             "\t.short %c1, %c2\n"                      \
  56                             "\t.org 2b+%c3\n"                          \
  57                             "\t.popsection"                            \
  58                             : : "i" (__FILE__), "i" (__LINE__),        \
  59                             "i" (BUGFLAG_TAINT(taint)),                \
  60                             "i" (sizeof(struct bug_entry)) );          \
  61        } while(0)
  62#else
  63#define __WARN_TAINT(taint)                                             \
  64        do {                                                            \
  65                asm volatile("\n"                                       \
  66                             "1:\t" PARISC_BUG_BREAK_ASM "\n"           \
  67                             "\t.pushsection __bug_table,\"a\"\n"       \
  68                             "2:\t" ASM_WORD_INSN "1b\n"                \
  69                             "\t.short %c0\n"                           \
  70                             "\t.org 2b+%c1\n"                          \
  71                             "\t.popsection"                            \
  72                             : : "i" (BUGFLAG_TAINT(taint)),            \
  73                             "i" (sizeof(struct bug_entry)) );          \
  74        } while(0)
  75#endif
  76
  77
  78#define WARN_ON(x) ({                                           \
  79        int __ret_warn_on = !!(x);                              \
  80        if (__builtin_constant_p(__ret_warn_on)) {              \
  81                if (__ret_warn_on)                              \
  82                        __WARN();                               \
  83        } else {                                                \
  84                if (unlikely(__ret_warn_on))                    \
  85                        __WARN();                               \
  86        }                                                       \
  87        unlikely(__ret_warn_on);                                \
  88})
  89
  90#endif
  91
  92#include <asm-generic/bug.h>
  93#endif
  94
  95