aboutsummaryrefslogtreecommitdiffstats
path: root/include/asm-ppc64/bug.h
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@ppc970.osdl.org>2005-04-16 18:20:36 -0400
committerLinus Torvalds <torvalds@ppc970.osdl.org>2005-04-16 18:20:36 -0400
commit1da177e4c3f41524e886b7f1b8a0c1fc7321cac2 (patch)
tree0bba044c4ce775e45a88a51686b5d9f90697ea9d /include/asm-ppc64/bug.h
Linux-2.6.12-rc2v2.6.12-rc2
Initial git repository build. I'm not bothering with the full history, even though we have it. We can create a separate "historical" git archive of that later if we want to, and in the meantime it's about 3.2GB when imported into git - space that would just make the early git days unnecessarily complicated, when we don't have a lot of good infrastructure for it. Let it rip!
Diffstat (limited to 'include/asm-ppc64/bug.h')
-rw-r--r--include/asm-ppc64/bug.h65
1 files changed, 65 insertions, 0 deletions
diff --git a/include/asm-ppc64/bug.h b/include/asm-ppc64/bug.h
new file mode 100644
index 000000000000..db31dd22233c
--- /dev/null
+++ b/include/asm-ppc64/bug.h
@@ -0,0 +1,65 @@
1#ifndef _PPC64_BUG_H
2#define _PPC64_BUG_H
3
4/*
5 * Define an illegal instr to trap on the bug.
6 * We don't use 0 because that marks the end of a function
7 * in the ELF ABI. That's "Boo Boo" in case you wonder...
8 */
9#define BUG_OPCODE .long 0x00b00b00 /* For asm */
10#define BUG_ILLEGAL_INSTR "0x00b00b00" /* For BUG macro */
11
12#ifndef __ASSEMBLY__
13
14struct bug_entry {
15 unsigned long bug_addr;
16 long line;
17 const char *file;
18 const char *function;
19};
20
21struct bug_entry *find_bug(unsigned long bugaddr);
22
23/*
24 * If this bit is set in the line number it means that the trap
25 * is for WARN_ON rather than BUG or BUG_ON.
26 */
27#define BUG_WARNING_TRAP 0x1000000
28
29#define BUG() do { \
30 __asm__ __volatile__( \
31 "1: twi 31,0,0\n" \
32 ".section __bug_table,\"a\"\n\t" \
33 " .llong 1b,%0,%1,%2\n" \
34 ".previous" \
35 : : "i" (__LINE__), "i" (__FILE__), "i" (__FUNCTION__)); \
36} while (0)
37
38#define BUG_ON(x) do { \
39 __asm__ __volatile__( \
40 "1: tdnei %0,0\n" \
41 ".section __bug_table,\"a\"\n\t" \
42 " .llong 1b,%1,%2,%3\n" \
43 ".previous" \
44 : : "r" (x), "i" (__LINE__), "i" (__FILE__), \
45 "i" (__FUNCTION__)); \
46} while (0)
47
48#define WARN_ON(x) do { \
49 __asm__ __volatile__( \
50 "1: tdnei %0,0\n" \
51 ".section __bug_table,\"a\"\n\t" \
52 " .llong 1b,%1,%2,%3\n" \
53 ".previous" \
54 : : "r" (x), "i" (__LINE__ + BUG_WARNING_TRAP), \
55 "i" (__FILE__), "i" (__FUNCTION__)); \
56} while (0)
57
58#endif
59
60#define HAVE_ARCH_BUG
61#define HAVE_ARCH_BUG_ON
62#define HAVE_ARCH_WARN_ON
63#include <asm-generic/bug.h>
64
65#endif