diff options
author | Becky Bruce <bgill@freescale.com> | 2005-09-19 18:01:54 -0400 |
---|---|---|
committer | Paul Mackerras <paulus@samba.org> | 2005-09-21 05:21:09 -0400 |
commit | 25433b123ce1a3da78ddd9b848484bca91cbb7a1 (patch) | |
tree | 259ee758b3770894160dd8a732fddd4067ea8699 /include/asm-powerpc | |
parent | 3e57615bb5a8b6208627049884ee441f6d05905e (diff) |
[PATCH] powerpc: Merge bug.h
ppc32/ppc64: Merge bug.h into include/asm-powerpc
This patch merges bug.h into include/asm-powerpc. Changed the data
structure for bug_entry such that line is always an int on both 32 and
64-bit platforms; removed casts to int from the 64-bit trap code to
reflect this.
Signed-off-by: Kumar Gala <kumar.gala@freescale.com>
Signed-off-by: Becky Bruce <Becky.Bruce@freescale.com>
Signed-off-by: Paul Mackerras <paulus@samba.org>
Diffstat (limited to 'include/asm-powerpc')
-rw-r--r-- | include/asm-powerpc/bug.h | 81 |
1 files changed, 81 insertions, 0 deletions
diff --git a/include/asm-powerpc/bug.h b/include/asm-powerpc/bug.h new file mode 100644 index 000000000000..e4d028e87020 --- /dev/null +++ b/include/asm-powerpc/bug.h | |||
@@ -0,0 +1,81 @@ | |||
1 | #ifndef _ASM_POWERPC_BUG_H | ||
2 | #define _ASM_POWERPC_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 | |||
14 | #ifdef __powerpc64__ | ||
15 | #define BUG_TABLE_ENTRY(label, line, file, func) \ | ||
16 | ".llong " #label "\n .long " #line "\n .llong " #file ", " #func "\n" | ||
17 | #define TRAP_OP(ra, rb) "1: tdnei " #ra ", " #rb "\n" | ||
18 | #define DATA_TYPE long long | ||
19 | #else | ||
20 | #define BUG_TABLE_ENTRY(label, line, file, func) \ | ||
21 | ".long " #label ", " #line ", " #file ", " #func "\n" | ||
22 | #define TRAP_OP(ra, rb) "1: twnei " #ra ", " #rb "\n" | ||
23 | #define DATA_TYPE int | ||
24 | #endif /* __powerpc64__ */ | ||
25 | |||
26 | struct bug_entry { | ||
27 | unsigned long bug_addr; | ||
28 | int line; | ||
29 | const char *file; | ||
30 | const char *function; | ||
31 | }; | ||
32 | |||
33 | struct bug_entry *find_bug(unsigned long bugaddr); | ||
34 | |||
35 | /* | ||
36 | * If this bit is set in the line number it means that the trap | ||
37 | * is for WARN_ON rather than BUG or BUG_ON. | ||
38 | */ | ||
39 | #define BUG_WARNING_TRAP 0x1000000 | ||
40 | |||
41 | #ifdef CONFIG_BUG | ||
42 | |||
43 | #define BUG() do { \ | ||
44 | __asm__ __volatile__( \ | ||
45 | "1: twi 31,0,0\n" \ | ||
46 | ".section __bug_table,\"a\"\n\t" \ | ||
47 | BUG_TABLE_ENTRY(1b,%0,%1,%2) \ | ||
48 | ".previous" \ | ||
49 | : : "i" (__LINE__), "i" (__FILE__), "i" (__FUNCTION__)); \ | ||
50 | } while (0) | ||
51 | |||
52 | #define BUG_ON(x) do { \ | ||
53 | __asm__ __volatile__( \ | ||
54 | TRAP_OP(%0,0) \ | ||
55 | ".section __bug_table,\"a\"\n\t" \ | ||
56 | BUG_TABLE_ENTRY(1b,%1,%2,%3) \ | ||
57 | ".previous" \ | ||
58 | : : "r" ((DATA_TYPE)(x)), "i" (__LINE__), \ | ||
59 | "i" (__FILE__), "i" (__FUNCTION__)); \ | ||
60 | } while (0) | ||
61 | |||
62 | #define WARN_ON(x) do { \ | ||
63 | __asm__ __volatile__( \ | ||
64 | TRAP_OP(%0,0) \ | ||
65 | ".section __bug_table,\"a\"\n\t" \ | ||
66 | BUG_TABLE_ENTRY(1b,%1,%2,%3) \ | ||
67 | ".previous" \ | ||
68 | : : "r" ((DATA_TYPE)(x)), \ | ||
69 | "i" (__LINE__ + BUG_WARNING_TRAP), \ | ||
70 | "i" (__FILE__), "i" (__FUNCTION__)); \ | ||
71 | } while (0) | ||
72 | |||
73 | #define HAVE_ARCH_BUG | ||
74 | #define HAVE_ARCH_BUG_ON | ||
75 | #define HAVE_ARCH_WARN_ON | ||
76 | #endif /* CONFIG_BUG */ | ||
77 | #endif /* __ASSEMBLY __ */ | ||
78 | |||
79 | #include <asm-generic/bug.h> | ||
80 | |||
81 | #endif /* _ASM_POWERPC_BUG_H */ | ||