hc
2023-12-11 d2ccde1c8e90d38cee87a1b0309ad2827f3fd30d
kernel/arch/powerpc/include/asm/bug.h
....@@ -5,14 +5,6 @@
55
66 #include <asm/asm-compat.h>
77
8
-/*
9
- * Define an illegal instr to trap on the bug.
10
- * We don't use 0 because that marks the end of a function
11
- * in the ELF ABI. That's "Boo Boo" in case you wonder...
12
- */
13
-#define BUG_OPCODE .long 0x00b00b00 /* For asm */
14
-#define BUG_ILLEGAL_INSTR "0x00b00b00" /* For BUG macro */
15
-
168 #ifdef CONFIG_BUG
179
1810 #ifdef __ASSEMBLY__
....@@ -57,6 +49,15 @@
5749 ".previous\n"
5850 #endif
5951
52
+#define BUG_ENTRY(insn, flags, ...) \
53
+ __asm__ __volatile__( \
54
+ "1: " insn "\n" \
55
+ _EMIT_BUG_ENTRY \
56
+ : : "i" (__FILE__), "i" (__LINE__), \
57
+ "i" (flags), \
58
+ "i" (sizeof(struct bug_entry)), \
59
+ ##__VA_ARGS__)
60
+
6061 /*
6162 * BUG_ON() and WARN_ON() do their best to cooperate with compile-time
6263 * optimisations. However depending on the complexity of the condition
....@@ -64,11 +65,7 @@
6465 */
6566
6667 #define BUG() do { \
67
- __asm__ __volatile__( \
68
- "1: twi 31,0,0\n" \
69
- _EMIT_BUG_ENTRY \
70
- : : "i" (__FILE__), "i" (__LINE__), \
71
- "i" (0), "i" (sizeof(struct bug_entry))); \
68
+ BUG_ENTRY("twi 31, 0, 0", 0); \
7269 unreachable(); \
7370 } while (0)
7471
....@@ -77,23 +74,11 @@
7774 if (x) \
7875 BUG(); \
7976 } else { \
80
- __asm__ __volatile__( \
81
- "1: "PPC_TLNEI" %4,0\n" \
82
- _EMIT_BUG_ENTRY \
83
- : : "i" (__FILE__), "i" (__LINE__), "i" (0), \
84
- "i" (sizeof(struct bug_entry)), \
85
- "r" ((__force long)(x))); \
77
+ BUG_ENTRY(PPC_TLNEI " %4, 0", 0, "r" ((__force long)(x))); \
8678 } \
8779 } while (0)
8880
89
-#define __WARN_FLAGS(flags) do { \
90
- __asm__ __volatile__( \
91
- "1: twi 31,0,0\n" \
92
- _EMIT_BUG_ENTRY \
93
- : : "i" (__FILE__), "i" (__LINE__), \
94
- "i" (BUGFLAG_WARNING|(flags)), \
95
- "i" (sizeof(struct bug_entry))); \
96
-} while (0)
81
+#define __WARN_FLAGS(flags) BUG_ENTRY("twi 31, 0, 0", BUGFLAG_WARNING | (flags))
9782
9883 #define WARN_ON(x) ({ \
9984 int __ret_warn_on = !!(x); \
....@@ -101,13 +86,9 @@
10186 if (__ret_warn_on) \
10287 __WARN(); \
10388 } else { \
104
- __asm__ __volatile__( \
105
- "1: "PPC_TLNEI" %4,0\n" \
106
- _EMIT_BUG_ENTRY \
107
- : : "i" (__FILE__), "i" (__LINE__), \
108
- "i" (BUGFLAG_WARNING|BUGFLAG_TAINT(TAINT_WARN)),\
109
- "i" (sizeof(struct bug_entry)), \
110
- "r" (__ret_warn_on)); \
89
+ BUG_ENTRY(PPC_TLNEI " %4, 0", \
90
+ BUGFLAG_WARNING | BUGFLAG_TAINT(TAINT_WARN), \
91
+ "r" (__ret_warn_on)); \
11192 } \
11293 unlikely(__ret_warn_on); \
11394 })
....@@ -133,7 +114,7 @@
133114 extern int do_page_fault(struct pt_regs *, unsigned long, unsigned long);
134115 extern void bad_page_fault(struct pt_regs *, unsigned long, int);
135116 extern void _exception(int, struct pt_regs *, int, unsigned long);
136
-extern void _exception_pkey(int, struct pt_regs *, int, unsigned long, int);
117
+extern void _exception_pkey(struct pt_regs *, unsigned long, int);
137118 extern void die(const char *, struct pt_regs *, long);
138119 extern bool die_will_crash(void);
139120 extern void panic_flush_kmsg_start(void);