diff options
| author | Paul Mackerras <paulus@samba.org> | 2003-06-06 23:14:11 -0700 |
|---|---|---|
| committer | Linus Torvalds <torvalds@home.transmeta.com> | 2003-06-06 23:14:11 -0700 |
| commit | f822f1510915fd6cc8906556e23d2e28defba7cd (patch) | |
| tree | d66bfaa6dcd85e000e058be67ab6b86715a6b0bb /include/linux/kernel.h | |
| parent | 1eb83e09834fe260003242be9aeb0cee7d0e5dc4 (diff) | |
[PATCH] Move BUG/BUG_ON/WARN_ON to asm headers
This patch moves the definitions of BUG, BUG_ON and WARN_ON from
<linux/kernel.h> to <asm/bug.h> (which <linux/kernel.h> includes), and
supplies a new implementation for PPC which uses a conditional trap
instruction for BUG_ON and WARN_ON, thus avoiding a conditional
branch. This patch trims over 50kB from the size of the kernel that I
use on powermacs.
With this patch, on PPC we have a __bug_table section in the vmlinux
binary, and also in modules if they use BUG, BUG_ON or WARN_ON. The
__bug_table section has one entry for each BUG/BUG_ON/WARN_ON, giving
the address of the trap instruction and the corresponding line number,
filename and function name. This information is used in the exception
handler for the exception that the trap instruction produces. The
arch-specific module code handles the __bug_table section so that
BUG/BUG_ON/WARN_ON work correctly in modules.
Several architecture maintainers have acked this change. It should be
completely benign for all of the other architectures (though they may
decide to do something similar if they have a conditional trap
instruction available).
Diffstat (limited to 'include/linux/kernel.h')
| -rw-r--r-- | include/linux/kernel.h | 8 |
1 files changed, 0 insertions, 8 deletions
diff --git a/include/linux/kernel.h b/include/linux/kernel.h index 131edf4cdbb4..5f4ff79737a8 100644 --- a/include/linux/kernel.h +++ b/include/linux/kernel.h @@ -228,14 +228,6 @@ struct sysinfo { char _f[20-2*sizeof(long)-sizeof(int)]; /* Padding: libc5 uses this.. */ }; -#define BUG_ON(condition) do { if (unlikely((condition)!=0)) BUG(); } while(0) -#define WARN_ON(condition) do { \ - if (unlikely((condition)!=0)) { \ - printk("Badness in %s at %s:%d\n", __FUNCTION__, __FILE__, __LINE__); \ - dump_stack(); \ - } \ -} while (0) - extern void BUILD_BUG(void); #define BUILD_BUG_ON(condition) do { if (condition) BUILD_BUG(); } while(0) |
