decode-thumb.h 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102
  1. /*
  2. * arch/arm/probes/decode-thumb.h
  3. *
  4. * Copyright 2013 Linaro Ltd.
  5. * Written by: David A. Long
  6. *
  7. * The code contained herein is licensed under the GNU General Public
  8. * License. You may obtain a copy of the GNU General Public License
  9. * Version 2 or later at the following locations:
  10. *
  11. * http://www.opensource.org/licenses/gpl-license.html
  12. * http://www.gnu.org/copyleft/gpl.html
  13. */
  14. #ifndef _ARM_KERNEL_PROBES_THUMB_H
  15. #define _ARM_KERNEL_PROBES_THUMB_H
  16. #include "decode.h"
  17. /*
  18. * True if current instruction is in an IT block.
  19. */
  20. #define in_it_block(cpsr) ((cpsr & 0x06000c00) != 0x00000000)
  21. /*
  22. * Return the condition code to check for the currently executing instruction.
  23. * This is in ITSTATE<7:4> which is in CPSR<15:12> but is only valid if
  24. * in_it_block returns true.
  25. */
  26. #define current_cond(cpsr) ((cpsr >> 12) & 0xf)
  27. enum probes_t32_action {
  28. PROBES_T32_EMULATE_NONE,
  29. PROBES_T32_SIMULATE_NOP,
  30. PROBES_T32_LDMSTM,
  31. PROBES_T32_LDRDSTRD,
  32. PROBES_T32_TABLE_BRANCH,
  33. PROBES_T32_TST,
  34. PROBES_T32_CMP,
  35. PROBES_T32_MOV,
  36. PROBES_T32_ADDSUB,
  37. PROBES_T32_LOGICAL,
  38. PROBES_T32_ADDWSUBW_PC,
  39. PROBES_T32_ADDWSUBW,
  40. PROBES_T32_MOVW,
  41. PROBES_T32_SAT,
  42. PROBES_T32_BITFIELD,
  43. PROBES_T32_SEV,
  44. PROBES_T32_WFE,
  45. PROBES_T32_MRS,
  46. PROBES_T32_BRANCH_COND,
  47. PROBES_T32_BRANCH,
  48. PROBES_T32_PLDI,
  49. PROBES_T32_LDR_LIT,
  50. PROBES_T32_LDRSTR,
  51. PROBES_T32_SIGN_EXTEND,
  52. PROBES_T32_MEDIA,
  53. PROBES_T32_REVERSE,
  54. PROBES_T32_MUL_ADD,
  55. PROBES_T32_MUL_ADD2,
  56. PROBES_T32_MUL_ADD_LONG,
  57. NUM_PROBES_T32_ACTIONS
  58. };
  59. enum probes_t16_action {
  60. PROBES_T16_ADD_SP,
  61. PROBES_T16_CBZ,
  62. PROBES_T16_SIGN_EXTEND,
  63. PROBES_T16_PUSH,
  64. PROBES_T16_POP,
  65. PROBES_T16_SEV,
  66. PROBES_T16_WFE,
  67. PROBES_T16_IT,
  68. PROBES_T16_CMP,
  69. PROBES_T16_ADDSUB,
  70. PROBES_T16_LOGICAL,
  71. PROBES_T16_BLX,
  72. PROBES_T16_HIREGOPS,
  73. PROBES_T16_LDR_LIT,
  74. PROBES_T16_LDRHSTRH,
  75. PROBES_T16_LDRSTR,
  76. PROBES_T16_ADR,
  77. PROBES_T16_LDMSTM,
  78. PROBES_T16_BRANCH_COND,
  79. PROBES_T16_BRANCH,
  80. NUM_PROBES_T16_ACTIONS
  81. };
  82. extern const union decode_item probes_decode_thumb32_table[];
  83. extern const union decode_item probes_decode_thumb16_table[];
  84. enum probes_insn __kprobes
  85. thumb16_probes_decode_insn(probes_opcode_t insn, struct arch_probes_insn *asi,
  86. bool emulate, const union decode_action *actions,
  87. const struct decode_checker *checkers[]);
  88. enum probes_insn __kprobes
  89. thumb32_probes_decode_insn(probes_opcode_t insn, struct arch_probes_insn *asi,
  90. bool emulate, const union decode_action *actions,
  91. const struct decode_checker *checkers[]);
  92. #endif