Merge tag 'ntb-5.11' of git://github.com/jonmason/ntb
[linux/fpc-iii.git] / tools / perf / arch / x86 / util / archinsn.c
blob3e6791531ca5a1799f92f7db8c11c9b3b107439b
1 // SPDX-License-Identifier: GPL-2.0
2 #include "../../../../arch/x86/include/asm/insn.h"
3 #include "archinsn.h"
4 #include "event.h"
5 #include "machine.h"
6 #include "thread.h"
7 #include "symbol.h"
9 void arch_fetch_insn(struct perf_sample *sample,
10 struct thread *thread,
11 struct machine *machine)
13 struct insn insn;
14 int len;
15 bool is64bit = false;
17 if (!sample->ip)
18 return;
19 len = thread__memcpy(thread, machine, sample->insn, sample->ip, sizeof(sample->insn), &is64bit);
20 if (len <= 0)
21 return;
22 insn_init(&insn, sample->insn, len, is64bit);
23 insn_get_length(&insn);
24 if (insn_complete(&insn) && insn.length <= len)
25 sample->insn_len = insn.length;