mips-r2-to-r6-emul.h 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102
  1. /*
  2. * This file is subject to the terms and conditions of the GNU General Public
  3. * License. See the file "COPYING" in the main directory of this archive
  4. * for more details.
  5. *
  6. * Copyright (c) 2014 Imagination Technologies Ltd.
  7. * Author: Markos Chandras <markos.chandras@imgtec.com>
  8. */
  9. #ifndef __ASM_MIPS_R2_TO_R6_EMUL_H
  10. #define __ASM_MIPS_R2_TO_R6_EMUL_H
  11. struct mips_r2_emulator_stats {
  12. u64 movs;
  13. u64 hilo;
  14. u64 muls;
  15. u64 divs;
  16. u64 dsps;
  17. u64 bops;
  18. u64 traps;
  19. u64 fpus;
  20. u64 loads;
  21. u64 stores;
  22. u64 llsc;
  23. u64 dsemul;
  24. };
  25. struct mips_r2br_emulator_stats {
  26. u64 jrs;
  27. u64 bltzl;
  28. u64 bgezl;
  29. u64 bltzll;
  30. u64 bgezll;
  31. u64 bltzall;
  32. u64 bgezall;
  33. u64 bltzal;
  34. u64 bgezal;
  35. u64 beql;
  36. u64 bnel;
  37. u64 blezl;
  38. u64 bgtzl;
  39. };
  40. #ifdef CONFIG_DEBUG_FS
  41. #define MIPS_R2_STATS(M) \
  42. do { \
  43. u32 nir; \
  44. int err; \
  45. \
  46. preempt_disable(); \
  47. __this_cpu_inc(mipsr2emustats.M); \
  48. err = __get_user(nir, (u32 __user *)regs->cp0_epc); \
  49. if (!err) { \
  50. if (nir == BREAK_MATH(0)) \
  51. __this_cpu_inc(mipsr2bdemustats.M); \
  52. } \
  53. preempt_enable(); \
  54. } while (0)
  55. #define MIPS_R2BR_STATS(M) \
  56. do { \
  57. preempt_disable(); \
  58. __this_cpu_inc(mipsr2bremustats.M); \
  59. preempt_enable(); \
  60. } while (0)
  61. #else
  62. #define MIPS_R2_STATS(M) do { } while (0)
  63. #define MIPS_R2BR_STATS(M) do { } while (0)
  64. #endif /* CONFIG_DEBUG_FS */
  65. struct r2_decoder_table {
  66. u32 mask;
  67. u32 code;
  68. int (*func)(struct pt_regs *regs, u32 inst);
  69. };
  70. extern void do_trap_or_bp(struct pt_regs *regs, unsigned int code, int si_code,
  71. const char *str);
  72. #ifndef CONFIG_MIPSR2_TO_R6_EMULATOR
  73. static int mipsr2_emulation;
  74. static inline int mipsr2_decoder(struct pt_regs *regs, u32 inst,
  75. unsigned long *fcr31)
  76. {
  77. return 0;
  78. };
  79. #else
  80. /* MIPS R2 Emulator ON/OFF */
  81. extern int mipsr2_emulation;
  82. extern int mipsr2_decoder(struct pt_regs *regs, u32 inst,
  83. unsigned long *fcr31);
  84. #endif /* CONFIG_MIPSR2_TO_R6_EMULATOR */
  85. #define NO_R6EMU (cpu_has_mips_r6 && !mipsr2_emulation)
  86. #endif /* __ASM_MIPS_R2_TO_R6_EMUL_H */