1 /* SPDX-License-Identifier: GPL-2.0 */ 2 #ifndef _ASM_S390_BUG_H 3 #define _ASM_S390_BUG_H 4 5 #include <linux/stringify.h> 6 7 #ifdef CONFIG_BUG 8 9 #ifndef CONFIG_DEBUG_BUGVERBOSE 10 #define _BUGVERBOSE_LOCATION(file, line) 11 #else 12 #define __BUGVERBOSE_LOCATION(file, line) \ 13 .pushsection .rodata.str, "aMS", @progbits, 1; \ 14 .align 2; \ 15 10002: .ascii file "\0"; \ 16 .popsection; \ 17 \ 18 .long 10002b - .; \ 19 .short line; 20 #define _BUGVERBOSE_LOCATION(file, line) __BUGVERBOSE_LOCATION(file, line) 21 #endif 22 23 #ifndef CONFIG_GENERIC_BUG 24 #define __BUG_ENTRY(cond_str, flags) 25 #else 26 #define __BUG_ENTRY(cond_str, flags) \ 27 .pushsection __bug_table, "aw"; \ 28 .align 4; \ 29 10000: .long 10001f - .; \ 30 _BUGVERBOSE_LOCATION(WARN_CONDITION_STR(cond_str) __FILE__, __LINE__) \ 31 .short flags; \ 32 .popsection; \ 33 10001: 34 #endif 35 36 #define ASM_BUG_FLAGS(cond_str, flags) \ 37 __BUG_ENTRY(cond_str, flags) \ 38 mc 0,0 39 40 #define ASM_BUG() ASM_BUG_FLAGS("", 0) 41 42 #define __BUG_FLAGS(cond_str, flags) \ 43 asm_inline volatile(__stringify(ASM_BUG_FLAGS(cond_str, flags))); 44 45 #define __WARN_FLAGS(cond_str, flags) \ 46 do { \ 47 __BUG_FLAGS(cond_str, BUGFLAG_WARNING|(flags)); \ 48 } while (0) 49 50 #define BUG() \ 51 do { \ 52 __BUG_FLAGS("", 0); \ 53 unreachable(); \ 54 } while (0) 55 56 #define HAVE_ARCH_BUG 57 58 #endif /* CONFIG_BUG */ 59 60 #include <asm-generic/bug.h> 61 62 #endif /* _ASM_S390_BUG_H */ 63