2 * Copyright (c) 2014-2018, Intel Corporation
4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are met:
7 * * Redistributions of source code must retain the above copyright notice,
8 * this list of conditions and the following disclaimer.
9 * * Redistributions in binary form must reproduce the above copyright notice,
10 * this list of conditions and the following disclaimer in the documentation
11 * and/or other materials provided with the distribution.
12 * * Neither the name of Intel Corporation nor the names of its contributors
13 * may be used to endorse or promote products derived from this software
14 * without specific prior written permission.
16 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
17 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
18 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
19 * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
20 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
21 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
22 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
23 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
24 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
25 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
26 * POSSIBILITY OF SUCH DAMAGE.
29 #ifndef PT_PACKET_DECODER_H
30 #define PT_PACKET_DECODER_H
35 /* An Intel PT packet decoder. */
36 struct pt_packet_decoder {
37 /* The decoder configuration. */
38 struct pt_config config;
40 /* The current position in the trace buffer. */
43 /* The position of the last PSB packet. */
48 /* Initialize the packet decoder.
50 * Returns zero on success, a negative error code otherwise.
52 extern int pt_pkt_decoder_init(struct pt_packet_decoder *,
53 const struct pt_config *);
55 /* Finalize the packet decoder. */
56 extern void pt_pkt_decoder_fini(struct pt_packet_decoder *);
59 /* Decoder functions for the packet decoder. */
60 extern int pt_pkt_decode_unknown(struct pt_packet_decoder *,
62 extern int pt_pkt_decode_pad(struct pt_packet_decoder *, struct pt_packet *);
63 extern int pt_pkt_decode_psb(struct pt_packet_decoder *, struct pt_packet *);
64 extern int pt_pkt_decode_tip(struct pt_packet_decoder *, struct pt_packet *);
65 extern int pt_pkt_decode_tnt_8(struct pt_packet_decoder *, struct pt_packet *);
66 extern int pt_pkt_decode_tnt_64(struct pt_packet_decoder *,
68 extern int pt_pkt_decode_tip_pge(struct pt_packet_decoder *,
70 extern int pt_pkt_decode_tip_pgd(struct pt_packet_decoder *,
72 extern int pt_pkt_decode_fup(struct pt_packet_decoder *, struct pt_packet *);
73 extern int pt_pkt_decode_pip(struct pt_packet_decoder *, struct pt_packet *);
74 extern int pt_pkt_decode_ovf(struct pt_packet_decoder *, struct pt_packet *);
75 extern int pt_pkt_decode_mode(struct pt_packet_decoder *, struct pt_packet *);
76 extern int pt_pkt_decode_psbend(struct pt_packet_decoder *,
78 extern int pt_pkt_decode_tsc(struct pt_packet_decoder *, struct pt_packet *);
79 extern int pt_pkt_decode_cbr(struct pt_packet_decoder *, struct pt_packet *);
80 extern int pt_pkt_decode_tma(struct pt_packet_decoder *, struct pt_packet *);
81 extern int pt_pkt_decode_mtc(struct pt_packet_decoder *, struct pt_packet *);
82 extern int pt_pkt_decode_cyc(struct pt_packet_decoder *, struct pt_packet *);
83 extern int pt_pkt_decode_stop(struct pt_packet_decoder *, struct pt_packet *);
84 extern int pt_pkt_decode_vmcs(struct pt_packet_decoder *, struct pt_packet *);
85 extern int pt_pkt_decode_mnt(struct pt_packet_decoder *, struct pt_packet *);
86 extern int pt_pkt_decode_exstop(struct pt_packet_decoder *, struct pt_packet *);
87 extern int pt_pkt_decode_mwait(struct pt_packet_decoder *, struct pt_packet *);
88 extern int pt_pkt_decode_pwre(struct pt_packet_decoder *, struct pt_packet *);
89 extern int pt_pkt_decode_pwrx(struct pt_packet_decoder *, struct pt_packet *);
90 extern int pt_pkt_decode_ptw(struct pt_packet_decoder *, struct pt_packet *);
92 #endif /* PT_PACKET_DECODER_H */