~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

TOMOYO Linux Cross Reference
Linux/arch/sh/include/asm/bug.h

Version: ~ [ linux-6.11-rc3 ] ~ [ linux-6.10.4 ] ~ [ linux-6.9.12 ] ~ [ linux-6.8.12 ] ~ [ linux-6.7.12 ] ~ [ linux-6.6.45 ] ~ [ linux-6.5.13 ] ~ [ linux-6.4.16 ] ~ [ linux-6.3.13 ] ~ [ linux-6.2.16 ] ~ [ linux-6.1.104 ] ~ [ linux-6.0.19 ] ~ [ linux-5.19.17 ] ~ [ linux-5.18.19 ] ~ [ linux-5.17.15 ] ~ [ linux-5.16.20 ] ~ [ linux-5.15.164 ] ~ [ linux-5.14.21 ] ~ [ linux-5.13.19 ] ~ [ linux-5.12.19 ] ~ [ linux-5.11.22 ] ~ [ linux-5.10.223 ] ~ [ linux-5.9.16 ] ~ [ linux-5.8.18 ] ~ [ linux-5.7.19 ] ~ [ linux-5.6.19 ] ~ [ linux-5.5.19 ] ~ [ linux-5.4.281 ] ~ [ linux-5.3.18 ] ~ [ linux-5.2.21 ] ~ [ linux-5.1.21 ] ~ [ linux-5.0.21 ] ~ [ linux-4.20.17 ] ~ [ linux-4.19.319 ] ~ [ linux-4.18.20 ] ~ [ linux-4.17.19 ] ~ [ linux-4.16.18 ] ~ [ linux-4.15.18 ] ~ [ linux-4.14.336 ] ~ [ linux-4.13.16 ] ~ [ linux-4.12.14 ] ~ [ linux-4.11.12 ] ~ [ linux-4.10.17 ] ~ [ linux-4.9.337 ] ~ [ linux-4.4.302 ] ~ [ linux-3.10.108 ] ~ [ linux-2.6.32.71 ] ~ [ linux-2.6.0 ] ~ [ linux-2.4.37.11 ] ~ [ unix-v6-master ] ~ [ ccs-tools-1.8.9 ] ~ [ policy-sample ] ~
Architecture: ~ [ i386 ] ~ [ alpha ] ~ [ m68k ] ~ [ mips ] ~ [ ppc ] ~ [ sparc ] ~ [ sparc64 ] ~

  1 /* SPDX-License-Identifier: GPL-2.0 */
  2 #ifndef __ASM_SH_BUG_H
  3 #define __ASM_SH_BUG_H
  4 
  5 #include <linux/linkage.h>
  6 
  7 #define TRAPA_BUG_OPCODE        0xc33e  /* trapa #0x3e */
  8 #define BUGFLAG_UNWINDER        (1 << 1)
  9 
 10 #ifdef CONFIG_GENERIC_BUG
 11 #define HAVE_ARCH_BUG
 12 #define HAVE_ARCH_WARN_ON
 13 
 14 /**
 15  * _EMIT_BUG_ENTRY
 16  * %1 - __FILE__
 17  * %2 - __LINE__
 18  * %3 - trap type
 19  * %4 - sizeof(struct bug_entry)
 20  *
 21  * The trapa opcode itself sits in %0.
 22  * The %O notation is used to avoid # generation.
 23  *
 24  * The offending file and line are encoded in the __bug_table section.
 25  */
 26 #ifdef CONFIG_DEBUG_BUGVERBOSE
 27 #define _EMIT_BUG_ENTRY                         \
 28         "\t.pushsection __bug_table,\"aw\"\n"   \
 29         "2:\t.long 1b, %O1\n"                   \
 30         "\t.short %O2, %O3\n"                   \
 31         "\t.org 2b+%O4\n"                       \
 32         "\t.popsection\n"
 33 #else
 34 #define _EMIT_BUG_ENTRY                         \
 35         "\t.pushsection __bug_table,\"aw\"\n"   \
 36         "2:\t.long 1b\n"                        \
 37         "\t.short %O3\n"                        \
 38         "\t.org 2b+%O4\n"                       \
 39         "\t.popsection\n"
 40 #endif
 41 
 42 #define BUG()                                           \
 43 do {                                                    \
 44         __asm__ __volatile__ (                          \
 45                 "1:\t.short %O0\n"                      \
 46                 _EMIT_BUG_ENTRY                         \
 47                  :                                      \
 48                  : "n" (TRAPA_BUG_OPCODE),              \
 49                    "i" (__FILE__),                      \
 50                    "i" (__LINE__), "i" (0),             \
 51                    "i" (sizeof(struct bug_entry)));     \
 52         unreachable();                                  \
 53 } while (0)
 54 
 55 #define __WARN_FLAGS(flags)                             \
 56 do {                                                    \
 57         __asm__ __volatile__ (                          \
 58                 "1:\t.short %O0\n"                      \
 59                  _EMIT_BUG_ENTRY                        \
 60                  :                                      \
 61                  : "n" (TRAPA_BUG_OPCODE),              \
 62                    "i" (__FILE__),                      \
 63                    "i" (__LINE__),                      \
 64                    "i" (BUGFLAG_WARNING|(flags)),       \
 65                    "i" (sizeof(struct bug_entry)));     \
 66 } while (0)
 67 
 68 #define WARN_ON(x) ({                                           \
 69         int __ret_warn_on = !!(x);                              \
 70         if (__builtin_constant_p(__ret_warn_on)) {              \
 71                 if (__ret_warn_on)                              \
 72                         __WARN();                               \
 73         } else {                                                \
 74                 if (unlikely(__ret_warn_on))                    \
 75                         __WARN();                               \
 76         }                                                       \
 77         unlikely(__ret_warn_on);                                \
 78 })
 79 
 80 #define UNWINDER_BUG()                                  \
 81 do {                                                    \
 82         __asm__ __volatile__ (                          \
 83                 "1:\t.short %O0\n"                      \
 84                 _EMIT_BUG_ENTRY                         \
 85                  :                                      \
 86                  : "n" (TRAPA_BUG_OPCODE),              \
 87                    "i" (__FILE__),                      \
 88                    "i" (__LINE__),                      \
 89                    "i" (BUGFLAG_UNWINDER),              \
 90                    "i" (sizeof(struct bug_entry)));     \
 91 } while (0)
 92 
 93 #define UNWINDER_BUG_ON(x) ({                                   \
 94         int __ret_unwinder_on = !!(x);                          \
 95         if (__builtin_constant_p(__ret_unwinder_on)) {          \
 96                 if (__ret_unwinder_on)                          \
 97                         UNWINDER_BUG();                         \
 98         } else {                                                \
 99                 if (unlikely(__ret_unwinder_on))                \
100                         UNWINDER_BUG();                         \
101         }                                                       \
102         unlikely(__ret_unwinder_on);                            \
103 })
104 
105 #else
106 
107 #define UNWINDER_BUG    BUG
108 #define UNWINDER_BUG_ON BUG_ON
109 
110 #endif /* CONFIG_GENERIC_BUG */
111 
112 #include <asm-generic/bug.h>
113 
114 struct pt_regs;
115 
116 /* arch/sh/kernel/traps.c */
117 extern void die(const char *str, struct pt_regs *regs, long err) __attribute__ ((noreturn));
118 extern void die_if_kernel(const char *str, struct pt_regs *regs, long err);
119 extern void die_if_no_fixup(const char *str, struct pt_regs *regs, long err);
120 
121 #endif /* __ASM_SH_BUG_H */
122 

~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

kernel.org | git.kernel.org | LWN.net | Project Home | SVN repository | Mail admin

Linux® is a registered trademark of Linus Torvalds in the United States and other countries.
TOMOYO® is a registered trademark of NTT DATA CORPORATION.

sflogo.php