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

TOMOYO Linux Cross Reference
Linux/arch/powerpc/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_POWERPC_BUG_H
  3 #define _ASM_POWERPC_BUG_H
  4 #ifdef __KERNEL__
  5 
  6 #include <asm/asm-compat.h>
  7 
  8 #ifdef CONFIG_BUG
  9 
 10 #ifdef __ASSEMBLY__
 11 #include <asm/asm-offsets.h>
 12 #ifdef CONFIG_DEBUG_BUGVERBOSE
 13 .macro EMIT_BUG_ENTRY addr,file,line,flags
 14          .section __bug_table,"aw"
 15 5001:    .4byte \addr - .
 16          .4byte 5002f - .
 17          .short \line, \flags
 18          .org 5001b+BUG_ENTRY_SIZE
 19          .previous
 20          .section .rodata,"a"
 21 5002:    .asciz "\file"
 22          .previous
 23 .endm
 24 #else
 25 .macro EMIT_BUG_ENTRY addr,file,line,flags
 26          .section __bug_table,"aw"
 27 5001:    .4byte \addr - .
 28          .short \flags
 29          .org 5001b+BUG_ENTRY_SIZE
 30          .previous
 31 .endm
 32 #endif /* verbose */
 33 
 34 #else /* !__ASSEMBLY__ */
 35 /* _EMIT_BUG_ENTRY expects args %0,%1,%2,%3 to be FILE, LINE, flags and
 36    sizeof(struct bug_entry), respectively */
 37 #ifdef CONFIG_DEBUG_BUGVERBOSE
 38 #define _EMIT_BUG_ENTRY                         \
 39         ".section __bug_table,\"aw\"\n"         \
 40         "2:     .4byte 1b - .\n"                \
 41         "       .4byte %0 - .\n"                \
 42         "       .short %1, %2\n"                \
 43         ".org 2b+%3\n"                          \
 44         ".previous\n"
 45 #else
 46 #define _EMIT_BUG_ENTRY                         \
 47         ".section __bug_table,\"aw\"\n"         \
 48         "2:     .4byte 1b - .\n"                \
 49         "       .short %2\n"                    \
 50         ".org 2b+%3\n"                          \
 51         ".previous\n"
 52 #endif
 53 
 54 #define BUG_ENTRY(insn, flags, ...)                     \
 55         __asm__ __volatile__(                           \
 56                 "1:     " insn "\n"                     \
 57                 _EMIT_BUG_ENTRY                         \
 58                 : : "i" (__FILE__), "i" (__LINE__),     \
 59                   "i" (flags),                          \
 60                   "i" (sizeof(struct bug_entry)),       \
 61                   ##__VA_ARGS__)
 62 
 63 /*
 64  * BUG_ON() and WARN_ON() do their best to cooperate with compile-time
 65  * optimisations. However depending on the complexity of the condition
 66  * some compiler versions may not produce optimal results.
 67  */
 68 
 69 #define BUG() do {                                              \
 70         BUG_ENTRY("twi 31, 0, 0", 0);                           \
 71         unreachable();                                          \
 72 } while (0)
 73 #define HAVE_ARCH_BUG
 74 
 75 #define __WARN_FLAGS(flags) BUG_ENTRY("twi 31, 0, 0", BUGFLAG_WARNING | (flags))
 76 
 77 #ifdef CONFIG_PPC64
 78 #define BUG_ON(x) do {                                          \
 79         if (__builtin_constant_p(x)) {                          \
 80                 if (x)                                          \
 81                         BUG();                                  \
 82         } else {                                                \
 83                 BUG_ENTRY(PPC_TLNEI " %4, 0", 0, "r" ((__force long)(x)));      \
 84         }                                                       \
 85 } while (0)
 86 
 87 #define WARN_ON(x) ({                                           \
 88         int __ret_warn_on = !!(x);                              \
 89         if (__builtin_constant_p(__ret_warn_on)) {              \
 90                 if (__ret_warn_on)                              \
 91                         __WARN();                               \
 92         } else {                                                \
 93                 BUG_ENTRY(PPC_TLNEI " %4, 0",                   \
 94                           BUGFLAG_WARNING | BUGFLAG_TAINT(TAINT_WARN),  \
 95                           "r" (__ret_warn_on)); \
 96         }                                                       \
 97         unlikely(__ret_warn_on);                                \
 98 })
 99 
100 #define HAVE_ARCH_BUG_ON
101 #define HAVE_ARCH_WARN_ON
102 #endif
103 
104 #endif /* __ASSEMBLY __ */
105 #else
106 #ifdef __ASSEMBLY__
107 .macro EMIT_BUG_ENTRY addr,file,line,flags
108 .endm
109 #else /* !__ASSEMBLY__ */
110 #define _EMIT_BUG_ENTRY
111 #endif
112 #endif /* CONFIG_BUG */
113 
114 #define EMIT_WARN_ENTRY EMIT_BUG_ENTRY
115 
116 #include <asm-generic/bug.h>
117 
118 #ifndef __ASSEMBLY__
119 
120 struct pt_regs;
121 void hash__do_page_fault(struct pt_regs *);
122 void bad_page_fault(struct pt_regs *, int);
123 void emulate_single_step(struct pt_regs *regs);
124 extern void _exception(int, struct pt_regs *, int, unsigned long);
125 extern void _exception_pkey(struct pt_regs *, unsigned long, int);
126 extern void die(const char *, struct pt_regs *, long);
127 void die_mce(const char *str, struct pt_regs *regs, long err);
128 extern bool die_will_crash(void);
129 extern void panic_flush_kmsg_start(void);
130 extern void panic_flush_kmsg_end(void);
131 #endif /* !__ASSEMBLY__ */
132 
133 #endif /* __KERNEL__ */
134 #endif /* _ASM_POWERPC_BUG_H */
135 

~ [ 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