1 /* SPDX-License-Identifier: GPL-2.0-only */ 2 #ifndef __ASM_ASM_BUG_H 3 /* 4 * Copyright (C) 2017 ARM Limited 5 */ 6 #define __ASM_ASM_BUG_H 7 8 #include <asm/brk-imm.h> 9 10 #ifdef CONFIG_DEBUG_BUGVERBOSE 11 #define _BUGVERBOSE_LOCATION(file, line) __BUGVERBOSE_LOCATION(file, line) 12 #define __BUGVERBOSE_LOCATION(file, line) \ 13 .pushsection .rodata.str,"aMS",@progbits,1; \ 14 14472: .string file; \ 15 .popsection; \ 16 \ 17 .long 14472b - .; \ 18 .short line; 19 #else 20 #define _BUGVERBOSE_LOCATION(file, line) 21 #endif 22 23 #ifdef CONFIG_GENERIC_BUG 24 #define __BUG_ENTRY_START \ 25 .pushsection __bug_table,"aw"; \ 26 .align 2; \ 27 14470: .long 14471f - .; \ 28 29 #define __BUG_ENTRY_END \ 30 .align 2; \ 31 .popsection; \ 32 14471: 33 34 #define __BUG_ENTRY(flags) \ 35 __BUG_ENTRY_START \ 36 _BUGVERBOSE_LOCATION(__FILE__, __LINE__) \ 37 .short flags; \ 38 __BUG_ENTRY_END 39 #else 40 #define __BUG_ENTRY(flags) 41 #endif 42 43 #define ASM_BUG_FLAGS(flags) \ 44 __BUG_ENTRY(flags) \ 45 brk BUG_BRK_IMM 46 47 #define ASM_BUG() ASM_BUG_FLAGS(0) 48 49 #ifdef CONFIG_DEBUG_BUGVERBOSE 50 #define __BUG_LOCATION_STRING(file, line) \ 51 ".long " file "- .;" \ 52 ".short " line ";" 53 #else 54 #define __BUG_LOCATION_STRING(file, line) 55 #endif 56 57 #define __BUG_ENTRY_STRING(file, line, flags) \ 58 __stringify(__BUG_ENTRY_START) \ 59 __BUG_LOCATION_STRING(file, line) \ 60 ".short " flags ";" \ 61 __stringify(__BUG_ENTRY_END) 62 63 #define ARCH_WARN_ASM(file, line, flags, size) \ 64 __BUG_ENTRY_STRING(file, line, flags) \ 65 __stringify(brk BUG_BRK_IMM) 66 67 #define ARCH_WARN_REACHABLE 68 69 #endif /* __ASM_ASM_BUG_H */ 70