Skip to content

Commit 8262309

Browse files
fujitaojeda
authored andcommitted
arm64/bug: Add ARCH_WARN_ASM macro for BUG/WARN asm code sharing with Rust
Add new ARCH_WARN_ASM macro for BUG/WARN assembly code sharing with Rust to avoid the duplication. No functional changes. Acked-by: Catalin Marinas <[email protected]> Signed-off-by: FUJITA Tomonori <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Miguel Ojeda <[email protected]>
1 parent 8ad470d commit 8262309

File tree

1 file changed

+29
-4
lines changed

1 file changed

+29
-4
lines changed

arch/arm64/include/asm/asm-bug.h

Lines changed: 29 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,16 +21,21 @@
2121
#endif
2222

2323
#ifdef CONFIG_GENERIC_BUG
24-
25-
#define __BUG_ENTRY(flags) \
24+
#define __BUG_ENTRY_START \
2625
.pushsection __bug_table,"aw"; \
2726
.align 2; \
2827
14470: .long 14471f - .; \
29-
_BUGVERBOSE_LOCATION(__FILE__, __LINE__) \
30-
.short flags; \
28+
29+
#define __BUG_ENTRY_END \
3130
.align 2; \
3231
.popsection; \
3332
14471:
33+
34+
#define __BUG_ENTRY(flags) \
35+
__BUG_ENTRY_START \
36+
_BUGVERBOSE_LOCATION(__FILE__, __LINE__) \
37+
.short flags; \
38+
__BUG_ENTRY_END
3439
#else
3540
#define __BUG_ENTRY(flags)
3641
#endif
@@ -41,4 +46,24 @@ _BUGVERBOSE_LOCATION(__FILE__, __LINE__) \
4146

4247
#define ASM_BUG() ASM_BUG_FLAGS(0)
4348

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+
4469
#endif /* __ASM_ASM_BUG_H */

0 commit comments

Comments
 (0)