bug.h 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. /* bug.h: FRV bug trapping
  2. *
  3. * Copyright (C) 2004 Red Hat, Inc. All Rights Reserved.
  4. * Written by David Howells (dhowells@redhat.com)
  5. *
  6. * This program is free software; you can redistribute it and/or
  7. * modify it under the terms of the GNU General Public License
  8. * as published by the Free Software Foundation; either version
  9. * 2 of the License, or (at your option) any later version.
  10. */
  11. #ifndef _ASM_BUG_H
  12. #define _ASM_BUG_H
  13. #include <linux/config.h>
  14. #include <linux/linkage.h>
  15. #ifdef CONFIG_BUG
  16. /*
  17. * Tell the user there is some problem.
  18. */
  19. extern asmlinkage void __debug_bug_trap(int signr);
  20. #ifdef CONFIG_NO_KERNEL_MSG
  21. #define _debug_bug_printk()
  22. #else
  23. extern void __debug_bug_printk(const char *file, unsigned line);
  24. #define _debug_bug_printk() __debug_bug_printk(__FILE__, __LINE__)
  25. #endif
  26. #define _debug_bug_trap(signr) \
  27. do { \
  28. __debug_bug_trap(signr); \
  29. asm volatile("nop"); \
  30. } while(0)
  31. #define HAVE_ARCH_BUG
  32. #define BUG() \
  33. do { \
  34. _debug_bug_printk(); \
  35. _debug_bug_trap(6 /*SIGABRT*/); \
  36. } while (0)
  37. #ifdef CONFIG_GDBSTUB
  38. #define HAVE_ARCH_KGDB_RAISE
  39. #define kgdb_raise(signr) do { _debug_bug_trap(signr); } while(0)
  40. #define HAVE_ARCH_KGDB_BAD_PAGE
  41. #define kgdb_bad_page(page) do { kgdb_raise(SIGABRT); } while(0)
  42. #endif
  43. #endif
  44. #include <asm-generic/bug.h>
  45. #endif