]> err.no Git - linux-2.6/commitdiff
[PATCH] x86-64: reduce x86-64 bug frame by 4 bytes
authorJan Beulich <jbeulich@novell.com>
Mon, 12 Sep 2005 16:49:25 +0000 (18:49 +0200)
committerLinus Torvalds <torvalds@g5.osdl.org>
Mon, 12 Sep 2005 17:50:58 +0000 (10:50 -0700)
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>
arch/x86_64/kernel/traps.c
include/asm-x86_64/bug.h

index 1dfeb07d31ccc524a95ada3f714dfa318eb06694..b5e09e6b55368fbd58572ac8c775bd1fc77ab4a7 100644 (file)
@@ -321,13 +321,13 @@ void handle_BUG(struct pt_regs *regs)
        if (__copy_from_user(&f, (struct bug_frame *) regs->rip, 
                             sizeof(struct bug_frame)))
                return; 
-       if ((unsigned long)f.filename < __PAGE_OFFSET || 
+       if (f.filename >= 0 ||
            f.ud2[0] != 0x0f || f.ud2[1] != 0x0b) 
                return;
-       if (__get_user(tmp, f.filename))
-               f.filename = "unmapped filename"; 
+       if (__get_user(tmp, (char *)(long)f.filename))
+               f.filename = (int)(long)"unmapped filename";
        printk("----------- [cut here ] --------- [please bite here ] ---------\n");
-       printk(KERN_ALERT "Kernel BUG at %.50s:%d\n", f.filename, f.line);
+       printk(KERN_ALERT "Kernel BUG at %.50s:%d\n", (char *)(long)f.filename, f.line);
 } 
 
 #ifdef CONFIG_BUG
index eed785667289fa34b0e287ba7240db98ab9866d3..80ac1fe966ac13ec3be908b2ec94bfaccefb40cc 100644 (file)
@@ -9,10 +9,8 @@
  */
 struct bug_frame {
        unsigned char ud2[2];
-       unsigned char mov;
-       /* should use 32bit offset instead, but the assembler doesn't 
-          like it */
-       char *filename;
+       unsigned char push;
+       signed int filename;
        unsigned char ret;
        unsigned short line;
 } __attribute__((packed));
@@ -25,8 +23,8 @@ struct bug_frame {
    The magic numbers generate mov $64bitimm,%eax ; ret $offset. */
 #define BUG()                                                          \
        asm volatile(                                                   \
-       "ud2 ; .byte 0xa3 ; .quad %c1 ; .byte 0xc2 ; .short %c0" ::     \
-                    "i"(__LINE__), "i" (__stringify(__FILE__)))
+       "ud2 ; pushq $%c1 ; ret $%c0" ::                                \
+                    "i"(__LINE__), "i" (__FILE__))
 void out_of_line_bug(void);
 #else
 static inline void out_of_line_bug(void) { }