1 // SPDX-License-Identifier: GPL-2.0 2 #include "../../../../arch/x86/include/asm/insn.h" 3 #include "archinsn.h" 4 #include "machine.h" 5 #include "thread.h" 6 #include "symbol.h" 7 8 void arch_fetch_insn(struct perf_sample *sample, 9 struct thread *thread, 10 struct machine *machine) 11 { 12 struct insn insn; 13 int len; 14 bool is64bit = false; 15 16 if (!sample->ip) 17 return; 18 len = thread__memcpy(thread, machine, sample->insn, sample->ip, sizeof(sample->insn), &is64bit); 19 if (len <= 0) 20 return; 21 insn_init(&insn, sample->insn, len, is64bit); 22 insn_get_length(&insn); 23 if (insn_complete(&insn) && insn.length <= len) 24 sample->insn_len = insn.length; 25 } 26