exceptions.h 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  1. /* SPDX-License-Identifier: GPL-2.0 */
  2. /*
  3. * Preliminary support for HW exception handing for Microblaze
  4. *
  5. * Copyright (C) 2008-2009 Michal Simek <[email protected]>
  6. * Copyright (C) 2008-2009 PetaLogix
  7. * Copyright (C) 2005 John Williams <[email protected]>
  8. */
  9. #ifndef _ASM_MICROBLAZE_EXCEPTIONS_H
  10. #define _ASM_MICROBLAZE_EXCEPTIONS_H
  11. #ifdef __KERNEL__
  12. #ifndef __ASSEMBLY__
  13. /* Macros to enable and disable HW exceptions in the MSR */
  14. /* Define MSR enable bit for HW exceptions */
  15. #define HWEX_MSR_BIT (1 << 8)
  16. #if CONFIG_XILINX_MICROBLAZE0_USE_MSR_INSTR
  17. #define __enable_hw_exceptions() \
  18. __asm__ __volatile__ (" msrset r0, %0; \
  19. nop;" \
  20. : \
  21. : "i" (HWEX_MSR_BIT) \
  22. : "memory")
  23. #define __disable_hw_exceptions() \
  24. __asm__ __volatile__ (" msrclr r0, %0; \
  25. nop;" \
  26. : \
  27. : "i" (HWEX_MSR_BIT) \
  28. : "memory")
  29. #else /* !CONFIG_XILINX_MICROBLAZE0_USE_MSR_INSTR */
  30. #define __enable_hw_exceptions() \
  31. __asm__ __volatile__ (" \
  32. mfs r12, rmsr; \
  33. nop; \
  34. ori r12, r12, %0; \
  35. mts rmsr, r12; \
  36. nop;" \
  37. : \
  38. : "i" (HWEX_MSR_BIT) \
  39. : "memory", "r12")
  40. #define __disable_hw_exceptions() \
  41. __asm__ __volatile__ (" \
  42. mfs r12, rmsr; \
  43. nop; \
  44. andi r12, r12, ~%0; \
  45. mts rmsr, r12; \
  46. nop;" \
  47. : \
  48. : "i" (HWEX_MSR_BIT) \
  49. : "memory", "r12")
  50. #endif /* CONFIG_XILINX_MICROBLAZE0_USE_MSR_INSTR */
  51. asmlinkage void full_exception(struct pt_regs *regs, unsigned int type,
  52. int fsr, int addr);
  53. asmlinkage void sw_exception(struct pt_regs *regs);
  54. void bad_page_fault(struct pt_regs *regs, unsigned long address, int sig);
  55. void die(const char *str, struct pt_regs *fp, long err);
  56. void _exception(int signr, struct pt_regs *regs, int code, unsigned long addr);
  57. #endif /*__ASSEMBLY__ */
  58. #endif /* __KERNEL__ */
  59. #endif /* _ASM_MICROBLAZE_EXCEPTIONS_H */