exceptions.h 2.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091
  1. /*
  2. * Preliminary support for HW exception handing for Microblaze
  3. *
  4. * Copyright (C) 2008-2009 Michal Simek <monstr@monstr.eu>
  5. * Copyright (C) 2008-2009 PetaLogix
  6. * Copyright (C) 2005 John Williams <jwilliams@itee.uq.edu.au>
  7. *
  8. * This file is subject to the terms and conditions of the GNU General
  9. * Public License. See the file COPYING in the main directory of this
  10. * archive for more details.
  11. */
  12. #ifndef _ASM_MICROBLAZE_EXCEPTIONS_H
  13. #define _ASM_MICROBLAZE_EXCEPTIONS_H
  14. #ifdef __KERNEL__
  15. #ifndef __ASSEMBLY__
  16. /* Macros to enable and disable HW exceptions in the MSR */
  17. /* Define MSR enable bit for HW exceptions */
  18. #define HWEX_MSR_BIT (1 << 8)
  19. #if CONFIG_XILINX_MICROBLAZE0_USE_MSR_INSTR
  20. #define __enable_hw_exceptions() \
  21. __asm__ __volatile__ (" msrset r0, %0; \
  22. nop;" \
  23. : \
  24. : "i" (HWEX_MSR_BIT) \
  25. : "memory")
  26. #define __disable_hw_exceptions() \
  27. __asm__ __volatile__ (" msrclr r0, %0; \
  28. nop;" \
  29. : \
  30. : "i" (HWEX_MSR_BIT) \
  31. : "memory")
  32. #else /* !CONFIG_XILINX_MICROBLAZE0_USE_MSR_INSTR */
  33. #define __enable_hw_exceptions() \
  34. __asm__ __volatile__ (" \
  35. mfs r12, rmsr; \
  36. nop; \
  37. ori r12, r12, %0; \
  38. mts rmsr, r12; \
  39. nop;" \
  40. : \
  41. : "i" (HWEX_MSR_BIT) \
  42. : "memory", "r12")
  43. #define __disable_hw_exceptions() \
  44. __asm__ __volatile__ (" \
  45. mfs r12, rmsr; \
  46. nop; \
  47. andi r12, r12, ~%0; \
  48. mts rmsr, r12; \
  49. nop;" \
  50. : \
  51. : "i" (HWEX_MSR_BIT) \
  52. : "memory", "r12")
  53. #endif /* CONFIG_XILINX_MICROBLAZE0_USE_MSR_INSTR */
  54. asmlinkage void full_exception(struct pt_regs *regs, unsigned int type,
  55. int fsr, int addr);
  56. void die(const char *str, struct pt_regs *fp, long err);
  57. void _exception(int signr, struct pt_regs *regs, int code, unsigned long addr);
  58. #ifdef CONFIG_MMU
  59. void __bug(const char *file, int line, void *data);
  60. int bad_trap(int trap_num, struct pt_regs *regs);
  61. int debug_trap(struct pt_regs *regs);
  62. #endif /* CONFIG_MMU */
  63. #if defined(CONFIG_KGDB)
  64. void (*debugger)(struct pt_regs *regs);
  65. int (*debugger_bpt)(struct pt_regs *regs);
  66. int (*debugger_sstep)(struct pt_regs *regs);
  67. int (*debugger_iabr_match)(struct pt_regs *regs);
  68. int (*debugger_dabr_match)(struct pt_regs *regs);
  69. void (*debugger_fault_handler)(struct pt_regs *regs);
  70. #else
  71. #define debugger(regs) do { } while (0)
  72. #define debugger_bpt(regs) 0
  73. #define debugger_sstep(regs) 0
  74. #define debugger_iabr_match(regs) 0
  75. #define debugger_dabr_match(regs) 0
  76. #define debugger_fault_handler ((void (*)(struct pt_regs *))0)
  77. #endif
  78. #endif /*__ASSEMBLY__ */
  79. #endif /* __KERNEL__ */
  80. #endif /* _ASM_MICROBLAZE_EXCEPTIONS_H */