summaryrefslogtreecommitdiffstats
path: root/tools/perf/arch/x86/util/archinsn.c
diff options
context:
space:
mode:
authorGreg Kroah-Hartman <gregkh@linuxfoundation.org>2019-03-26 17:17:40 +0900
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2019-03-26 17:17:40 +0900
commit80045e14423aaf1d3d51bca0524336f8a624003e (patch)
tree915319f6d353a2e8c1f69a16502e61d6020f3bc4 /tools/perf/arch/x86/util/archinsn.c
parent5cec2d2e5839f9c0fec319c523a911e0a7fd299f (diff)
parent7c22278edd0a931c565a8511dfc1bc57ffbb9166 (diff)
downloadlinux-80045e14423aaf1d3d51bca0524336f8a624003e.tar.bz2
Merge tag 'misc-habanalabs-fixes-2019-03-26' of git://people.freedesktop.org/~gabbayo/linux into char-misc-next:
Oded writes: The following bug fixes are included in this tag: - Fix host crash upon resume after suspend - Fix MMU related bugs which result in user's jobs getting stuck - Fix race between user context cleanup and hard-reset which results in host crash - Fix sparse warning * tag 'misc-habanalabs-fixes-2019-03-26' of git://people.freedesktop.org/~gabbayo/linux: (265 commits) habanalabs: cast to expected type habanalabs: prevent host crash during suspend/resume habanalabs: perform accounting for active CS habanalabs: fix mapping with page size bigger than 4KB habanalabs: complete user context cleanup before hard reset habanalabs: fix bug when mapping very large memory area habanalabs: fix MMU number of pages calculation Linux 5.1-rc2 clocksource/drivers/clps711x: Remove board support ext4: prohibit fstrim in norecovery mode ext4: cleanup bh release code in ext4_ind_remove_space() ext4: brelse all indirect buffer in ext4_ind_remove_space() genirq: Mark expected switch case fall-through clocksource/drivers/riscv: Fix clocksource mask x86/gart: Exclude GART aperture from kcore cifs: update internal module version number SMB3: Fix SMB3.1.1 guest mounts to Samba cifs: Fix slab-out-of-bounds when tracing SMB tcon cifs: allow guest mounts to work for smb3.11 fix incorrect error code mapping for OBJECTID_NOT_FOUND ...
Diffstat (limited to 'tools/perf/arch/x86/util/archinsn.c')
-rw-r--r--tools/perf/arch/x86/util/archinsn.c26
1 files changed, 26 insertions, 0 deletions
diff --git a/tools/perf/arch/x86/util/archinsn.c b/tools/perf/arch/x86/util/archinsn.c
new file mode 100644
index 000000000000..4237bb2e7fa2
--- /dev/null
+++ b/tools/perf/arch/x86/util/archinsn.c
@@ -0,0 +1,26 @@
+// SPDX-License-Identifier: GPL-2.0
+#include "perf.h"
+#include "archinsn.h"
+#include "util/intel-pt-decoder/insn.h"
+#include "machine.h"
+#include "thread.h"
+#include "symbol.h"
+
+void arch_fetch_insn(struct perf_sample *sample,
+ struct thread *thread,
+ struct machine *machine)
+{
+ struct insn insn;
+ int len;
+ bool is64bit = false;
+
+ if (!sample->ip)
+ return;
+ len = thread__memcpy(thread, machine, sample->insn, sample->ip, sizeof(sample->insn), &is64bit);
+ if (len <= 0)
+ return;
+ insn_init(&insn, sample->insn, len, is64bit);
+ insn_get_length(&insn);
+ if (insn_complete(&insn) && insn.length <= len)
+ sample->insn_len = insn.length;
+}