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 | |
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')
-rw-r--r-- | include/asm-powerpc/bug.h (renamed from include/asm-ppc64/bug.h) | 38 | ||||
-rw-r--r-- | include/asm-ppc/bug.h | 58 |
2 files changed, 25 insertions, 71 deletions
diff --git a/include/asm-ppc64/bug.h b/include/asm-powerpc/bug.h index 160178278861..e4d028e87020 100644 --- a/include/asm-ppc64/bug.h +++ b/include/asm-powerpc/bug.h | |||
@@ -1,5 +1,5 @@ | |||
1 | #ifndef _PPC64_BUG_H | 1 | #ifndef _ASM_POWERPC_BUG_H |
2 | #define _PPC64_BUG_H | 2 | #define _ASM_POWERPC_BUG_H |
3 | 3 | ||
4 | /* | 4 | /* |
5 | * Define an illegal instr to trap on the bug. | 5 | * Define an illegal instr to trap on the bug. |
@@ -11,9 +11,21 @@ | |||
11 | 11 | ||
12 | #ifndef __ASSEMBLY__ | 12 | #ifndef __ASSEMBLY__ |
13 | 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 | |||
14 | struct bug_entry { | 26 | struct bug_entry { |
15 | unsigned long bug_addr; | 27 | unsigned long bug_addr; |
16 | long line; | 28 | int line; |
17 | const char *file; | 29 | const char *file; |
18 | const char *function; | 30 | const char *function; |
19 | }; | 31 | }; |
@@ -32,28 +44,28 @@ struct bug_entry *find_bug(unsigned long bugaddr); | |||
32 | __asm__ __volatile__( \ | 44 | __asm__ __volatile__( \ |
33 | "1: twi 31,0,0\n" \ | 45 | "1: twi 31,0,0\n" \ |
34 | ".section __bug_table,\"a\"\n\t" \ | 46 | ".section __bug_table,\"a\"\n\t" \ |
35 | " .llong 1b,%0,%1,%2\n" \ | 47 | BUG_TABLE_ENTRY(1b,%0,%1,%2) \ |
36 | ".previous" \ | 48 | ".previous" \ |
37 | : : "i" (__LINE__), "i" (__FILE__), "i" (__FUNCTION__)); \ | 49 | : : "i" (__LINE__), "i" (__FILE__), "i" (__FUNCTION__)); \ |
38 | } while (0) | 50 | } while (0) |
39 | 51 | ||
40 | #define BUG_ON(x) do { \ | 52 | #define BUG_ON(x) do { \ |
41 | __asm__ __volatile__( \ | 53 | __asm__ __volatile__( \ |
42 | "1: tdnei %0,0\n" \ | 54 | TRAP_OP(%0,0) \ |
43 | ".section __bug_table,\"a\"\n\t" \ | 55 | ".section __bug_table,\"a\"\n\t" \ |
44 | " .llong 1b,%1,%2,%3\n" \ | 56 | BUG_TABLE_ENTRY(1b,%1,%2,%3) \ |
45 | ".previous" \ | 57 | ".previous" \ |
46 | : : "r" ((long long)(x)), "i" (__LINE__), \ | 58 | : : "r" ((DATA_TYPE)(x)), "i" (__LINE__), \ |
47 | "i" (__FILE__), "i" (__FUNCTION__)); \ | 59 | "i" (__FILE__), "i" (__FUNCTION__)); \ |
48 | } while (0) | 60 | } while (0) |
49 | 61 | ||
50 | #define WARN_ON(x) do { \ | 62 | #define WARN_ON(x) do { \ |
51 | __asm__ __volatile__( \ | 63 | __asm__ __volatile__( \ |
52 | "1: tdnei %0,0\n" \ | 64 | TRAP_OP(%0,0) \ |
53 | ".section __bug_table,\"a\"\n\t" \ | 65 | ".section __bug_table,\"a\"\n\t" \ |
54 | " .llong 1b,%1,%2,%3\n" \ | 66 | BUG_TABLE_ENTRY(1b,%1,%2,%3) \ |
55 | ".previous" \ | 67 | ".previous" \ |
56 | : : "r" ((long long)(x)), \ | 68 | : : "r" ((DATA_TYPE)(x)), \ |
57 | "i" (__LINE__ + BUG_WARNING_TRAP), \ | 69 | "i" (__LINE__ + BUG_WARNING_TRAP), \ |
58 | "i" (__FILE__), "i" (__FUNCTION__)); \ | 70 | "i" (__FILE__), "i" (__FUNCTION__)); \ |
59 | } while (0) | 71 | } while (0) |
@@ -61,9 +73,9 @@ struct bug_entry *find_bug(unsigned long bugaddr); | |||
61 | #define HAVE_ARCH_BUG | 73 | #define HAVE_ARCH_BUG |
62 | #define HAVE_ARCH_BUG_ON | 74 | #define HAVE_ARCH_BUG_ON |
63 | #define HAVE_ARCH_WARN_ON | 75 | #define HAVE_ARCH_WARN_ON |
64 | #endif | 76 | #endif /* CONFIG_BUG */ |
65 | #endif | 77 | #endif /* __ASSEMBLY __ */ |
66 | 78 | ||
67 | #include <asm-generic/bug.h> | 79 | #include <asm-generic/bug.h> |
68 | 80 | ||
69 | #endif | 81 | #endif /* _ASM_POWERPC_BUG_H */ |
diff --git a/include/asm-ppc/bug.h b/include/asm-ppc/bug.h deleted file mode 100644 index 8b34fd682b0d..000000000000 --- a/include/asm-ppc/bug.h +++ /dev/null | |||
@@ -1,58 +0,0 @@ | |||
1 | #ifndef _PPC_BUG_H | ||
2 | #define _PPC_BUG_H | ||
3 | |||
4 | struct bug_entry { | ||
5 | unsigned long bug_addr; | ||
6 | int line; | ||
7 | const char *file; | ||
8 | const char *function; | ||
9 | }; | ||
10 | |||
11 | /* | ||
12 | * If this bit is set in the line number it means that the trap | ||
13 | * is for WARN_ON rather than BUG or BUG_ON. | ||
14 | */ | ||
15 | #define BUG_WARNING_TRAP 0x1000000 | ||
16 | |||
17 | #ifdef CONFIG_BUG | ||
18 | #define BUG() do { \ | ||
19 | __asm__ __volatile__( \ | ||
20 | "1: twi 31,0,0\n" \ | ||
21 | ".section __bug_table,\"a\"\n\t" \ | ||
22 | " .long 1b,%0,%1,%2\n" \ | ||
23 | ".previous" \ | ||
24 | : : "i" (__LINE__), "i" (__FILE__), "i" (__FUNCTION__)); \ | ||
25 | } while (0) | ||
26 | |||
27 | #define BUG_ON(x) do { \ | ||
28 | if (!__builtin_constant_p(x) || (x)) { \ | ||
29 | __asm__ __volatile__( \ | ||
30 | "1: twnei %0,0\n" \ | ||
31 | ".section __bug_table,\"a\"\n\t" \ | ||
32 | " .long 1b,%1,%2,%3\n" \ | ||
33 | ".previous" \ | ||
34 | : : "r" (x), "i" (__LINE__), "i" (__FILE__), \ | ||
35 | "i" (__FUNCTION__)); \ | ||
36 | } \ | ||
37 | } while (0) | ||
38 | |||
39 | #define WARN_ON(x) do { \ | ||
40 | if (!__builtin_constant_p(x) || (x)) { \ | ||
41 | __asm__ __volatile__( \ | ||
42 | "1: twnei %0,0\n" \ | ||
43 | ".section __bug_table,\"a\"\n\t" \ | ||
44 | " .long 1b,%1,%2,%3\n" \ | ||
45 | ".previous" \ | ||
46 | : : "r" (x), "i" (__LINE__ + BUG_WARNING_TRAP), \ | ||
47 | "i" (__FILE__), "i" (__FUNCTION__)); \ | ||
48 | } \ | ||
49 | } while (0) | ||
50 | |||
51 | #define HAVE_ARCH_BUG | ||
52 | #define HAVE_ARCH_BUG_ON | ||
53 | #define HAVE_ARCH_WARN_ON | ||
54 | #endif | ||
55 | |||
56 | #include <asm-generic/bug.h> | ||
57 | |||
58 | #endif | ||