diff options
author | Jeremy Fitzhardinge <jeremy@goop.org> | 2006-12-08 05:36:22 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@woody.osdl.org> | 2006-12-08 11:28:39 -0500 |
commit | c31a0bf3e1bc581676618db7492f18798fd0a73f (patch) | |
tree | 68eb38dbc58d647c3b20cd73fb812cafe93eb663 /include/asm-x86_64/bug.h | |
parent | 91768d6c2bad0d2766a166f13f2f57e197de3458 (diff) |
[PATCH] Generic BUG for x86-64
This makes x86-64 use the generic BUG machinery.
The main advantage in using the generic BUG machinery for x86-64 is that
the inlined overhead of BUG is just the ud2a instruction; the file+line
information are no longer inlined into the instruction stream. This
reduces cache pollution.
Signed-off-by: Jeremy Fitzhardinge <jeremy@goop.org>
Cc: Andi Kleen <ak@muc.de>
Cc: Hugh Dickens <hugh@veritas.com>
Cc: Michael Ellerman <michael@ellerman.id.au>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Cc: Rusty Russell <rusty@rustcorp.com.au>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'include/asm-x86_64/bug.h')
-rw-r--r-- | include/asm-x86_64/bug.h | 44 |
1 files changed, 22 insertions, 22 deletions
diff --git a/include/asm-x86_64/bug.h b/include/asm-x86_64/bug.h index 80ac1fe966ac..682606414913 100644 --- a/include/asm-x86_64/bug.h +++ b/include/asm-x86_64/bug.h | |||
@@ -1,30 +1,30 @@ | |||
1 | #ifndef __ASM_X8664_BUG_H | 1 | #ifndef __ASM_X8664_BUG_H |
2 | #define __ASM_X8664_BUG_H 1 | 2 | #define __ASM_X8664_BUG_H 1 |
3 | 3 | ||
4 | #include <linux/stringify.h> | ||
5 | |||
6 | /* | ||
7 | * Tell the user there is some problem. The exception handler decodes | ||
8 | * this frame. | ||
9 | */ | ||
10 | struct bug_frame { | ||
11 | unsigned char ud2[2]; | ||
12 | unsigned char push; | ||
13 | signed int filename; | ||
14 | unsigned char ret; | ||
15 | unsigned short line; | ||
16 | } __attribute__((packed)); | ||
17 | |||
18 | #ifdef CONFIG_BUG | 4 | #ifdef CONFIG_BUG |
19 | #define HAVE_ARCH_BUG | 5 | #define HAVE_ARCH_BUG |
20 | /* We turn the bug frame into valid instructions to not confuse | 6 | |
21 | the disassembler. Thanks to Jan Beulich & Suresh Siddha | 7 | #ifdef CONFIG_DEBUG_BUGVERBOSE |
22 | for nice instruction selection. | 8 | #define BUG() \ |
23 | The magic numbers generate mov $64bitimm,%eax ; ret $offset. */ | 9 | do { \ |
24 | #define BUG() \ | 10 | asm volatile("1:\tud2\n" \ |
25 | asm volatile( \ | 11 | ".pushsection __bug_table,\"a\"\n" \ |
26 | "ud2 ; pushq $%c1 ; ret $%c0" :: \ | 12 | "2:\t.quad 1b, %c0\n" \ |
27 | "i"(__LINE__), "i" (__FILE__)) | 13 | "\t.word %c1, 0\n" \ |
14 | "\t.org 2b+%c2\n" \ | ||
15 | ".popsection" \ | ||
16 | : : "i" (__FILE__), "i" (__LINE__), \ | ||
17 | "i" (sizeof(struct bug_entry))); \ | ||
18 | for(;;) ; \ | ||
19 | } while(0) | ||
20 | #else | ||
21 | #define BUG() \ | ||
22 | do { \ | ||
23 | asm volatile("ud2"); \ | ||
24 | for(;;) ; \ | ||
25 | } while(0) | ||
26 | #endif | ||
27 | |||
28 | void out_of_line_bug(void); | 28 | void out_of_line_bug(void); |
29 | #else | 29 | #else |
30 | static inline void out_of_line_bug(void) { } | 30 | static inline void out_of_line_bug(void) { } |