1 /* SPDX-License-Identifier: GPL-2.0-only */
3 * intel_pt_pkt_decoder.h: Intel Processor Trace support
4 * Copyright (c) 2013-2014, Intel Corporation.
7 #ifndef INCLUDE__INTEL_PT_PKT_DECODER_H__
8 #define INCLUDE__INTEL_PT_PKT_DECODER_H__
13 #define INTEL_PT_PKT_DESC_MAX 256
15 #define INTEL_PT_NEED_MORE_BYTES -1
16 #define INTEL_PT_BAD_PACKET -2
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
22 #define INTEL_PT_PKT_MAX_SZ 16
24 #define INTEL_PT_VMX_NR_FLAG 1
26 enum intel_pt_pkt_type
{
65 enum intel_pt_pkt_type type
;
71 * Decoding of BIP packets conflicts with single-byte TNT packets. Since BIP
72 * 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 packet decoder.
75 enum intel_pt_pkt_ctx
{
76 INTEL_PT_NO_CTX
, /* BIP packets are invalid */
77 INTEL_PT_BLK_4_CTX
, /* 4-byte BIP packets */
78 INTEL_PT_BLK_8_CTX
, /* 8-byte BIP packets */
81 const char *intel_pt_pkt_name(enum intel_pt_pkt_type
);
83 int intel_pt_get_packet(const unsigned char *buf
, size_t len
,
84 struct intel_pt_pkt
*packet
,
85 enum intel_pt_pkt_ctx
*ctx
);
87 void intel_pt_upd_pkt_ctx(const struct intel_pt_pkt
*packet
,
88 enum intel_pt_pkt_ctx
*ctx
);
90 int intel_pt_pkt_desc(const struct intel_pt_pkt
*packet
, char *buf
, size_t len
);