Adrian Hunter | a4e9259 | 2015-07-17 19:33:37 +0300 | [diff] [blame] | 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 | |
| 16 | #ifndef INCLUDE__INTEL_PT_PKT_DECODER_H__ |
| 17 | #define INCLUDE__INTEL_PT_PKT_DECODER_H__ |
| 18 | |
| 19 | #include <stddef.h> |
| 20 | #include <stdint.h> |
| 21 | |
| 22 | #define INTEL_PT_PKT_DESC_MAX 256 |
| 23 | |
| 24 | #define INTEL_PT_NEED_MORE_BYTES -1 |
| 25 | #define INTEL_PT_BAD_PACKET -2 |
| 26 | |
| 27 | #define INTEL_PT_PSB_STR "\002\202\002\202\002\202\002\202" \ |
| 28 | "\002\202\002\202\002\202\002\202" |
| 29 | #define INTEL_PT_PSB_LEN 16 |
| 30 | |
| 31 | #define INTEL_PT_PKT_MAX_SZ 16 |
| 32 | |
| 33 | enum intel_pt_pkt_type { |
| 34 | INTEL_PT_BAD, |
| 35 | INTEL_PT_PAD, |
| 36 | INTEL_PT_TNT, |
| 37 | INTEL_PT_TIP_PGD, |
| 38 | INTEL_PT_TIP_PGE, |
| 39 | INTEL_PT_TSC, |
Adrian Hunter | 3d49807 | 2015-07-17 19:33:53 +0300 | [diff] [blame] | 40 | INTEL_PT_TMA, |
Adrian Hunter | a4e9259 | 2015-07-17 19:33:37 +0300 | [diff] [blame] | 41 | INTEL_PT_MODE_EXEC, |
| 42 | INTEL_PT_MODE_TSX, |
Adrian Hunter | 3d49807 | 2015-07-17 19:33:53 +0300 | [diff] [blame] | 43 | INTEL_PT_MTC, |
Adrian Hunter | a4e9259 | 2015-07-17 19:33:37 +0300 | [diff] [blame] | 44 | INTEL_PT_TIP, |
| 45 | INTEL_PT_FUP, |
Adrian Hunter | 3d49807 | 2015-07-17 19:33:53 +0300 | [diff] [blame] | 46 | INTEL_PT_CYC, |
| 47 | INTEL_PT_VMCS, |
Adrian Hunter | a4e9259 | 2015-07-17 19:33:37 +0300 | [diff] [blame] | 48 | INTEL_PT_PSB, |
| 49 | INTEL_PT_PSBEND, |
| 50 | INTEL_PT_CBR, |
Adrian Hunter | 3d49807 | 2015-07-17 19:33:53 +0300 | [diff] [blame] | 51 | INTEL_PT_TRACESTOP, |
Adrian Hunter | a4e9259 | 2015-07-17 19:33:37 +0300 | [diff] [blame] | 52 | INTEL_PT_PIP, |
| 53 | INTEL_PT_OVF, |
Adrian Hunter | 3d49807 | 2015-07-17 19:33:53 +0300 | [diff] [blame] | 54 | INTEL_PT_MNT, |
Adrian Hunter | a4e9259 | 2015-07-17 19:33:37 +0300 | [diff] [blame] | 55 | }; |
| 56 | |
| 57 | struct intel_pt_pkt { |
| 58 | enum intel_pt_pkt_type type; |
| 59 | int count; |
| 60 | uint64_t payload; |
| 61 | }; |
| 62 | |
| 63 | const char *intel_pt_pkt_name(enum intel_pt_pkt_type); |
| 64 | |
| 65 | int intel_pt_get_packet(const unsigned char *buf, size_t len, |
| 66 | struct intel_pt_pkt *packet); |
| 67 | |
| 68 | int intel_pt_pkt_desc(const struct intel_pt_pkt *packet, char *buf, size_t len); |
| 69 | |
| 70 | #endif |