debuggers.hg

view xen/include/asm-x86/bug.h @ 21015:8cb6e7eff2ba

x86: Generalise BUGFRAME_dump mechanism to allow polled UART irq to
get proper regs argument.

Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
author Keir Fraser <keir.fraser@citrix.com>
date Wed Feb 24 10:44:30 2010 +0000 (2010-02-24)
parents 69108560c7eb
children 96441daf4a5b
line source
1 #ifndef __X86_BUG_H__
2 #define __X86_BUG_H__
4 #ifdef __x86_64__
5 #include <asm/x86_64/bug.h>
6 #else
7 #include <asm/x86_32/bug.h>
8 #endif
10 struct bug_frame {
11 unsigned char ud2[2];
12 unsigned char ret;
13 unsigned short id; /* BUGFRAME_??? */
14 } __attribute__((packed));
16 #define BUGFRAME_run_fn 0
17 #define BUGFRAME_warn 1
18 #define BUGFRAME_bug 2
19 #define BUGFRAME_assert 3
21 #define run_in_exception_handler(fn) \
22 asm volatile ( \
23 "ud2 ; ret %0" BUG_STR(1) \
24 : : "i" (BUGFRAME_run_fn), \
25 "i" (fn) )
27 #define WARN() \
28 asm volatile ( \
29 "ud2 ; ret %0" BUG_STR(1) \
30 : : "i" (BUGFRAME_warn | (__LINE__<<2)), \
31 "i" (__FILE__) )
33 #define BUG() \
34 asm volatile ( \
35 "ud2 ; ret %0" BUG_STR(1) \
36 : : "i" (BUGFRAME_bug | (__LINE__<<2)), \
37 "i" (__FILE__) )
39 #define assert_failed(p) \
40 asm volatile ( \
41 "ud2 ; ret %0" BUG_STR(1) BUG_STR(2) \
42 : : "i" (BUGFRAME_assert | (__LINE__<<2)), \
43 "i" (__FILE__), "i" (#p) )
46 #endif /* __X86_BUG_H__ */