probes-common.h 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384
  1. /*
  2. * Copyright (C) 2016 Imagination Technologies
  3. * Author: Marcin Nowakowski <marcin.nowakowski@imgtec.com>
  4. *
  5. * This program is free software; you can redistribute it and/or modify it
  6. * under the terms of the GNU General Public License as published by the
  7. * Free Software Foundation; either version 2 of the License, or (at your
  8. * option) any later version.
  9. */
  10. #ifndef __PROBES_COMMON_H
  11. #define __PROBES_COMMON_H
  12. #include <asm/inst.h>
  13. int __insn_is_compact_branch(union mips_instruction insn);
  14. static inline int __insn_has_delay_slot(const union mips_instruction insn)
  15. {
  16. switch (insn.i_format.opcode) {
  17. /*
  18. * jr and jalr are in r_format format.
  19. */
  20. case spec_op:
  21. switch (insn.r_format.func) {
  22. case jalr_op:
  23. case jr_op:
  24. return 1;
  25. }
  26. break;
  27. /*
  28. * This group contains:
  29. * bltz_op, bgez_op, bltzl_op, bgezl_op,
  30. * bltzal_op, bgezal_op, bltzall_op, bgezall_op.
  31. */
  32. case bcond_op:
  33. switch (insn.i_format.rt) {
  34. case bltz_op:
  35. case bltzl_op:
  36. case bgez_op:
  37. case bgezl_op:
  38. case bltzal_op:
  39. case bltzall_op:
  40. case bgezal_op:
  41. case bgezall_op:
  42. case bposge32_op:
  43. return 1;
  44. }
  45. break;
  46. /*
  47. * These are unconditional and in j_format.
  48. */
  49. case jal_op:
  50. case j_op:
  51. case beq_op:
  52. case beql_op:
  53. case bne_op:
  54. case bnel_op:
  55. case blez_op: /* not really i_format */
  56. case blezl_op:
  57. case bgtz_op:
  58. case bgtzl_op:
  59. return 1;
  60. /*
  61. * And now the FPA/cp1 branch instructions.
  62. */
  63. case cop1_op:
  64. #ifdef CONFIG_CPU_CAVIUM_OCTEON
  65. case lwc2_op: /* This is bbit0 on Octeon */
  66. case ldc2_op: /* This is bbit032 on Octeon */
  67. case swc2_op: /* This is bbit1 on Octeon */
  68. case sdc2_op: /* This is bbit132 on Octeon */
  69. #endif
  70. return 1;
  71. }
  72. return 0;
  73. }
  74. #endif /* __PROBES_COMMON_H */