diff options
author | Keir Fraser <keir.fraser@citrix.com> | 2009-03-31 13:23:11 +0100 |
---|---|---|
committer | Keir Fraser <keir.fraser@citrix.com> | 2009-03-31 13:23:11 +0100 |
commit | 7f6385949637051d1529431d7acd59e1677318c8 (patch) | |
tree | 17dba712c8f5b7b8a4a4f25591edb5e3efa29f9f /xen/include/asm-x86/bug.h | |
parent | ed25dad906fd3bec60fa79bc124afb3e854d67f0 (diff) | |
download | xen-7f6385949637051d1529431d7acd59e1677318c8.tar.gz xen-7f6385949637051d1529431d7acd59e1677318c8.tar.bz2 xen-7f6385949637051d1529431d7acd59e1677318c8.zip |
x86: unify BUG() & Co, reduce overhead on x86-64
Since it's only the string pointer representations that differ between
i386 and x86-64, abstract out those and make everything else shared.
While touching this code, also use
- proper instructions rather than a mixture of such and raw .byte/
.long/.quad data emissions,
- PC-relative pointers on x86-64 to cut the amount of storage (and
in particular cache space) needed for string references by half.
Signed-off-by: Jan Beulich <jbeulich@novell.com>
Diffstat (limited to 'xen/include/asm-x86/bug.h')
-rw-r--r-- | xen/include/asm-x86/bug.h | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/xen/include/asm-x86/bug.h b/xen/include/asm-x86/bug.h index 975576185c..df64549e44 100644 --- a/xen/include/asm-x86/bug.h +++ b/xen/include/asm-x86/bug.h @@ -18,4 +18,28 @@ struct bug_frame { #define BUGFRAME_bug 2 #define BUGFRAME_assert 3 +#define dump_execution_state() \ + asm volatile ( \ + "ud2 ; ret $0" \ + : : "i" (BUGFRAME_dump) ) + +#define WARN() \ + asm volatile ( \ + "ud2 ; ret %0" BUG_STR(1) \ + : : "i" (BUGFRAME_warn | (__LINE__<<2)), \ + "i" (__FILE__) ) + +#define BUG() \ + asm volatile ( \ + "ud2 ; ret %0" BUG_STR(1) \ + : : "i" (BUGFRAME_bug | (__LINE__<<2)), \ + "i" (__FILE__) ) + +#define assert_failed(p) \ + asm volatile ( \ + "ud2 ; ret %0" BUG_STR(1) BUG_STR(2) \ + : : "i" (BUGFRAME_assert | (__LINE__<<2)), \ + "i" (__FILE__), "i" (#p) ) + + #endif /* __X86_BUG_H__ */ |