Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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 <catalin.marinas@arm.com>
Signed-off-by: FUJITA Tomonori <fujita.tomonori@gmail.com>
Link: https://lore.kernel.org/r/20250502094537.231725-4-fujita.tomonori@gmail.com
Signed-off-by: Miguel Ojeda <ojeda@kernel.org>

authored by

FUJITA Tomonori and committed by
Miguel Ojeda
82623097 8ad470d4

+29 -4
+29 -4
arch/arm64/include/asm/asm-bug.h
··· 21 21 #endif 22 22 23 23 #ifdef CONFIG_GENERIC_BUG 24 - 25 - #define __BUG_ENTRY(flags) \ 24 + #define __BUG_ENTRY_START \ 26 25 .pushsection __bug_table,"aw"; \ 27 26 .align 2; \ 28 27 14470: .long 14471f - .; \ 29 - _BUGVERBOSE_LOCATION(__FILE__, __LINE__) \ 30 - .short flags; \ 28 + 29 + #define __BUG_ENTRY_END \ 31 30 .align 2; \ 32 31 .popsection; \ 33 32 14471: 33 + 34 + #define __BUG_ENTRY(flags) \ 35 + __BUG_ENTRY_START \ 36 + _BUGVERBOSE_LOCATION(__FILE__, __LINE__) \ 37 + .short flags; \ 38 + __BUG_ENTRY_END 34 39 #else 35 40 #define __BUG_ENTRY(flags) 36 41 #endif ··· 45 40 brk BUG_BRK_IMM 46 41 47 42 #define ASM_BUG() ASM_BUG_FLAGS(0) 43 + 44 + #ifdef CONFIG_DEBUG_BUGVERBOSE 45 + #define __BUG_LOCATION_STRING(file, line) \ 46 + ".long " file "- .;" \ 47 + ".short " line ";" 48 + #else 49 + #define __BUG_LOCATION_STRING(file, line) 50 + #endif 51 + 52 + #define __BUG_ENTRY_STRING(file, line, flags) \ 53 + __stringify(__BUG_ENTRY_START) \ 54 + __BUG_LOCATION_STRING(file, line) \ 55 + ".short " flags ";" \ 56 + __stringify(__BUG_ENTRY_END) 57 + 58 + #define ARCH_WARN_ASM(file, line, flags, size) \ 59 + __BUG_ENTRY_STRING(file, line, flags) \ 60 + __stringify(brk BUG_BRK_IMM) 61 + 62 + #define ARCH_WARN_REACHABLE 48 63 49 64 #endif /* __ASM_ASM_BUG_H */