bug.h 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  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/linkage.h>
  14. #ifdef CONFIG_BUG
  15. /*
  16. * Tell the user there is some problem.
  17. */
  18. extern asmlinkage void __debug_bug_trap(int signr);
  19. #ifdef CONFIG_NO_KERNEL_MSG
  20. #define _debug_bug_printk()
  21. #else
  22. extern void __debug_bug_printk(const char *file, unsigned line);
  23. #define _debug_bug_printk() __debug_bug_printk(__FILE__, __LINE__)
  24. #endif
  25. #define _debug_bug_trap(signr) \
  26. do { \
  27. __debug_bug_trap(signr); \
  28. asm volatile("nop"); \
  29. } while(1)
  30. #define HAVE_ARCH_BUG
  31. #define BUG() \
  32. do { \
  33. _debug_bug_printk(); \
  34. _debug_bug_trap(6 /*SIGABRT*/); \
  35. } while (0)
  36. #ifdef CONFIG_GDBSTUB
  37. #define HAVE_ARCH_KGDB_RAISE
  38. #define kgdb_raise(signr) do { _debug_bug_trap(signr); } while(0)
  39. #define HAVE_ARCH_KGDB_BAD_PAGE
  40. #define kgdb_bad_page(page) do { kgdb_raise(SIGABRT); } while(0)
  41. #endif
  42. #endif /* CONFIG_BUG */
  43. #include <asm-generic/bug.h>
  44. #endif