1 /* SPDX-License-Identifier: GPL-2.0-only */ 2 /* 3 * intel_pt_pkt_decoder.h: Intel Processor Trace support 4 * Copyright (c) 2013-2014, Intel Corporation. 5 */ 6 7 #ifndef INCLUDE__INTEL_PT_PKT_DECODER_H__ 8 #define INCLUDE__INTEL_PT_PKT_DECODER_H__ 9 10 #include <stddef.h> 11 #include <stdint.h> 12 13 #define INTEL_PT_PKT_DESC_MAX 256 14 15 #define INTEL_PT_NEED_MORE_BYTES -1 16 #define INTEL_PT_BAD_PACKET -2 17 18 #define INTEL_PT_PSB_STR "\002\202\002\202\002\202\002\202" \ 19 "\002\202\002\202\002\202\002\202" 20 #define INTEL_PT_PSB_LEN 16 21 22 #define INTEL_PT_PKT_MAX_SZ 16 23 24 enum intel_pt_pkt_type { 25 INTEL_PT_BAD, 26 INTEL_PT_PAD, 27 INTEL_PT_TNT, 28 INTEL_PT_TIP_PGD, 29 INTEL_PT_TIP_PGE, 30 INTEL_PT_TSC, 31 INTEL_PT_TMA, 32 INTEL_PT_MODE_EXEC, 33 INTEL_PT_MODE_TSX, 34 INTEL_PT_MTC, 35 INTEL_PT_TIP, 36 INTEL_PT_FUP, 37 INTEL_PT_CYC, 38 INTEL_PT_VMCS, 39 INTEL_PT_PSB, 40 INTEL_PT_PSBEND, 41 INTEL_PT_CBR, 42 INTEL_PT_TRACESTOP, 43 INTEL_PT_PIP, 44 INTEL_PT_OVF, 45 INTEL_PT_MNT, 46 INTEL_PT_PTWRITE, 47 INTEL_PT_PTWRITE_IP, 48 INTEL_PT_EXSTOP, 49 INTEL_PT_EXSTOP_IP, 50 INTEL_PT_MWAIT, 51 INTEL_PT_PWRE, 52 INTEL_PT_PWRX, 53 }; 54 55 struct intel_pt_pkt { 56 enum intel_pt_pkt_type type; 57 int count; 58 uint64_t payload; 59 }; 60 61 const char *intel_pt_pkt_name(enum intel_pt_pkt_type); 62 63 int intel_pt_get_packet(const unsigned char *buf, size_t len, 64 struct intel_pt_pkt *packet); 65 66 int intel_pt_pkt_desc(const struct intel_pt_pkt *packet, char *buf, size_t len); 67 68 #endif 69