intel-pt-insn-decoder.h 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  1. /*
  2. * intel_pt_insn_decoder.h: Intel Processor Trace support
  3. * Copyright (c) 2013-2014, Intel Corporation.
  4. *
  5. * This program is free software; you can redistribute it and/or modify it
  6. * under the terms and conditions of the GNU General Public License,
  7. * version 2, as published by the Free Software Foundation.
  8. *
  9. * This program is distributed in the hope it will be useful, but WITHOUT
  10. * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  11. * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
  12. * more details.
  13. *
  14. */
  15. #ifndef INCLUDE__INTEL_PT_INSN_DECODER_H__
  16. #define INCLUDE__INTEL_PT_INSN_DECODER_H__
  17. #include <stddef.h>
  18. #include <stdint.h>
  19. #define INTEL_PT_INSN_DESC_MAX 32
  20. #define INTEL_PT_INSN_DBG_BUF_SZ 16
  21. enum intel_pt_insn_op {
  22. INTEL_PT_OP_OTHER,
  23. INTEL_PT_OP_CALL,
  24. INTEL_PT_OP_RET,
  25. INTEL_PT_OP_JCC,
  26. INTEL_PT_OP_JMP,
  27. INTEL_PT_OP_LOOP,
  28. INTEL_PT_OP_IRET,
  29. INTEL_PT_OP_INT,
  30. INTEL_PT_OP_SYSCALL,
  31. INTEL_PT_OP_SYSRET,
  32. };
  33. enum intel_pt_insn_branch {
  34. INTEL_PT_BR_NO_BRANCH,
  35. INTEL_PT_BR_INDIRECT,
  36. INTEL_PT_BR_CONDITIONAL,
  37. INTEL_PT_BR_UNCONDITIONAL,
  38. };
  39. struct intel_pt_insn {
  40. enum intel_pt_insn_op op;
  41. enum intel_pt_insn_branch branch;
  42. int length;
  43. int32_t rel;
  44. unsigned char buf[INTEL_PT_INSN_DBG_BUF_SZ];
  45. };
  46. int intel_pt_get_insn(const unsigned char *buf, size_t len, int x86_64,
  47. struct intel_pt_insn *intel_pt_insn);
  48. const char *intel_pt_insn_name(enum intel_pt_insn_op op);
  49. int intel_pt_insn_desc(const struct intel_pt_insn *intel_pt_insn, char *buf,
  50. size_t buf_len);
  51. size_t intel_pt_insn_max_size(void);
  52. int intel_pt_insn_type(enum intel_pt_insn_op op);
  53. #endif