aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJan Beulich <jbeulich@novell.com>2005-09-12 12:49:25 -0400
committerLinus Torvalds <torvalds@g5.osdl.org>2005-09-12 13:50:58 -0400
commit049cdefe19f95b67b06b70915cd8e4ae7173337a (patch)
tree42a0846ec18e3c4f705f8f167890675c5978a814
parentc47a3167d0454c0af5fb0a0322b01a0e3487798e (diff)
[PATCH] x86-64: reduce x86-64 bug frame by 4 bytes
As mentioned before, the size of the bug frame can be further reduced while continuing to use instructions to encode the information. Signed-off-by: Jan Beulich <jbeulich@novell.com> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
-rw-r--r--arch/x86_64/kernel/traps.c8
-rw-r--r--include/asm-x86_64/bug.h10
2 files changed, 8 insertions, 10 deletions
diff --git a/arch/x86_64/kernel/traps.c b/arch/x86_64/kernel/traps.c
index 1dfeb07d31cc..b5e09e6b5536 100644
--- a/arch/x86_64/kernel/traps.c
+++ b/arch/x86_64/kernel/traps.c
@@ -321,13 +321,13 @@ void handle_BUG(struct pt_regs *regs)
321 if (__copy_from_user(&f, (struct bug_frame *) regs->rip, 321 if (__copy_from_user(&f, (struct bug_frame *) regs->rip,
322 sizeof(struct bug_frame))) 322 sizeof(struct bug_frame)))
323 return; 323 return;
324 if ((unsigned long)f.filename < __PAGE_OFFSET || 324 if (f.filename >= 0 ||
325 f.ud2[0] != 0x0f || f.ud2[1] != 0x0b) 325 f.ud2[0] != 0x0f || f.ud2[1] != 0x0b)
326 return; 326 return;
327 if (__get_user(tmp, f.filename)) 327 if (__get_user(tmp, (char *)(long)f.filename))
328 f.filename = "unmapped filename"; 328 f.filename = (int)(long)"unmapped filename";
329 printk("----------- [cut here ] --------- [please bite here ] ---------\n"); 329 printk("----------- [cut here ] --------- [please bite here ] ---------\n");
330 printk(KERN_ALERT "Kernel BUG at %.50s:%d\n", f.filename, f.line); 330 printk(KERN_ALERT "Kernel BUG at %.50s:%d\n", (char *)(long)f.filename, f.line);
331} 331}
332 332
333#ifdef CONFIG_BUG 333#ifdef CONFIG_BUG
diff --git a/include/asm-x86_64/bug.h b/include/asm-x86_64/bug.h
index eed785667289..80ac1fe966ac 100644
--- a/include/asm-x86_64/bug.h
+++ b/include/asm-x86_64/bug.h
@@ -9,10 +9,8 @@
9 */ 9 */
10struct bug_frame { 10struct bug_frame {
11 unsigned char ud2[2]; 11 unsigned char ud2[2];
12 unsigned char mov; 12 unsigned char push;
13 /* should use 32bit offset instead, but the assembler doesn't 13 signed int filename;
14 like it */
15 char *filename;
16 unsigned char ret; 14 unsigned char ret;
17 unsigned short line; 15 unsigned short line;
18} __attribute__((packed)); 16} __attribute__((packed));
@@ -25,8 +23,8 @@ struct bug_frame {
25 The magic numbers generate mov $64bitimm,%eax ; ret $offset. */ 23 The magic numbers generate mov $64bitimm,%eax ; ret $offset. */
26#define BUG() \ 24#define BUG() \
27 asm volatile( \ 25 asm volatile( \
28 "ud2 ; .byte 0xa3 ; .quad %c1 ; .byte 0xc2 ; .short %c0" :: \ 26 "ud2 ; pushq $%c1 ; ret $%c0" :: \
29 "i"(__LINE__), "i" (__stringify(__FILE__))) 27 "i"(__LINE__), "i" (__FILE__))
30void out_of_line_bug(void); 28void out_of_line_bug(void);
31#else 29#else
32static inline void out_of_line_bug(void) { } 30static inline void out_of_line_bug(void) { }