xref: /OK3568_Linux_fs/kernel/arch/arm64/include/asm/asm-bug.h (revision 4882a59341e53eb6f0b4789bf948001014eff981)
1*4882a593Smuzhiyun /* SPDX-License-Identifier: GPL-2.0-only */
2*4882a593Smuzhiyun #ifndef __ASM_ASM_BUG_H
3*4882a593Smuzhiyun /*
4*4882a593Smuzhiyun  * Copyright (C) 2017  ARM Limited
5*4882a593Smuzhiyun  */
6*4882a593Smuzhiyun #define __ASM_ASM_BUG_H
7*4882a593Smuzhiyun 
8*4882a593Smuzhiyun #include <asm/brk-imm.h>
9*4882a593Smuzhiyun 
10*4882a593Smuzhiyun #ifdef CONFIG_DEBUG_BUGVERBOSE
11*4882a593Smuzhiyun #define _BUGVERBOSE_LOCATION(file, line) __BUGVERBOSE_LOCATION(file, line)
12*4882a593Smuzhiyun #define __BUGVERBOSE_LOCATION(file, line)			\
13*4882a593Smuzhiyun 		.pushsection .rodata.str,"aMS",@progbits,1;	\
14*4882a593Smuzhiyun 	14472:	.string file;					\
15*4882a593Smuzhiyun 		.popsection;					\
16*4882a593Smuzhiyun 								\
17*4882a593Smuzhiyun 		.long 14472b - 14470b;				\
18*4882a593Smuzhiyun 		.short line;
19*4882a593Smuzhiyun #else
20*4882a593Smuzhiyun #define _BUGVERBOSE_LOCATION(file, line)
21*4882a593Smuzhiyun #endif
22*4882a593Smuzhiyun 
23*4882a593Smuzhiyun #ifdef CONFIG_GENERIC_BUG
24*4882a593Smuzhiyun 
25*4882a593Smuzhiyun #define __BUG_ENTRY(flags) 				\
26*4882a593Smuzhiyun 		.pushsection __bug_table,"aw";		\
27*4882a593Smuzhiyun 		.align 2;				\
28*4882a593Smuzhiyun 	14470:	.long 14471f - 14470b;			\
29*4882a593Smuzhiyun _BUGVERBOSE_LOCATION(__FILE__, __LINE__)		\
30*4882a593Smuzhiyun 		.short flags; 				\
31*4882a593Smuzhiyun 		.popsection;				\
32*4882a593Smuzhiyun 	14471:
33*4882a593Smuzhiyun #else
34*4882a593Smuzhiyun #define __BUG_ENTRY(flags)
35*4882a593Smuzhiyun #endif
36*4882a593Smuzhiyun 
37*4882a593Smuzhiyun #define ASM_BUG_FLAGS(flags)				\
38*4882a593Smuzhiyun 	__BUG_ENTRY(flags)				\
39*4882a593Smuzhiyun 	brk	BUG_BRK_IMM
40*4882a593Smuzhiyun 
41*4882a593Smuzhiyun #define ASM_BUG()	ASM_BUG_FLAGS(0)
42*4882a593Smuzhiyun 
43*4882a593Smuzhiyun #endif /* __ASM_ASM_BUG_H */
44