blob: 80ac1fe966ac13ec3be908b2ec94bfaccefb40cc [file] [log] [blame]
Linus Torvalds1da177e2005-04-16 15:20:36 -07001#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 {
Andi Kleenb6a68a12005-07-28 21:15:45 -070011 unsigned char ud2[2];
Jan Beulich049cdef2005-09-12 18:49:25 +020012 unsigned char push;
13 signed int filename;
Andi Kleenb6a68a12005-07-28 21:15:45 -070014 unsigned char ret;
Linus Torvalds1da177e2005-04-16 15:20:36 -070015 unsigned short line;
16} __attribute__((packed));
17
Matt Mackallc8538a72005-05-01 08:59:01 -070018#ifdef CONFIG_BUG
Linus Torvalds1da177e2005-04-16 15:20:36 -070019#define HAVE_ARCH_BUG
Andi Kleenb6a68a12005-07-28 21:15:45 -070020/* We turn the bug frame into valid instructions to not confuse
21 the disassembler. Thanks to Jan Beulich & Suresh Siddha
22 for nice instruction selection.
23 The magic numbers generate mov $64bitimm,%eax ; ret $offset. */
24#define BUG() \
25 asm volatile( \
Jan Beulich049cdef2005-09-12 18:49:25 +020026 "ud2 ; pushq $%c1 ; ret $%c0" :: \
27 "i"(__LINE__), "i" (__FILE__))
Linus Torvalds1da177e2005-04-16 15:20:36 -070028void out_of_line_bug(void);
Alexander Nyberg4f60fdf2005-05-25 12:31:28 -070029#else
30static inline void out_of_line_bug(void) { }
Matt Mackallc8538a72005-05-01 08:59:01 -070031#endif
Linus Torvalds1da177e2005-04-16 15:20:36 -070032
Matt Mackallc8538a72005-05-01 08:59:01 -070033#include <asm-generic/bug.h>
Linus Torvalds1da177e2005-04-16 15:20:36 -070034#endif