From: tip-bot for Adrian Hunter <tipbot@zytor.com>
To: linux-tip-commits@vger.kernel.org
Cc: qiaowei.ren@intel.com, luto@amacapital.net, tglx@linutronix.de,
masami.hiramatsu.pt@hitachi.com, linux-kernel@vger.kernel.org,
dave.hansen@linux.intel.com, dvlasenk@redhat.com, hpa@zytor.com,
acme@redhat.com, peterz@infradead.org, adrian.hunter@intel.com,
jolsa@redhat.com, mingo@kernel.org
Subject: [tip:perf/core] x86/insn: perf tools: Pedantically tweak opcode map for MPX instructions
Date: Tue, 8 Sep 2015 07:36:46 -0700 [thread overview]
Message-ID: <tip-78173ec6311a22ca9f42cf949cf37754a8b71633@git.kernel.org> (raw)
In-Reply-To: <1441196131-20632-4-git-send-email-adrian.hunter@intel.com>
Commit-ID: 78173ec6311a22ca9f42cf949cf37754a8b71633
Gitweb: http://git.kernel.org/tip/78173ec6311a22ca9f42cf949cf37754a8b71633
Author: Adrian Hunter <adrian.hunter@intel.com>
AuthorDate: Wed, 2 Sep 2015 15:15:27 +0300
Committer: Arnaldo Carvalho de Melo <acme@redhat.com>
CommitDate: Fri, 4 Sep 2015 12:01:02 -0300
x86/insn: perf tools: Pedantically tweak opcode map for MPX instructions
The MPX instructions are presently not described in the SDM
opcode maps, and there are not encoding characters for bnd
registers, address method or operand type. So the kernel
opcode map is using 'Gv' for bnd registers and 'Ev' for
everything else. That is fine because the instruction
decoder does not use that information anyway, except as
an indication that there is a ModR/M byte.
Nevertheless, in some cases the 'Gv' and 'Ev' are the wrong
way around, BNDLDX and BNDSTX have 2 operands not 3, and it
wouldn't hurt to identify the mandatory prefixes.
This has no effect on the decoding of valid instructions,
but the addition of the mandatory prefixes will cause some
invalid instructions to error out that wouldn't have
previously.
Note that perf tools has a copy of the instruction decoder
and provides a test for new instructions which includes MPX
instructions e.g.
$ perf test "x86 ins"
39: Test x86 instruction decoder - new instructions : Ok
Or to see the details:
$ perf test -v "x86 ins"
Commiter notes:
And to see these MPX instructions specifically:
$ perf test -v "x86 ins" 2>&1 | grep bndldx | head -3
Decoded ok: 0f 1a 00 bndldx (%eax),%bnd0
Decoded ok: 0f 1a 05 78 56 34 12 bndldx 0x12345678,%bnd0
Decoded ok: 0f 1a 18 bndldx (%eax),%bnd3
$ perf test -v "x86 ins" 2>&1 | grep bndstx | head -3
Decoded ok: 0f 1b 00 bndstx %bnd0,(%eax)
Decoded ok: 0f 1b 05 78 56 34 12 bndstx %bnd0,0x12345678
Decoded ok: 0f 1b 18 bndstx %bnd3,(%eax)
$
Signed-off-by: Adrian Hunter <adrian.hunter@intel.com>
Acked-by: Masami Hiramatsu <masami.hiramatsu.pt@hitachi.com>
Cc: "H. Peter Anvin" <hpa@zytor.com>
Cc: Andy Lutomirski <luto@amacapital.net>
Cc: Dave Hansen <dave.hansen@linux.intel.com>
Cc: Denys Vlasenko <dvlasenk@redhat.com>
Cc: Jiri Olsa <jolsa@redhat.com>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Qiaowei Ren <qiaowei.ren@intel.com>
Cc: Thomas Gleixner <tglx@linutronix.de>
Link: http://lkml.kernel.org/r/1441196131-20632-4-git-send-email-adrian.hunter@intel.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
arch/x86/lib/x86-opcode-map.txt | 8 ++++++--
tools/perf/util/intel-pt-decoder/x86-opcode-map.txt | 8 ++++++--
2 files changed, 12 insertions(+), 4 deletions(-)
diff --git a/arch/x86/lib/x86-opcode-map.txt b/arch/x86/lib/x86-opcode-map.txt
index 816488c..a02a195 100644
--- a/arch/x86/lib/x86-opcode-map.txt
+++ b/arch/x86/lib/x86-opcode-map.txt
@@ -353,8 +353,12 @@ AVXcode: 1
17: vmovhps Mq,Vq (v1) | vmovhpd Mq,Vq (66),(v1)
18: Grp16 (1A)
19:
-1a: BNDCL Ev,Gv | BNDCU Ev,Gv | BNDMOV Gv,Ev | BNDLDX Gv,Ev,Gv
-1b: BNDCN Ev,Gv | BNDMOV Ev,Gv | BNDMK Gv,Ev | BNDSTX Ev,GV,Gv
+# Intel SDM opcode map does not list MPX instructions. For now using Gv for
+# bnd registers and Ev for everything else is OK because the instruction
+# decoder does not use the information except as an indication that there is
+# a ModR/M byte.
+1a: BNDCL Gv,Ev (F3) | BNDCU Gv,Ev (F2) | BNDMOV Gv,Ev (66) | BNDLDX Gv,Ev
+1b: BNDCN Gv,Ev (F2) | BNDMOV Ev,Gv (66) | BNDMK Gv,Ev (F3) | BNDSTX Ev,Gv
1c:
1d:
1e:
diff --git a/tools/perf/util/intel-pt-decoder/x86-opcode-map.txt b/tools/perf/util/intel-pt-decoder/x86-opcode-map.txt
index 816488c..a02a195 100644
--- a/tools/perf/util/intel-pt-decoder/x86-opcode-map.txt
+++ b/tools/perf/util/intel-pt-decoder/x86-opcode-map.txt
@@ -353,8 +353,12 @@ AVXcode: 1
17: vmovhps Mq,Vq (v1) | vmovhpd Mq,Vq (66),(v1)
18: Grp16 (1A)
19:
-1a: BNDCL Ev,Gv | BNDCU Ev,Gv | BNDMOV Gv,Ev | BNDLDX Gv,Ev,Gv
-1b: BNDCN Ev,Gv | BNDMOV Ev,Gv | BNDMK Gv,Ev | BNDSTX Ev,GV,Gv
+# Intel SDM opcode map does not list MPX instructions. For now using Gv for
+# bnd registers and Ev for everything else is OK because the instruction
+# decoder does not use the information except as an indication that there is
+# a ModR/M byte.
+1a: BNDCL Gv,Ev (F3) | BNDCU Gv,Ev (F2) | BNDMOV Gv,Ev (66) | BNDLDX Gv,Ev
+1b: BNDCN Gv,Ev (F2) | BNDMOV Ev,Gv (66) | BNDMK Gv,Ev (F3) | BNDSTX Ev,Gv
1c:
1d:
1e:
next prev parent reply other threads:[~2015-09-08 14:37 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-09-02 12:15 [PATCH V2 0/7] x86/insn: perf tools: Add a few new x86 instructions Adrian Hunter
2015-09-02 12:15 ` [PATCH V2 1/7] perf tools: Display build warning if x86 instruction decoder differs from kernel Adrian Hunter
2015-09-03 15:50 ` 平松雅巳 / HIRAMATU,MASAMI
2015-09-08 14:36 ` [tip:perf/core] " tip-bot for Adrian Hunter
2015-09-02 12:15 ` [PATCH V2 2/7] perf tools: Add a test for decoding of new x86 instructions Adrian Hunter
2015-09-08 14:36 ` [tip:perf/core] " tip-bot for Adrian Hunter
2015-09-02 12:15 ` [PATCH V2 3/7] x86/insn: perf tools: Pedantically tweak opcode map for MPX instructions Adrian Hunter
2015-09-03 16:01 ` 平松雅巳 / HIRAMATU,MASAMI
2015-09-08 14:36 ` tip-bot for Adrian Hunter [this message]
2015-09-02 12:15 ` [PATCH V2 4/7] x86/insn: perf tools: Add new SHA instructions Adrian Hunter
2015-09-08 14:37 ` [tip:perf/core] " tip-bot for Adrian Hunter
2015-09-02 12:15 ` [PATCH V2 5/7] x86/insn: perf tools: Add new memory instructions Adrian Hunter
2015-09-03 16:11 ` 平松雅巳 / HIRAMATU,MASAMI
2015-09-08 14:37 ` [tip:perf/core] " tip-bot for Adrian Hunter
2015-09-02 12:15 ` [PATCH V2 6/7] x86/insn: perf tools: Add new memory protection keys instructions Adrian Hunter
2015-09-03 16:00 ` 平松雅巳 / HIRAMATU,MASAMI
2015-09-08 14:37 ` [tip:perf/core] " tip-bot for Adrian Hunter
2015-09-02 12:15 ` [PATCH V2 7/7] x86/insn: perf tools: Add new xsave instructions Adrian Hunter
2015-09-03 16:21 ` 平松雅巳 / HIRAMATU,MASAMI
2015-09-08 14:38 ` [tip:perf/core] " tip-bot for Adrian Hunter
2015-09-02 19:54 ` [PATCH V2 0/7] x86/insn: perf tools: Add a few new x86 instructions Arnaldo Carvalho de Melo
2015-09-03 11:01 ` Adrian Hunter
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=tip-78173ec6311a22ca9f42cf949cf37754a8b71633@git.kernel.org \
--to=tipbot@zytor.com \
--cc=acme@redhat.com \
--cc=adrian.hunter@intel.com \
--cc=dave.hansen@linux.intel.com \
--cc=dvlasenk@redhat.com \
--cc=hpa@zytor.com \
--cc=jolsa@redhat.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-tip-commits@vger.kernel.org \
--cc=luto@amacapital.net \
--cc=masami.hiramatsu.pt@hitachi.com \
--cc=mingo@kernel.org \
--cc=peterz@infradead.org \
--cc=qiaowei.ren@intel.com \
--cc=tglx@linutronix.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox