hc
2024-05-10 37f49e37ab4cb5d0bc4c60eb5c6d4dd57db767bb
kernel/tools/perf/util/intel-pt-decoder/intel-pt-insn-decoder.c
....@@ -1,29 +1,20 @@
1
+// SPDX-License-Identifier: GPL-2.0-only
12 /*
23 * intel_pt_insn_decoder.c: Intel Processor Trace support
34 * 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
- *
145 */
156
7
+#include <linux/kernel.h>
168 #include <stdio.h>
179 #include <string.h>
1810 #include <endian.h>
1911 #include <byteswap.h>
12
+#include "../../../arch/x86/include/asm/insn.h"
13
+
14
+#include "../../../arch/x86/lib/inat.c"
15
+#include "../../../arch/x86/lib/insn.c"
2016
2117 #include "event.h"
22
-
23
-#include "insn.h"
24
-
25
-#include "inat.c"
26
-#include "insn.c"
2718
2819 #include "intel-pt-insn-decoder.h"
2920 #include "dump-insn.h"
....@@ -180,6 +171,14 @@
180171 return 0;
181172 }
182173
174
+int arch_is_branch(const unsigned char *buf, size_t len, int x86_64)
175
+{
176
+ struct intel_pt_insn in;
177
+ if (intel_pt_get_insn(buf, len, x86_64, &in) < 0)
178
+ return -1;
179
+ return in.branch != INTEL_PT_BR_NO_BRANCH;
180
+}
181
+
183182 const char *dump_insn(struct perf_insn *x, uint64_t ip __maybe_unused,
184183 u8 *inbuf, int inlen, int *lenp)
185184 {