mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-28 02:32:09 -04:00
[POWERPC] Generic BUG for powerpc
This makes powerpc use the generic BUG machinery. The biggest reports the function name, since it is redundant with kallsyms, and not needed in general. There is an overall reduction of code, since module_32/64 duplicated several functions. Unfortunately there's no way to tell gcc that BUG won't return, so the BUG macro includes a goto loop. This will generate a real jmp instruction, which is never used. [[email protected]: build fix] [[email protected]: remove infinite loop in BUG_ON] Signed-off-by: Jeremy Fitzhardinge <[email protected]> Cc: Andi Kleen <[email protected]> Cc: Hugh Dickens <[email protected]> Cc: Michael Ellerman <[email protected]> Cc: Benjamin Herrenschmidt <[email protected]> Cc: Rusty Russell <[email protected]> Signed-off-by: Andrew Morton <[email protected]> Signed-off-by: Paul Mackerras <[email protected]>
This commit is contained in:
parent
973c1fabc7
commit
73c9ceab40
8 changed files with 69 additions and 134 deletions
|
|
@ -13,36 +13,39 @@
|
|||
|
||||
#ifndef __ASSEMBLY__
|
||||
|
||||
struct bug_entry {
|
||||
unsigned long bug_addr;
|
||||
long line;
|
||||
const char *file;
|
||||
const char *function;
|
||||
};
|
||||
|
||||
struct bug_entry *find_bug(unsigned long bugaddr);
|
||||
|
||||
/*
|
||||
* If this bit is set in the line number it means that the trap
|
||||
* is for WARN_ON rather than BUG or BUG_ON.
|
||||
*/
|
||||
#define BUG_WARNING_TRAP 0x1000000
|
||||
|
||||
#ifdef CONFIG_BUG
|
||||
|
||||
/* _EMIT_BUG_ENTRY expects args %0,%1,%2,%3 to be FILE, LINE, flags and
|
||||
sizeof(struct bug_entry), respectively */
|
||||
#ifdef CONFIG_DEBUG_BUGVERBOSE
|
||||
#define _EMIT_BUG_ENTRY \
|
||||
".section __bug_table,\"a\"\n" \
|
||||
"2:\t" PPC_LONG "1b, %0\n" \
|
||||
"\t.short %1, %2\n" \
|
||||
".org 2b+%3\n" \
|
||||
".previous\n"
|
||||
#else
|
||||
#define _EMIT_BUG_ENTRY \
|
||||
".section __bug_table,\"a\"\n" \
|
||||
"2:\t" PPC_LONG "1b\n" \
|
||||
"\t.short %2\n" \
|
||||
".org 2b+%3\n" \
|
||||
".previous\n"
|
||||
#endif
|
||||
|
||||
/*
|
||||
* BUG_ON() and WARN_ON() do their best to cooperate with compile-time
|
||||
* optimisations. However depending on the complexity of the condition
|
||||
* some compiler versions may not produce optimal results.
|
||||
*/
|
||||
|
||||
#define BUG() do { \
|
||||
__asm__ __volatile__( \
|
||||
"1: twi 31,0,0\n" \
|
||||
".section __bug_table,\"a\"\n" \
|
||||
"\t"PPC_LONG" 1b,%0,%1,%2\n" \
|
||||
".previous" \
|
||||
: : "i" (__LINE__), "i" (__FILE__), "i" (__FUNCTION__)); \
|
||||
#define BUG() do { \
|
||||
__asm__ __volatile__( \
|
||||
"1: twi 31,0,0\n" \
|
||||
_EMIT_BUG_ENTRY \
|
||||
: : "i" (__FILE__), "i" (__LINE__), \
|
||||
"i" (0), "i" (sizeof(struct bug_entry))); \
|
||||
for(;;) ; \
|
||||
} while (0)
|
||||
|
||||
#define BUG_ON(x) do { \
|
||||
|
|
@ -51,23 +54,21 @@ struct bug_entry *find_bug(unsigned long bugaddr);
|
|||
BUG(); \
|
||||
} else { \
|
||||
__asm__ __volatile__( \
|
||||
"1: "PPC_TLNEI" %0,0\n" \
|
||||
".section __bug_table,\"a\"\n" \
|
||||
"\t"PPC_LONG" 1b,%1,%2,%3\n" \
|
||||
".previous" \
|
||||
: : "r" ((long)(x)), "i" (__LINE__), \
|
||||
"i" (__FILE__), "i" (__FUNCTION__)); \
|
||||
"1: "PPC_TLNEI" %4,0\n" \
|
||||
_EMIT_BUG_ENTRY \
|
||||
: : "i" (__FILE__), "i" (__LINE__), "i" (0), \
|
||||
"i" (sizeof(struct bug_entry)), \
|
||||
"r" ((long)(x))); \
|
||||
} \
|
||||
} while (0)
|
||||
|
||||
#define __WARN() do { \
|
||||
__asm__ __volatile__( \
|
||||
"1: twi 31,0,0\n" \
|
||||
".section __bug_table,\"a\"\n" \
|
||||
"\t"PPC_LONG" 1b,%0,%1,%2\n" \
|
||||
".previous" \
|
||||
: : "i" (__LINE__ + BUG_WARNING_TRAP), \
|
||||
"i" (__FILE__), "i" (__FUNCTION__)); \
|
||||
_EMIT_BUG_ENTRY \
|
||||
: : "i" (__FILE__), "i" (__LINE__), \
|
||||
"i" (BUGFLAG_WARNING), \
|
||||
"i" (sizeof(struct bug_entry))); \
|
||||
} while (0)
|
||||
|
||||
#define WARN_ON(x) ({ \
|
||||
|
|
@ -77,13 +78,12 @@ struct bug_entry *find_bug(unsigned long bugaddr);
|
|||
__WARN(); \
|
||||
} else { \
|
||||
__asm__ __volatile__( \
|
||||
"1: "PPC_TLNEI" %0,0\n" \
|
||||
".section __bug_table,\"a\"\n" \
|
||||
"\t"PPC_LONG" 1b,%1,%2,%3\n" \
|
||||
".previous" \
|
||||
: : "r" (__ret_warn_on), \
|
||||
"i" (__LINE__ + BUG_WARNING_TRAP), \
|
||||
"i" (__FILE__), "i" (__FUNCTION__)); \
|
||||
"1: "PPC_TLNEI" %4,0\n" \
|
||||
_EMIT_BUG_ENTRY \
|
||||
: : "i" (__FILE__), "i" (__LINE__), \
|
||||
"i" (BUGFLAG_WARNING), \
|
||||
"i" (sizeof(struct bug_entry)), \
|
||||
"r" (__ret_warn_on)); \
|
||||
} \
|
||||
unlikely(__ret_warn_on); \
|
||||
})
|
||||
|
|
|
|||
|
|
@ -46,8 +46,6 @@ struct mod_arch_specific {
|
|||
unsigned int num_bugs;
|
||||
};
|
||||
|
||||
extern struct bug_entry *module_find_bug(unsigned long bugaddr);
|
||||
|
||||
/*
|
||||
* Select ELF headers.
|
||||
* Make empty section for module_frob_arch_sections to expand.
|
||||
|
|
|
|||
Loading…
Reference in a new issue