exceptions.h 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990
  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 CONFIG_MMU
  16. #define EX_HANDLER_STACK_SIZ (4*19)
  17. #endif
  18. #ifndef __ASSEMBLY__
  19. /* Macros to enable and disable HW exceptions in the MSR */
  20. /* Define MSR enable bit for HW exceptions */
  21. #define HWEX_MSR_BIT (1 << 8)
  22. #if CONFIG_XILINX_MICROBLAZE0_USE_MSR_INSTR
  23. #define __enable_hw_exceptions() \
  24. __asm__ __volatile__ (" msrset r0, %0; \
  25. nop;" \
  26. : \
  27. : "i" (HWEX_MSR_BIT) \
  28. : "memory")
  29. #define __disable_hw_exceptions() \
  30. __asm__ __volatile__ (" msrclr r0, %0; \
  31. nop;" \
  32. : \
  33. : "i" (HWEX_MSR_BIT) \
  34. : "memory")
  35. #else /* !CONFIG_XILINX_MICROBLAZE0_USE_MSR_INSTR */
  36. #define __enable_hw_exceptions() \
  37. __asm__ __volatile__ (" \
  38. mfs r12, rmsr; \
  39. nop; \
  40. ori r12, r12, %0; \
  41. mts rmsr, r12; \
  42. nop;" \
  43. : \
  44. : "i" (HWEX_MSR_BIT) \
  45. : "memory", "r12")
  46. #define __disable_hw_exceptions() \
  47. __asm__ __volatile__ (" \
  48. mfs r12, rmsr; \
  49. nop; \
  50. andi r12, r12, ~%0; \
  51. mts rmsr, r12; \
  52. nop;" \
  53. : \
  54. : "i" (HWEX_MSR_BIT) \
  55. : "memory", "r12")
  56. #endif /* CONFIG_XILINX_MICROBLAZE0_USE_MSR_INSTR */
  57. asmlinkage void full_exception(struct pt_regs *regs, unsigned int type,
  58. int fsr, int addr);
  59. void die(const char *str, struct pt_regs *fp, long err);
  60. void _exception(int signr, struct pt_regs *regs, int code, unsigned long addr);
  61. #if defined(CONFIG_KGDB)
  62. void (*debugger)(struct pt_regs *regs);
  63. int (*debugger_bpt)(struct pt_regs *regs);
  64. int (*debugger_sstep)(struct pt_regs *regs);
  65. int (*debugger_iabr_match)(struct pt_regs *regs);
  66. int (*debugger_dabr_match)(struct pt_regs *regs);
  67. void (*debugger_fault_handler)(struct pt_regs *regs);
  68. #else
  69. #define debugger(regs) do { } while (0)
  70. #define debugger_bpt(regs) 0
  71. #define debugger_sstep(regs) 0
  72. #define debugger_iabr_match(regs) 0
  73. #define debugger_dabr_match(regs) 0
  74. #define debugger_fault_handler ((void (*)(struct pt_regs *))0)
  75. #endif
  76. #endif /*__ASSEMBLY__ */
  77. #endif /* __KERNEL__ */
  78. #endif /* _ASM_MICROBLAZE_EXCEPTIONS_H */