]> Git Repo - linux.git/blob - arch/loongarch/include/asm/bug.h
Linux 6.14-rc3
[linux.git] / arch / loongarch / include / asm / bug.h
1 /* SPDX-License-Identifier: GPL-2.0 */
2 #ifndef __ASM_BUG_H
3 #define __ASM_BUG_H
4
5 #include <asm/break.h>
6 #include <linux/stringify.h>
7 #include <linux/objtool.h>
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         10002:  .string file;                                   \
15                 .popsection;                                    \
16                                                                 \
17                 .long 10002b - .;                               \
18                 .short line;
19 #define _BUGVERBOSE_LOCATION(file, line) __BUGVERBOSE_LOCATION(file, line)
20 #endif
21
22 #ifndef CONFIG_GENERIC_BUG
23 #define __BUG_ENTRY(flags)
24 #else
25 #define __BUG_ENTRY(flags)                                      \
26                 .pushsection __bug_table, "aw";                 \
27                 .align 2;                                       \
28         10000:  .long 10001f - .;                               \
29                 _BUGVERBOSE_LOCATION(__FILE__, __LINE__)        \
30                 .short flags;                                   \
31                 .popsection;                                    \
32         10001:
33 #endif
34
35 #define ASM_BUG_FLAGS(flags)                                    \
36         __BUG_ENTRY(flags)                                      \
37         break           BRK_BUG;
38
39 #define ASM_BUG()       ASM_BUG_FLAGS(0)
40
41 #define __BUG_FLAGS(flags, extra)                                       \
42         asm_inline volatile (__stringify(ASM_BUG_FLAGS(flags))          \
43                              extra);
44
45 #define __WARN_FLAGS(flags)                                     \
46 do {                                                            \
47         instrumentation_begin();                                \
48         __BUG_FLAGS(BUGFLAG_WARNING|(flags), ANNOTATE_REACHABLE(10001b));\
49         instrumentation_end();                                  \
50 } while (0)
51
52 #define BUG()                                                   \
53 do {                                                            \
54         instrumentation_begin();                                \
55         __BUG_FLAGS(0, "");                                     \
56         unreachable();                                          \
57 } while (0)
58
59 #define HAVE_ARCH_BUG
60
61 #include <asm-generic/bug.h>
62
63 #endif /* __ASM_BUG_H */
This page took 0.033819 seconds and 4 git commands to generate.