intel-pt-pkt-decoder.h 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  1. /*
  2. * intel_pt_pkt_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_PKT_DECODER_H__
  16. #define INCLUDE__INTEL_PT_PKT_DECODER_H__
  17. #include <stddef.h>
  18. #include <stdint.h>
  19. #define INTEL_PT_PKT_DESC_MAX 256
  20. #define INTEL_PT_NEED_MORE_BYTES -1
  21. #define INTEL_PT_BAD_PACKET -2
  22. #define INTEL_PT_PSB_STR "\002\202\002\202\002\202\002\202" \
  23. "\002\202\002\202\002\202\002\202"
  24. #define INTEL_PT_PSB_LEN 16
  25. #define INTEL_PT_PKT_MAX_SZ 16
  26. enum intel_pt_pkt_type {
  27. INTEL_PT_BAD,
  28. INTEL_PT_PAD,
  29. INTEL_PT_TNT,
  30. INTEL_PT_TIP_PGD,
  31. INTEL_PT_TIP_PGE,
  32. INTEL_PT_TSC,
  33. INTEL_PT_TMA,
  34. INTEL_PT_MODE_EXEC,
  35. INTEL_PT_MODE_TSX,
  36. INTEL_PT_MTC,
  37. INTEL_PT_TIP,
  38. INTEL_PT_FUP,
  39. INTEL_PT_CYC,
  40. INTEL_PT_VMCS,
  41. INTEL_PT_PSB,
  42. INTEL_PT_PSBEND,
  43. INTEL_PT_CBR,
  44. INTEL_PT_TRACESTOP,
  45. INTEL_PT_PIP,
  46. INTEL_PT_OVF,
  47. INTEL_PT_MNT,
  48. };
  49. struct intel_pt_pkt {
  50. enum intel_pt_pkt_type type;
  51. int count;
  52. uint64_t payload;
  53. };
  54. const char *intel_pt_pkt_name(enum intel_pt_pkt_type);
  55. int intel_pt_get_packet(const unsigned char *buf, size_t len,
  56. struct intel_pt_pkt *packet);
  57. int intel_pt_pkt_desc(const struct intel_pt_pkt *packet, char *buf, size_t len);
  58. #endif