--- zzzz-none-000/linux-4.9.218/arch/mips/include/asm/bug.h 2020-04-02 15:20:41.000000000 +0000 +++ seale-7590ac-750/linux-4.9.218/arch/mips/include/asm/bug.h 2022-11-30 09:46:19.000000000 +0000 @@ -8,16 +8,56 @@ #include +#ifdef CONFIG_BUG_EXTRA_INFO +#define BUG() \ +( { \ + __asm__ __volatile__("1: \n" \ + " break %0\n" \ + " .section __bug_debug_table, \"a\"\n" \ + " .word 1b\n" \ + " .word %1\n" \ + " .word %2\n" \ + " .word %3\n" \ + " .word 0\n" \ + " .previous\n" \ + : \ + : "i"(BRK_BUG), "i"(__FILE__), "i"(__LINE__), "i"(__FUNCTION__)); \ + unreachable(); \ +} ) +#else static inline void __noreturn BUG(void) { __asm__ __volatile__("break %0" : : "i" (BRK_BUG)); unreachable(); } +#endif #define HAVE_ARCH_BUG #if (_MIPS_ISA > _MIPS_ISA_MIPS1) +#ifdef CONFIG_BUG_EXTRA_INFO +#define __BUG_ON(condition) \ +( { \ + if (__builtin_constant_p(condition)) { \ + if (condition) { \ + BUG(); \ + } \ + } else { \ + __asm__ __volatile__("1: \n" \ + " tne $0, %0, %1\n" \ + " .section __bug_debug_table, \"a\"\n" \ + " .word 1b\n" \ + " .word %2\n" \ + " .word %3\n" \ + " .word %4\n" \ + " .word 0\n" \ + " .previous\n" \ + : \ + : "r"(condition), "i"(BRK_BUG), "i"(__FILE__), "i"(__LINE__), "i"(__FUNCTION__)); \ + } \ +} ) +#else static inline void __BUG_ON(unsigned long condition) { if (__builtin_constant_p(condition)) { @@ -29,6 +69,7 @@ __asm__ __volatile__("tne $0, %0, %1" : : "r" (condition), "i" (BRK_BUG)); } +#endif #define BUG_ON(C) __BUG_ON((unsigned long)(C))