exceptions.h 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596
  1. /*
  2. * Preliminary support for HW exception handing for Microblaze
  3. *
  4. * Copyright (C) 2008 Michal Simek
  5. * Copyright (C) 2008 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. #if defined(CONFIG_XMON)
  57. extern void xmon(struct pt_regs *regs);
  58. extern int xmon_bpt(struct pt_regs *regs);
  59. extern int xmon_sstep(struct pt_regs *regs);
  60. extern int xmon_iabr_match(struct pt_regs *regs);
  61. extern int xmon_dabr_match(struct pt_regs *regs);
  62. extern void (*xmon_fault_handler)(struct pt_regs *regs);
  63. void (*debugger)(struct pt_regs *regs) = xmon;
  64. int (*debugger_bpt)(struct pt_regs *regs) = xmon_bpt;
  65. int (*debugger_sstep)(struct pt_regs *regs) = xmon_sstep;
  66. int (*debugger_iabr_match)(struct pt_regs *regs) = xmon_iabr_match;
  67. int (*debugger_dabr_match)(struct pt_regs *regs) = xmon_dabr_match;
  68. void (*debugger_fault_handler)(struct pt_regs *regs);
  69. #elif defined(CONFIG_KGDB)
  70. void (*debugger)(struct pt_regs *regs);
  71. int (*debugger_bpt)(struct pt_regs *regs);
  72. int (*debugger_sstep)(struct pt_regs *regs);
  73. int (*debugger_iabr_match)(struct pt_regs *regs);
  74. int (*debugger_dabr_match)(struct pt_regs *regs);
  75. void (*debugger_fault_handler)(struct pt_regs *regs);
  76. #else
  77. #define debugger(regs) do { } while (0)
  78. #define debugger_bpt(regs) 0
  79. #define debugger_sstep(regs) 0
  80. #define debugger_iabr_match(regs) 0
  81. #define debugger_dabr_match(regs) 0
  82. #define debugger_fault_handler ((void (*)(struct pt_regs *))0)
  83. #endif
  84. #endif /*__ASSEMBLY__ */
  85. #endif /* __KERNEL__ */
  86. #endif /* _ASM_MICROBLAZE_EXCEPTIONS_H */