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

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

Version: ~ [ linux-5.8 ] ~ [ linux-5.7.12 ] ~ [ linux-5.6.19 ] ~ [ linux-5.5.19 ] ~ [ linux-5.4.55 ] ~ [ linux-5.3.18 ] ~ [ linux-5.2.21 ] ~ [ linux-5.1.21 ] ~ [ linux-5.0.21 ] ~ [ linux-4.20.17 ] ~ [ linux-4.19.136 ] ~ [ linux-4.18.20 ] ~ [ linux-4.17.19 ] ~ [ linux-4.16.18 ] ~ [ linux-4.15.18 ] ~ [ linux-4.14.191 ] ~ [ linux-4.13.16 ] ~ [ linux-4.12.14 ] ~ [ linux-4.11.12 ] ~ [ linux-4.10.17 ] ~ [ linux-4.9.232 ] ~ [ linux-4.8.17 ] ~ [ linux-4.7.10 ] ~ [ linux-4.6.7 ] ~ [ linux-4.5.7 ] ~ [ linux-4.4.232 ] ~ [ linux-4.3.6 ] ~ [ linux-4.2.8 ] ~ [ linux-4.1.52 ] ~ [ linux-4.0.9 ] ~ [ linux-3.19.8 ] ~ [ linux-3.18.140 ] ~ [ linux-3.17.8 ] ~ [ linux-3.16.85 ] ~ [ linux-3.15.10 ] ~ [ linux-3.14.79 ] ~ [ linux-3.13.11 ] ~ [ linux-3.12.74 ] ~ [ linux-3.11.10 ] ~ [ 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.5 ] ~ [ policy-sample ] ~
Architecture: ~ [ i386 ] ~ [ alpha ] ~ [ m68k ] ~ [ mips ] ~ [ ppc ] ~ [ sparc ] ~ [ sparc64 ] ~

  1 /* SPDX-License-Identifier: GPL-2.0 */
  2 #ifndef _ASM_X86_BUG_H
  3 #define _ASM_X86_BUG_H
  4 
  5 #include <linux/stringify.h>
  6 
  7 /*
  8  * Despite that some emulators terminate on UD2, we use it for WARN().
  9  *
 10  * Since various instruction decoders/specs disagree on the encoding of
 11  * UD0/UD1.
 12  */
 13 
 14 #define ASM_UD0         ".byte 0x0f, 0xff" /* + ModRM (for Intel) */
 15 #define ASM_UD1         ".byte 0x0f, 0xb9" /* + ModRM */
 16 #define ASM_UD2         ".byte 0x0f, 0x0b"
 17 
 18 #define INSN_UD0        0xff0f
 19 #define INSN_UD2        0x0b0f
 20 
 21 #define LEN_UD2         2
 22 
 23 #ifdef CONFIG_GENERIC_BUG
 24 
 25 #ifdef CONFIG_X86_32
 26 # define __BUG_REL(val) ".long " __stringify(val)
 27 #else
 28 # define __BUG_REL(val) ".long " __stringify(val) " - 2b"
 29 #endif
 30 
 31 #ifdef CONFIG_DEBUG_BUGVERBOSE
 32 
 33 #define _BUG_FLAGS(ins, flags)                                          \
 34 do {                                                                    \
 35         asm volatile("1:\t" ins "\n"                                    \
 36                      ".pushsection __bug_table,\"aw\"\n"                \
 37                      "2:\t" __BUG_REL(1b) "\t# bug_entry::bug_addr\n"   \
 38                      "\t"  __BUG_REL(%c0) "\t# bug_entry::file\n"       \
 39                      "\t.word %c1"        "\t# bug_entry::line\n"       \
 40                      "\t.word %c2"        "\t# bug_entry::flags\n"      \
 41                      "\t.org 2b+%c3\n"                                  \
 42                      ".popsection"                                      \
 43                      : : "i" (__FILE__), "i" (__LINE__),                \
 44                          "i" (flags),                                   \
 45                          "i" (sizeof(struct bug_entry)));               \
 46 } while (0)
 47 
 48 #else /* !CONFIG_DEBUG_BUGVERBOSE */
 49 
 50 #define _BUG_FLAGS(ins, flags)                                          \
 51 do {                                                                    \
 52         asm volatile("1:\t" ins "\n"                                    \
 53                      ".pushsection __bug_table,\"aw\"\n"                \
 54                      "2:\t" __BUG_REL(1b) "\t# bug_entry::bug_addr\n"   \
 55                      "\t.word %c0"        "\t# bug_entry::flags\n"      \
 56                      "\t.org 2b+%c1\n"                                  \
 57                      ".popsection"                                      \
 58                      : : "i" (flags),                                   \
 59                          "i" (sizeof(struct bug_entry)));               \
 60 } while (0)
 61 
 62 #endif /* CONFIG_DEBUG_BUGVERBOSE */
 63 
 64 #else
 65 
 66 #define _BUG_FLAGS(ins, flags)  asm volatile(ins)
 67 
 68 #endif /* CONFIG_GENERIC_BUG */
 69 
 70 #define HAVE_ARCH_BUG
 71 #define BUG()                                                   \
 72 do {                                                            \
 73         _BUG_FLAGS(ASM_UD2, 0);                                 \
 74         unreachable();                                          \
 75 } while (0)
 76 
 77 #define __WARN_FLAGS(flags)                                     \
 78 do {                                                            \
 79         _BUG_FLAGS(ASM_UD2, BUGFLAG_WARNING|(flags));           \
 80         annotate_reachable();                                   \
 81 } while (0)
 82 
 83 #include <asm-generic/bug.h>
 84 
 85 #endif /* _ASM_X86_BUG_H */
 86 

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

kernel.org | git.kernel.org | LWN.net | Project Home | Wiki (Japanese) | Wiki (English) | 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.

osdn.jp