Commit 104dd65f authored by Paul Mackerras's avatar Paul Mackerras

powerpc: clean up bug.h further

This simplifies the macros which are different between 32-bit and
64-bit.  It also fixes a couple of printks on the bug->line element,
which is now a long.
Signed-off-by: default avatarPaul Mackerras <paulus@samba.org>
parent b5ca71a5
...@@ -749,22 +749,22 @@ static int check_bug_trap(struct pt_regs *regs) ...@@ -749,22 +749,22 @@ static int check_bug_trap(struct pt_regs *regs)
if (bug->line & BUG_WARNING_TRAP) { if (bug->line & BUG_WARNING_TRAP) {
/* this is a WARN_ON rather than BUG/BUG_ON */ /* this is a WARN_ON rather than BUG/BUG_ON */
#ifdef CONFIG_XMON #ifdef CONFIG_XMON
xmon_printf(KERN_ERR "Badness in %s at %s:%d\n", xmon_printf(KERN_ERR "Badness in %s at %s:%ld\n",
bug->function, bug->file, bug->function, bug->file,
bug->line & ~BUG_WARNING_TRAP); bug->line & ~BUG_WARNING_TRAP);
#endif /* CONFIG_XMON */ #endif /* CONFIG_XMON */
printk(KERN_ERR "Badness in %s at %s:%d\n", printk(KERN_ERR "Badness in %s at %s:%ld\n",
bug->function, bug->file, bug->function, bug->file,
bug->line & ~BUG_WARNING_TRAP); bug->line & ~BUG_WARNING_TRAP);
dump_stack(); dump_stack();
return 1; return 1;
} }
#ifdef CONFIG_XMON #ifdef CONFIG_XMON
xmon_printf(KERN_CRIT "kernel BUG in %s at %s:%d!\n", xmon_printf(KERN_CRIT "kernel BUG in %s at %s:%ld!\n",
bug->function, bug->file, bug->line); bug->function, bug->file, bug->line);
xmon(regs); xmon(regs);
#endif /* CONFIG_XMON */ #endif /* CONFIG_XMON */
printk(KERN_CRIT "kernel BUG in %s at %s:%d!\n", printk(KERN_CRIT "kernel BUG in %s at %s:%ld!\n",
bug->function, bug->file, bug->line); bug->function, bug->file, bug->line);
return 0; return 0;
......
...@@ -12,13 +12,11 @@ ...@@ -12,13 +12,11 @@
#ifndef __ASSEMBLY__ #ifndef __ASSEMBLY__
#ifdef __powerpc64__ #ifdef __powerpc64__
#define BUG_TABLE_ENTRY(label, line, file, func) \ #define BUG_TABLE_ENTRY ".llong"
".llong " #label ", " #line ", " #file ", " #func "\n" #define BUG_TRAP_OP "tdnei"
#define TRAP_OP(ra, rb) "1: tdnei " #ra ", " #rb "\n"
#else #else
#define BUG_TABLE_ENTRY(label, line, file, func) \ #define BUG_TABLE_ENTRY ".long"
".long " #label ", " #line ", " #file ", " #func "\n" #define BUG_TRAP_OP "twnei"
#define TRAP_OP(ra, rb) "1: twnei " #ra ", " #rb "\n"
#endif /* __powerpc64__ */ #endif /* __powerpc64__ */
struct bug_entry { struct bug_entry {
...@@ -41,17 +39,17 @@ struct bug_entry *find_bug(unsigned long bugaddr); ...@@ -41,17 +39,17 @@ struct bug_entry *find_bug(unsigned long bugaddr);
#define BUG() do { \ #define BUG() do { \
__asm__ __volatile__( \ __asm__ __volatile__( \
"1: twi 31,0,0\n" \ "1: twi 31,0,0\n" \
".section __bug_table,\"a\"\n\t" \ ".section __bug_table,\"a\"\n" \
BUG_TABLE_ENTRY(1b,%0,%1,%2) \ "\t"BUG_TABLE_ENTRY" 1b,%0,%1,%2\n" \
".previous" \ ".previous" \
: : "i" (__LINE__), "i" (__FILE__), "i" (__FUNCTION__)); \ : : "i" (__LINE__), "i" (__FILE__), "i" (__FUNCTION__)); \
} while (0) } while (0)
#define BUG_ON(x) do { \ #define BUG_ON(x) do { \
__asm__ __volatile__( \ __asm__ __volatile__( \
TRAP_OP(%0,0) \ "1: "BUG_TRAP_OP" %0,0\n" \
".section __bug_table,\"a\"\n\t" \ ".section __bug_table,\"a\"\n" \
BUG_TABLE_ENTRY(1b,%1,%2,%3) \ "\t"BUG_TABLE_ENTRY" 1b,%1,%2,%3\n" \
".previous" \ ".previous" \
: : "r" ((long)(x)), "i" (__LINE__), \ : : "r" ((long)(x)), "i" (__LINE__), \
"i" (__FILE__), "i" (__FUNCTION__)); \ "i" (__FILE__), "i" (__FUNCTION__)); \
...@@ -59,9 +57,9 @@ struct bug_entry *find_bug(unsigned long bugaddr); ...@@ -59,9 +57,9 @@ struct bug_entry *find_bug(unsigned long bugaddr);
#define WARN_ON(x) do { \ #define WARN_ON(x) do { \
__asm__ __volatile__( \ __asm__ __volatile__( \
TRAP_OP(%0,0) \ "1: "BUG_TRAP_OP" %0,0\n" \
".section __bug_table,\"a\"\n\t" \ ".section __bug_table,\"a\"\n" \
BUG_TABLE_ENTRY(1b,%1,%2,%3) \ "\t"BUG_TABLE_ENTRY" 1b,%1,%2,%3\n" \
".previous" \ ".previous" \
: : "r" ((long)(x)), \ : : "r" ((long)(x)), \
"i" (__LINE__ + BUG_WARNING_TRAP), \ "i" (__LINE__ + BUG_WARNING_TRAP), \
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment