1 /* SPDX-License-Identifier: GPL-2.0-only */ 1 /* SPDX-License-Identifier: GPL-2.0-only */ 2 /* 2 /* 3 * intel_pt_pkt_decoder.h: Intel Processor Tra 3 * intel_pt_pkt_decoder.h: Intel Processor Trace support 4 * Copyright (c) 2013-2014, Intel Corporation. 4 * Copyright (c) 2013-2014, Intel Corporation. 5 */ 5 */ 6 6 7 #ifndef INCLUDE__INTEL_PT_PKT_DECODER_H__ 7 #ifndef INCLUDE__INTEL_PT_PKT_DECODER_H__ 8 #define INCLUDE__INTEL_PT_PKT_DECODER_H__ 8 #define INCLUDE__INTEL_PT_PKT_DECODER_H__ 9 9 10 #include <stddef.h> 10 #include <stddef.h> 11 #include <stdint.h> 11 #include <stdint.h> 12 12 13 #define INTEL_PT_PKT_DESC_MAX 256 13 #define INTEL_PT_PKT_DESC_MAX 256 14 14 15 #define INTEL_PT_NEED_MORE_BYTES -1 15 #define INTEL_PT_NEED_MORE_BYTES -1 16 #define INTEL_PT_BAD_PACKET -2 16 #define INTEL_PT_BAD_PACKET -2 17 17 18 #define INTEL_PT_PSB_STR "\002\ 18 #define INTEL_PT_PSB_STR "\002\202\002\202\002\202\002\202" \ 19 "\002\ 19 "\002\202\002\202\002\202\002\202" 20 #define INTEL_PT_PSB_LEN 16 20 #define INTEL_PT_PSB_LEN 16 21 21 22 #define INTEL_PT_PKT_MAX_SZ 16 22 #define INTEL_PT_PKT_MAX_SZ 16 23 23 24 #define INTEL_PT_VMX_NR_FLAG 1 << 25 << 26 enum intel_pt_pkt_type { 24 enum intel_pt_pkt_type { 27 INTEL_PT_BAD, 25 INTEL_PT_BAD, 28 INTEL_PT_PAD, 26 INTEL_PT_PAD, 29 INTEL_PT_TNT, 27 INTEL_PT_TNT, 30 INTEL_PT_TIP_PGD, 28 INTEL_PT_TIP_PGD, 31 INTEL_PT_TIP_PGE, 29 INTEL_PT_TIP_PGE, 32 INTEL_PT_TSC, 30 INTEL_PT_TSC, 33 INTEL_PT_TMA, 31 INTEL_PT_TMA, 34 INTEL_PT_MODE_EXEC, 32 INTEL_PT_MODE_EXEC, 35 INTEL_PT_MODE_TSX, 33 INTEL_PT_MODE_TSX, 36 INTEL_PT_MTC, 34 INTEL_PT_MTC, 37 INTEL_PT_TIP, 35 INTEL_PT_TIP, 38 INTEL_PT_FUP, 36 INTEL_PT_FUP, 39 INTEL_PT_CYC, 37 INTEL_PT_CYC, 40 INTEL_PT_VMCS, 38 INTEL_PT_VMCS, 41 INTEL_PT_PSB, 39 INTEL_PT_PSB, 42 INTEL_PT_PSBEND, 40 INTEL_PT_PSBEND, 43 INTEL_PT_CBR, 41 INTEL_PT_CBR, 44 INTEL_PT_TRACESTOP, 42 INTEL_PT_TRACESTOP, 45 INTEL_PT_PIP, 43 INTEL_PT_PIP, 46 INTEL_PT_OVF, 44 INTEL_PT_OVF, 47 INTEL_PT_MNT, 45 INTEL_PT_MNT, 48 INTEL_PT_PTWRITE, 46 INTEL_PT_PTWRITE, 49 INTEL_PT_PTWRITE_IP, 47 INTEL_PT_PTWRITE_IP, 50 INTEL_PT_EXSTOP, 48 INTEL_PT_EXSTOP, 51 INTEL_PT_EXSTOP_IP, 49 INTEL_PT_EXSTOP_IP, 52 INTEL_PT_MWAIT, 50 INTEL_PT_MWAIT, 53 INTEL_PT_PWRE, 51 INTEL_PT_PWRE, 54 INTEL_PT_PWRX, 52 INTEL_PT_PWRX, 55 INTEL_PT_BBP, 53 INTEL_PT_BBP, 56 INTEL_PT_BIP, 54 INTEL_PT_BIP, 57 INTEL_PT_BEP, 55 INTEL_PT_BEP, 58 INTEL_PT_BEP_IP, 56 INTEL_PT_BEP_IP, 59 INTEL_PT_CFE, << 60 INTEL_PT_CFE_IP, << 61 INTEL_PT_EVD, << 62 }; 57 }; 63 58 64 struct intel_pt_pkt { 59 struct intel_pt_pkt { 65 enum intel_pt_pkt_type type; 60 enum intel_pt_pkt_type type; 66 int count; 61 int count; 67 uint64_t payload; 62 uint64_t payload; 68 }; 63 }; 69 64 70 /* 65 /* 71 * Decoding of BIP packets conflicts with sing 66 * Decoding of BIP packets conflicts with single-byte TNT packets. Since BIP 72 * packets only occur in the context of a bloc 67 * packets only occur in the context of a block (i.e. between BBP and BEP), that 73 * context must be recorded and passed to the 68 * context must be recorded and passed to the packet decoder. 74 */ 69 */ 75 enum intel_pt_pkt_ctx { 70 enum intel_pt_pkt_ctx { 76 INTEL_PT_NO_CTX, /* BIP packets 71 INTEL_PT_NO_CTX, /* BIP packets are invalid */ 77 INTEL_PT_BLK_4_CTX, /* 4-byte BIP 72 INTEL_PT_BLK_4_CTX, /* 4-byte BIP packets */ 78 INTEL_PT_BLK_8_CTX, /* 8-byte BIP 73 INTEL_PT_BLK_8_CTX, /* 8-byte BIP packets */ 79 }; 74 }; 80 75 81 const char *intel_pt_pkt_name(enum intel_pt_pk 76 const char *intel_pt_pkt_name(enum intel_pt_pkt_type); 82 77 83 int intel_pt_get_packet(const unsigned char *b 78 int intel_pt_get_packet(const unsigned char *buf, size_t len, 84 struct intel_pt_pkt *p 79 struct intel_pt_pkt *packet, 85 enum intel_pt_pkt_ctx 80 enum intel_pt_pkt_ctx *ctx); 86 81 87 void intel_pt_upd_pkt_ctx(const struct intel_p 82 void intel_pt_upd_pkt_ctx(const struct intel_pt_pkt *packet, 88 enum intel_pt_pkt_ct 83 enum intel_pt_pkt_ctx *ctx); 89 84 90 int intel_pt_pkt_desc(const struct intel_pt_pk 85 int intel_pt_pkt_desc(const struct intel_pt_pkt *packet, char *buf, size_t len); 91 86 92 #endif 87 #endif 93 88
Linux® is a registered trademark of Linus Torvalds in the United States and other countries.
TOMOYO® is a registered trademark of NTT DATA CORPORATION.