xref: /openbmc/linux/arch/arm64/include/asm/asm-bug.h (revision 160b8e75)
1 #ifndef __ASM_ASM_BUG_H
2 /*
3  * Copyright (C) 2017  ARM Limited
4  *
5  * This program is free software; you can redistribute it and/or modify
6  * it under the terms of the GNU General Public License version 2 as
7  * published by the Free Software Foundation.
8  *
9  * This program is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12  * GNU General Public License for more details.
13  *
14  * You should have received a copy of the GNU General Public License
15  * along with this program.  If not, see <http://www.gnu.org/licenses/>.
16  */
17 #define __ASM_ASM_BUG_H
18 
19 #include <asm/brk-imm.h>
20 
21 #ifdef CONFIG_DEBUG_BUGVERBOSE
22 #define _BUGVERBOSE_LOCATION(file, line) __BUGVERBOSE_LOCATION(file, line)
23 #define __BUGVERBOSE_LOCATION(file, line)			\
24 		.pushsection .rodata.str,"aMS",@progbits,1;	\
25 	14472:	.string file;					\
26 		.popsection;					\
27 								\
28 		.long 14472b - 14470b;				\
29 		.short line;
30 #else
31 #define _BUGVERBOSE_LOCATION(file, line)
32 #endif
33 
34 #ifdef CONFIG_GENERIC_BUG
35 
36 #define __BUG_ENTRY(flags) 				\
37 		.pushsection __bug_table,"aw";		\
38 		.align 2;				\
39 	14470:	.long 14471f - 14470b;			\
40 _BUGVERBOSE_LOCATION(__FILE__, __LINE__)		\
41 		.short flags; 				\
42 		.popsection;				\
43 	14471:
44 #else
45 #define __BUG_ENTRY(flags)
46 #endif
47 
48 #define ASM_BUG_FLAGS(flags)				\
49 	__BUG_ENTRY(flags)				\
50 	brk	BUG_BRK_IMM
51 
52 #define ASM_BUG()	ASM_BUG_FLAGS(0)
53 
54 #endif /* __ASM_ASM_BUG_H */
55