at v2.6.13 36 lines 957 B view raw
1#ifndef __ASM_X8664_BUG_H 2#define __ASM_X8664_BUG_H 1 3 4#include <linux/stringify.h> 5 6/* 7 * Tell the user there is some problem. The exception handler decodes 8 * this frame. 9 */ 10struct bug_frame { 11 unsigned char ud2[2]; 12 unsigned char mov; 13 /* should use 32bit offset instead, but the assembler doesn't 14 like it */ 15 char *filename; 16 unsigned char ret; 17 unsigned short line; 18} __attribute__((packed)); 19 20#ifdef CONFIG_BUG 21#define HAVE_ARCH_BUG 22/* We turn the bug frame into valid instructions to not confuse 23 the disassembler. Thanks to Jan Beulich & Suresh Siddha 24 for nice instruction selection. 25 The magic numbers generate mov $64bitimm,%eax ; ret $offset. */ 26#define BUG() \ 27 asm volatile( \ 28 "ud2 ; .byte 0xa3 ; .quad %c1 ; .byte 0xc2 ; .short %c0" :: \ 29 "i"(__LINE__), "i" (__stringify(__FILE__))) 30void out_of_line_bug(void); 31#else 32static inline void out_of_line_bug(void) { } 33#endif 34 35#include <asm-generic/bug.h> 36#endif