Back to home page

OSCL-LXR

 
 

    


0001 /* SPDX-License-Identifier: GPL-2.0 */
0002 #ifndef _ASM_S390_BUG_H
0003 #define _ASM_S390_BUG_H
0004 
0005 #include <linux/compiler.h>
0006 
0007 #ifdef CONFIG_BUG
0008 
0009 #ifdef CONFIG_DEBUG_BUGVERBOSE
0010 
0011 #define __EMIT_BUG(x) do {                  \
0012     asm_inline volatile(                    \
0013         "0: mc  0,0\n"              \
0014         ".section .rodata.str,\"aMS\",@progbits,1\n"    \
0015         "1: .asciz  \""__FILE__"\"\n"       \
0016         ".previous\n"                   \
0017         ".section __bug_table,\"awM\",@progbits,%2\n"   \
0018         "2: .long   0b-.\n"             \
0019         "   .long   1b-.\n"             \
0020         "   .short  %0,%1\n"            \
0021         "   .org    2b+%2\n"            \
0022         ".previous\n"                   \
0023         : : "i" (__LINE__),             \
0024             "i" (x),                    \
0025             "i" (sizeof(struct bug_entry)));        \
0026 } while (0)
0027 
0028 #else /* CONFIG_DEBUG_BUGVERBOSE */
0029 
0030 #define __EMIT_BUG(x) do {                  \
0031     asm_inline volatile(                    \
0032         "0: mc  0,0\n"              \
0033         ".section __bug_table,\"awM\",@progbits,%1\n"   \
0034         "1: .long   0b-.\n"             \
0035         "   .short  %0\n"               \
0036         "   .org    1b+%1\n"            \
0037         ".previous\n"                   \
0038         : : "i" (x),                    \
0039             "i" (sizeof(struct bug_entry)));        \
0040 } while (0)
0041 
0042 #endif /* CONFIG_DEBUG_BUGVERBOSE */
0043 
0044 #define BUG() do {                  \
0045     __EMIT_BUG(0);                  \
0046     unreachable();                  \
0047 } while (0)
0048 
0049 #define __WARN_FLAGS(flags) do {            \
0050     __EMIT_BUG(BUGFLAG_WARNING|(flags));        \
0051 } while (0)
0052 
0053 #define WARN_ON(x) ({                   \
0054     int __ret_warn_on = !!(x);          \
0055     if (__builtin_constant_p(__ret_warn_on)) {  \
0056         if (__ret_warn_on)          \
0057             __WARN();           \
0058     } else {                    \
0059         if (unlikely(__ret_warn_on))        \
0060             __WARN();           \
0061     }                       \
0062     unlikely(__ret_warn_on);            \
0063 })
0064 
0065 #define HAVE_ARCH_BUG
0066 #define HAVE_ARCH_WARN_ON
0067 #endif /* CONFIG_BUG */
0068 
0069 #include <asm-generic/bug.h>
0070 
0071 #endif /* _ASM_S390_BUG_H */