diff options
author | Jesper Nilsson <jesper.nilsson@axis.com> | 2008-01-17 04:42:58 -0500 |
---|---|---|
committer | Jesper Nilsson <jesper.nilsson@axis.com> | 2008-02-08 05:06:28 -0500 |
commit | 0dfb8c35703709ca5e8f58e019d72383110999a7 (patch) | |
tree | 825532e0771ed49704f7649029be392e72559b53 /include/asm-cris | |
parent | fbdb5f865b570e34d6e0d17f327f8d9bc2c4ccc6 (diff) |
CRIS: Add architecture dependent bug.h for CRIS v10 and CRIS v32
Diffstat (limited to 'include/asm-cris')
-rw-r--r-- | include/asm-cris/arch-v10/bug.h | 66 | ||||
-rw-r--r-- | include/asm-cris/arch-v32/bug.h | 33 |
2 files changed, 99 insertions, 0 deletions
diff --git a/include/asm-cris/arch-v10/bug.h b/include/asm-cris/arch-v10/bug.h new file mode 100644 index 000000000000..3485d6b34bb0 --- /dev/null +++ b/include/asm-cris/arch-v10/bug.h | |||
@@ -0,0 +1,66 @@ | |||
1 | #ifndef __ASM_CRISv10_ARCH_BUG_H | ||
2 | #define __ASM_CRISv10_ARCH_BUG_H | ||
3 | |||
4 | #include <linux/stringify.h> | ||
5 | |||
6 | #ifdef CONFIG_BUG | ||
7 | #ifdef CONFIG_DEBUG_BUGVERBOSE | ||
8 | /* The BUG() macro is used for marking obviously incorrect code paths. | ||
9 | * It will cause a message with the file name and line number to be printed, | ||
10 | * and then cause an oops. The message is actually printed by handle_BUG() | ||
11 | * in arch/cris/kernel/traps.c, and the reason we use this method of storing | ||
12 | * the file name and line number is that we do not want to affect the registers | ||
13 | * by calling printk() before causing the oops. | ||
14 | */ | ||
15 | |||
16 | #define BUG_PREFIX 0x0D7F | ||
17 | #define BUG_MAGIC 0x00001234 | ||
18 | |||
19 | struct bug_frame { | ||
20 | unsigned short prefix; | ||
21 | unsigned int magic; | ||
22 | unsigned short clear; | ||
23 | unsigned short movu; | ||
24 | unsigned short line; | ||
25 | unsigned short jump; | ||
26 | unsigned char *filename; | ||
27 | }; | ||
28 | |||
29 | #if 0 | ||
30 | /* Unfortunately this version of the macro does not work due to a problem | ||
31 | * with the compiler (aka a bug) when compiling with -O2, which sometimes | ||
32 | * erroneously causes the second input to be stored in a register... | ||
33 | */ | ||
34 | #define BUG() \ | ||
35 | __asm__ __volatile__ ("clear.d [" __stringify(BUG_MAGIC) "]\n\t"\ | ||
36 | "movu.w %0,$r0\n\t" \ | ||
37 | "jump %1\n\t" \ | ||
38 | : : "i" (__LINE__), "i" (__FILE__)) | ||
39 | #else | ||
40 | /* This version will have to do for now, until the compiler is fixed. | ||
41 | * The drawbacks of this version are that the file name will appear multiple | ||
42 | * times in the .rodata section, and that __LINE__ and __FILE__ can probably | ||
43 | * not be used like this with newer versions of gcc. | ||
44 | */ | ||
45 | #define BUG() \ | ||
46 | __asm__ __volatile__ ("clear.d [" __stringify(BUG_MAGIC) "]\n\t"\ | ||
47 | "movu.w " __stringify(__LINE__) ",$r0\n\t"\ | ||
48 | "jump 0f\n\t" \ | ||
49 | ".section .rodata\n" \ | ||
50 | "0:\t.string \"" __FILE__ "\"\n\t" \ | ||
51 | ".previous") | ||
52 | #endif | ||
53 | |||
54 | #else | ||
55 | |||
56 | /* This just causes an oops. */ | ||
57 | #define BUG() (*(int *)0 = 0) | ||
58 | |||
59 | #endif | ||
60 | |||
61 | #define HAVE_ARCH_BUG | ||
62 | #endif | ||
63 | |||
64 | #include <asm-generic/bug.h> | ||
65 | |||
66 | #endif | ||
diff --git a/include/asm-cris/arch-v32/bug.h b/include/asm-cris/arch-v32/bug.h new file mode 100644 index 000000000000..0f211e135248 --- /dev/null +++ b/include/asm-cris/arch-v32/bug.h | |||
@@ -0,0 +1,33 @@ | |||
1 | #ifndef __ASM_CRISv32_ARCH_BUG_H | ||
2 | #define __ASM_CRISv32_ARCH_BUG_H | ||
3 | |||
4 | #include <linux/stringify.h> | ||
5 | |||
6 | #ifdef CONFIG_BUG | ||
7 | #ifdef CONFIG_DEBUG_BUGVERBOSE | ||
8 | /* | ||
9 | * The penalty for the in-band code path will be the size of break 14. | ||
10 | * All other stuff is done out-of-band with exception handlers. | ||
11 | */ | ||
12 | #define BUG() \ | ||
13 | __asm__ __volatile__ ("0: break 14\n\t" \ | ||
14 | ".section .fixup,\"ax\"\n" \ | ||
15 | "1:\n\t" \ | ||
16 | "move.d %0, $r10\n\t" \ | ||
17 | "move.d %1, $r11\n\t" \ | ||
18 | "jump do_BUG\n\t" \ | ||
19 | "nop\n\t" \ | ||
20 | ".previous\n\t" \ | ||
21 | ".section __ex_table,\"a\"\n\t" \ | ||
22 | ".dword 0b, 1b\n\t" \ | ||
23 | ".previous\n\t" \ | ||
24 | : : "ri" (__FILE__), "i" (__LINE__)) | ||
25 | #else | ||
26 | #define BUG() __asm__ __volatile__ ("break 14\n\t") | ||
27 | #endif | ||
28 | |||
29 | #define HAVE_ARCH_BUG | ||
30 | #endif | ||
31 | |||
32 | #include <asm-generic/bug.h> | ||
33 | #endif | ||