diff options
author | Helge Deller <deller@gmx.de> | 2006-12-16 10:16:50 -0500 |
---|---|---|
committer | Kyle McMartin <kyle@athena.road.mcmartin.ca> | 2007-02-17 00:51:46 -0500 |
commit | 6891f8a1135b964f8ef30521d1473d5d137af0fa (patch) | |
tree | d9b7d1e240107dc25fb864b81dbc6fc4bdc5895b /include/asm-parisc | |
parent | 9f15c82686251cd2b97ac6859de62959d3c4afe1 (diff) |
[PARISC] Generic BUG
Signed-off-by: Helge Deller <deller@gmx.de>
Signed-off-by: Kyle McMartin <kyle@parisc-linux.org>
Diffstat (limited to 'include/asm-parisc')
-rw-r--r-- | include/asm-parisc/bug.h | 73 |
1 files changed, 68 insertions, 5 deletions
diff --git a/include/asm-parisc/bug.h b/include/asm-parisc/bug.h index 695588da41f8..8dd199f5d6d7 100644 --- a/include/asm-parisc/bug.h +++ b/include/asm-parisc/bug.h | |||
@@ -1,14 +1,77 @@ | |||
1 | #ifndef _PARISC_BUG_H | 1 | #ifndef _PARISC_BUG_H |
2 | #define _PARISC_BUG_H | 2 | #define _PARISC_BUG_H |
3 | 3 | ||
4 | /* | ||
5 | * Tell the user there is some problem. | ||
6 | * The offending file and line are encoded in the __bug_table section. | ||
7 | */ | ||
8 | |||
4 | #ifdef CONFIG_BUG | 9 | #ifdef CONFIG_BUG |
5 | #define HAVE_ARCH_BUG | 10 | #define HAVE_ARCH_BUG |
6 | #define BUG() do { \ | 11 | #define HAVE_ARCH_WARN_ON |
7 | printk("kernel BUG at %s:%d!\n", __FILE__, __LINE__); \ | 12 | |
8 | dump_stack(); \ | 13 | /* the break instruction is used as BUG() marker. */ |
9 | panic("BUG!"); \ | 14 | #define PARISC_BUG_BREAK_ASM "break 0x1f, 0x1fff" |
10 | } while (0) | 15 | #define PARISC_BUG_BREAK_INSN 0x03ffe01f /* PARISC_BUG_BREAK_ASM */ |
16 | |||
17 | #ifdef CONFIG_64BIT | ||
18 | #define ASM_ULONG_INSN ".dword" | ||
19 | #else | ||
20 | #define ASM_ULONG_INSN ".word" | ||
21 | #endif | ||
22 | |||
23 | #ifdef CONFIG_DEBUG_BUGVERBOSE | ||
24 | #define BUG() \ | ||
25 | do { \ | ||
26 | asm volatile("\n" \ | ||
27 | "1:\t" PARISC_BUG_BREAK_ASM "\n" \ | ||
28 | "\t.pushsection __bug_table,\"a\"\n" \ | ||
29 | "2:\t" ASM_ULONG_INSN " 1b, %c0\n" \ | ||
30 | "\t.short %c1, %c2\n" \ | ||
31 | "\t.org 2b+%c3\n" \ | ||
32 | "\t.popsection" \ | ||
33 | : : "i" (__FILE__), "i" (__LINE__), \ | ||
34 | "i" (0), "i" (sizeof(struct bug_entry)) ); \ | ||
35 | for(;;) ; \ | ||
36 | } while(0) | ||
37 | |||
38 | #else | ||
39 | #define BUG() \ | ||
40 | do { \ | ||
41 | asm volatile(PARISC_BUG_BREAK_ASM : : ); \ | ||
42 | for(;;) ; \ | ||
43 | } while(0) | ||
44 | #endif | ||
45 | |||
46 | #define __WARN() \ | ||
47 | do { \ | ||
48 | asm volatile("\n" \ | ||
49 | "1:\t" PARISC_BUG_BREAK_ASM "\n" \ | ||
50 | "\t.pushsection __bug_table,\"a\"\n" \ | ||
51 | "2:\t" ASM_ULONG_INSN " 1b, %c0\n" \ | ||
52 | "\t.short %c1, %c2\n" \ | ||
53 | "\t.org 2b+%c3\n" \ | ||
54 | "\t.popsection" \ | ||
55 | : : "i" (__FILE__), "i" (__LINE__), \ | ||
56 | "i" (BUGFLAG_WARNING), \ | ||
57 | "i" (sizeof(struct bug_entry)) ); \ | ||
58 | } while(0) | ||
59 | |||
60 | |||
61 | #define WARN_ON(x) ({ \ | ||
62 | typeof(x) __ret_warn_on = (x); \ | ||
63 | if (__builtin_constant_p(__ret_warn_on)) { \ | ||
64 | if (__ret_warn_on) \ | ||
65 | __WARN(); \ | ||
66 | } else { \ | ||
67 | if (unlikely(__ret_warn_on)) \ | ||
68 | __WARN(); \ | ||
69 | } \ | ||
70 | unlikely(__ret_warn_on); \ | ||
71 | }) | ||
72 | |||
11 | #endif | 73 | #endif |
12 | 74 | ||
13 | #include <asm-generic/bug.h> | 75 | #include <asm-generic/bug.h> |
14 | #endif | 76 | #endif |
77 | |||