xref: /kernel/linux/linux-5.10/tools/perf/arch/x86/util/archinsn.c
  • Home
  • History
  • Annotate Annotate
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
  • only in /kernel/linux/linux-5.10/tools/perf/arch/x86/util/
18c2ecf20Sopenharmony_ci// SPDX-License-Identifier: GPL-2.0
28c2ecf20Sopenharmony_ci#include "../../../../arch/x86/include/asm/insn.h"
38c2ecf20Sopenharmony_ci#include "archinsn.h"
48c2ecf20Sopenharmony_ci#include "event.h"
58c2ecf20Sopenharmony_ci#include "machine.h"
68c2ecf20Sopenharmony_ci#include "thread.h"
78c2ecf20Sopenharmony_ci#include "symbol.h"
88c2ecf20Sopenharmony_ci
98c2ecf20Sopenharmony_civoid arch_fetch_insn(struct perf_sample *sample,
108c2ecf20Sopenharmony_ci		     struct thread *thread,
118c2ecf20Sopenharmony_ci		     struct machine *machine)
128c2ecf20Sopenharmony_ci{
138c2ecf20Sopenharmony_ci	struct insn insn;
148c2ecf20Sopenharmony_ci	int len;
158c2ecf20Sopenharmony_ci	bool is64bit = false;
168c2ecf20Sopenharmony_ci
178c2ecf20Sopenharmony_ci	if (!sample->ip)
188c2ecf20Sopenharmony_ci		return;
198c2ecf20Sopenharmony_ci	len = thread__memcpy(thread, machine, sample->insn, sample->ip, sizeof(sample->insn), &is64bit);
208c2ecf20Sopenharmony_ci	if (len <= 0)
218c2ecf20Sopenharmony_ci		return;
228c2ecf20Sopenharmony_ci	insn_init(&insn, sample->insn, len, is64bit);
238c2ecf20Sopenharmony_ci	insn_get_length(&insn);
248c2ecf20Sopenharmony_ci	if (insn_complete(&insn) && insn.length <= len)
258c2ecf20Sopenharmony_ci		sample->insn_len = insn.length;
268c2ecf20Sopenharmony_ci}
27

Indexes created Thu Nov 07 10:32:03 CST 2024