Commit 841c7879 authored by Pete Zaitcev's avatar Pete Zaitcev Committed by David S. Miller

[SPARC]: Sanitize BUG().

parent 6befb79d
......@@ -1000,6 +1000,13 @@ config DEBUG_SPINLOCK_SLEEP
If you say Y here, various routines which may sleep will become very
noisy if they are called with a spinlock held.
config DEBUG_BUGVERBOSE
bool "Verbose BUG() reporting (adds 70K)"
help
Say Y here to make BUG() panics output the file name and line number
of the BUG call as well as the EIP and oops trace. This aids
debugging but costs about 70-100K of memory.
endmenu
source "security/Kconfig"
......
......@@ -53,6 +53,7 @@
#endif
#include <asm/a.out.h>
#include <asm/io-unit.h>
#include <asm/bug.h>
extern spinlock_t rtc_lock;
......@@ -312,5 +313,9 @@ EXPORT_SYMBOL_DOT(umul);
EXPORT_SYMBOL_DOT(div);
EXPORT_SYMBOL_DOT(udiv);
#ifdef CONFIG_DEBUG_BUGVERBOSE
EXPORT_SYMBOL(do_BUG);
#endif
/* Sun Power Management Idle Handler */
EXPORT_SYMBOL(pm_idle);
......@@ -463,6 +463,14 @@ void handle_hw_divzero(struct pt_regs *regs, unsigned long pc, unsigned long npc
send_sig_info(SIGFPE, &info, current);
}
#ifdef CONFIG_DEBUG_BUGVERBOSE
void do_BUG(const char *file, int line)
{
// bust_spinlocks(1); XXX Not in our original BUG()
printk("kernel BUG at %s:%d!\n", file, line);
}
#endif
/* Since we have our mappings set up, on multiprocessors we can spin them
* up here so that timer interrupts work during initialization.
*/
......
......@@ -2,24 +2,18 @@
#ifndef _SPARC_BUG_H
#define _SPARC_BUG_H
/*
* XXX I am hitting compiler bugs with __builtin_trap. This has
* hit me before and rusty was blaming his netfilter bugs on
* this so lets disable it. - Anton
*/
#if 0
/* We need the mb()'s so we don't trigger a compiler bug - Anton */
#ifdef CONFIG_DEBUG_BUGVERBOSE
extern void do_BUG(const char *file, int line);
#define BUG() do { \
mb(); \
do_BUG(__FILE__, __LINE__); \
__builtin_trap(); \
mb(); \
} while(0)
#else
#define BUG() do { \
printk("kernel BUG at %s:%d!\n", __FILE__, __LINE__); *(int *)0=0; \
} while (0)
#else
#define BUG() __builtin_trap()
#endif
#define PAGE_BUG(page) BUG()
#define PAGE_BUG(page) do { \
BUG(); \
} while (0)
#endif
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