decode-thumb.h 2.2 KB

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