1 /* SPDX-License-Identifier: GPL-2.0-only */
3 * intel_pt_log.h: Intel Processor Trace support
4 * Copyright (c) 2013-2014, Intel Corporation.
7 #ifndef INCLUDE__INTEL_PT_LOG_H__
8 #define INCLUDE__INTEL_PT_LOG_H__
10 #include <linux/compiler.h>
16 void *intel_pt_log_fp(void);
17 void intel_pt_log_enable(void);
18 void intel_pt_log_disable(void);
19 void intel_pt_log_set_name(const char *name
);
21 void __intel_pt_log_packet(const struct intel_pt_pkt
*packet
, int pkt_len
,
22 uint64_t pos
, const unsigned char *buf
);
26 void __intel_pt_log_insn(struct intel_pt_insn
*intel_pt_insn
, uint64_t ip
);
27 void __intel_pt_log_insn_no_data(struct intel_pt_insn
*intel_pt_insn
,
30 void __intel_pt_log(const char *fmt
, ...) __printf(1, 2);
32 #define intel_pt_log(fmt, ...) \
34 if (intel_pt_enable_logging) \
35 __intel_pt_log(fmt, ##__VA_ARGS__); \
38 #define intel_pt_log_packet(arg, ...) \
40 if (intel_pt_enable_logging) \
41 __intel_pt_log_packet(arg, ##__VA_ARGS__); \
44 #define intel_pt_log_insn(arg, ...) \
46 if (intel_pt_enable_logging) \
47 __intel_pt_log_insn(arg, ##__VA_ARGS__); \
50 #define intel_pt_log_insn_no_data(arg, ...) \
52 if (intel_pt_enable_logging) \
53 __intel_pt_log_insn_no_data(arg, ##__VA_ARGS__); \
56 #define x64_fmt "0x%" PRIx64
58 extern bool intel_pt_enable_logging
;
60 static inline void intel_pt_log_at(const char *msg
, uint64_t u
)
62 intel_pt_log("%s at " x64_fmt
"\n", msg
, u
);
65 static inline void intel_pt_log_to(const char *msg
, uint64_t u
)
67 intel_pt_log("%s to " x64_fmt
"\n", msg
, u
);