public inbox for systemtap@sourceware.org
 help / color / mirror / Atom feed
From: Masami Hiramatsu <mhiramat@redhat.com>
To: Ingo Molnar <mingo@elte.hu>,
	Frederic Weisbecker <fweisbec@gmail.com>,
	        lkml<linux-kernel@vger.kernel.org>
Cc: systemtap<systemtap@sources.redhat.com>,
	        DLE<dle-develop@lists.sourceforge.net>,
	        Masami Hiramatsu <mhiramat@redhat.com>,
	Ingo Molnar <mingo@elte.hu>,
	        Steven Rostedt <rostedt@goodmis.org>,
	        Jim Keniston <jkenisto@us.ibm.com>,
	        Ananth N Mavinakayanahalli <ananth@in.ibm.com>,
	        Christoph Hellwig <hch@infradead.org>,
	        "Frank Ch. Eigler" <fche@redhat.com>,
	        Frederic Weisbecker <fweisbec@gmail.com>,
	        "H. Peter Anvin" <hpa@zytor.com>,
	Jason Baron <jbaron@redhat.com>,
	        "K.Prasad" <prasad@linux.vnet.ibm.com>,
	        Peter Zijlstra <peterz@infradead.org>,
	        Srikar Dronamraju <srikar@linux.vnet.ibm.com>
Subject: [PATCH -tip perf/probes 02/10] x86: Merge INAT_REXPFX into INAT_PFX_*
Date: Tue, 27 Oct 2009 20:42:00 -0000	[thread overview]
Message-ID: <20091027204211.30545.58090.stgit@harusame> (raw)
In-Reply-To: <20091027204156.30545.96425.stgit@harusame>

Merge INAT_REXPFX into INAT_PFX_* macro and rename it to INAT_PFX_REX.

Signed-off-by: Masami Hiramatsu <mhiramat@redhat.com>
Cc: Ingo Molnar <mingo@elte.hu>
Cc: Steven Rostedt <rostedt@goodmis.org>
Cc: Jim Keniston <jkenisto@us.ibm.com>
Cc: Ananth N Mavinakayanahalli <ananth@in.ibm.com>
Cc: Christoph Hellwig <hch@infradead.org>
Cc: Frank Ch. Eigler <fche@redhat.com>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: H. Peter Anvin <hpa@zytor.com>
Cc: Jason Baron <jbaron@redhat.com>
Cc: K.Prasad <prasad@linux.vnet.ibm.com>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Srikar Dronamraju <srikar@linux.vnet.ibm.com>
---

 arch/x86/include/asm/inat.h          |   36 +++++++++++++++++++---------------
 arch/x86/lib/insn.c                  |    2 +-
 arch/x86/tools/gen-insn-attr-x86.awk |    6 +++---
 3 files changed, 24 insertions(+), 20 deletions(-)

diff --git a/arch/x86/include/asm/inat.h b/arch/x86/include/asm/inat.h
index 2866fdd..c2487d2 100644
--- a/arch/x86/include/asm/inat.h
+++ b/arch/x86/include/asm/inat.h
@@ -30,10 +30,11 @@
 #define INAT_OPCODE_TABLE_SIZE 256
 #define INAT_GROUP_TABLE_SIZE 8
 
-/* Legacy instruction prefixes */
+/* Legacy last prefixes */
 #define INAT_PFX_OPNDSZ	1	/* 0x66 */ /* LPFX1 */
 #define INAT_PFX_REPNE	2	/* 0xF2 */ /* LPFX2 */
 #define INAT_PFX_REPE	3	/* 0xF3 */ /* LPFX3 */
+/* Other Legacy prefixes */
 #define INAT_PFX_LOCK	4	/* 0xF0 */
 #define INAT_PFX_CS	5	/* 0x2E */
 #define INAT_PFX_DS	6	/* 0x3E */
@@ -42,8 +43,11 @@
 #define INAT_PFX_GS	9	/* 0x65 */
 #define INAT_PFX_SS	10	/* 0x36 */
 #define INAT_PFX_ADDRSZ	11	/* 0x67 */
+/* x86-64 REX prefix */
+#define INAT_PFX_REX	12	/* 0x4X */
 
-#define INAT_LPREFIX_MAX	3
+#define INAT_LSTPFX_MAX	3
+#define INAT_LGCPFX_MAX	11
 
 /* Immediate size */
 #define INAT_IMM_BYTE		1
@@ -75,12 +79,11 @@
 #define INAT_IMM_MASK	(((1 << INAT_IMM_BITS) - 1) << INAT_IMM_OFFS)
 /* Flags */
 #define INAT_FLAG_OFFS	(INAT_IMM_OFFS + INAT_IMM_BITS)
-#define INAT_REXPFX	(1 << INAT_FLAG_OFFS)
-#define INAT_MODRM	(1 << (INAT_FLAG_OFFS + 1))
-#define INAT_FORCE64	(1 << (INAT_FLAG_OFFS + 2))
-#define INAT_SCNDIMM	(1 << (INAT_FLAG_OFFS + 3))
-#define INAT_MOFFSET	(1 << (INAT_FLAG_OFFS + 4))
-#define INAT_VARIANT	(1 << (INAT_FLAG_OFFS + 5))
+#define INAT_MODRM	(1 << (INAT_FLAG_OFFS))
+#define INAT_FORCE64	(1 << (INAT_FLAG_OFFS + 1))
+#define INAT_SCNDIMM	(1 << (INAT_FLAG_OFFS + 2))
+#define INAT_MOFFSET	(1 << (INAT_FLAG_OFFS + 3))
+#define INAT_VARIANT	(1 << (INAT_FLAG_OFFS + 4))
 /* Attribute making macros for attribute tables */
 #define INAT_MAKE_PREFIX(pfx)	(pfx << INAT_PFX_OFFS)
 #define INAT_MAKE_ESCAPE(esc)	(esc << INAT_ESC_OFFS)
@@ -97,9 +100,10 @@ extern insn_attr_t inat_get_group_attribute(insn_byte_t modrm,
 					    insn_attr_t esc_attr);
 
 /* Attribute checking functions */
-static inline int inat_is_prefix(insn_attr_t attr)
+static inline int inat_is_legacy_prefix(insn_attr_t attr)
 {
-	return attr & INAT_PFX_MASK;
+	attr &= INAT_PFX_MASK;
+	return attr && attr <= INAT_LGCPFX_MAX;
 }
 
 static inline int inat_is_address_size_prefix(insn_attr_t attr)
@@ -112,9 +116,14 @@ static inline int inat_is_operand_size_prefix(insn_attr_t attr)
 	return (attr & INAT_PFX_MASK) == INAT_PFX_OPNDSZ;
 }
 
+static inline int inat_is_rex_prefix(insn_attr_t attr)
+{
+	return (attr & INAT_PFX_MASK) == INAT_PFX_REX;
+}
+
 static inline int inat_last_prefix_id(insn_attr_t attr)
 {
-	if ((attr & INAT_PFX_MASK) > INAT_LPREFIX_MAX)
+	if ((attr & INAT_PFX_MASK) > INAT_LSTPFX_MAX)
 		return 0;
 	else
 		return attr & INAT_PFX_MASK;
@@ -155,11 +164,6 @@ static inline int inat_immediate_size(insn_attr_t attr)
 	return (attr & INAT_IMM_MASK) >> INAT_IMM_OFFS;
 }
 
-static inline int inat_is_rex_prefix(insn_attr_t attr)
-{
-	return attr & INAT_REXPFX;
-}
-
 static inline int inat_has_modrm(insn_attr_t attr)
 {
 	return attr & INAT_MODRM;
diff --git a/arch/x86/lib/insn.c b/arch/x86/lib/insn.c
index dfd56a3..9f48317 100644
--- a/arch/x86/lib/insn.c
+++ b/arch/x86/lib/insn.c
@@ -69,7 +69,7 @@ void insn_get_prefixes(struct insn *insn)
 	lb = 0;
 	b = peek_next(insn_byte_t, insn);
 	attr = inat_get_opcode_attribute(b);
-	while (inat_is_prefix(attr)) {
+	while (inat_is_legacy_prefix(attr)) {
 		/* Skip if same prefix */
 		for (i = 0; i < nb; i++)
 			if (prefixes->bytes[i] == b)
diff --git a/arch/x86/tools/gen-insn-attr-x86.awk b/arch/x86/tools/gen-insn-attr-x86.awk
index 19ba096..7d54929 100644
--- a/arch/x86/tools/gen-insn-attr-x86.awk
+++ b/arch/x86/tools/gen-insn-attr-x86.awk
@@ -278,7 +278,7 @@ function convert_operands(opnd,       i,imm,mod)
 
 		# check REX prefix
 		if (match(opcode, rex_expr))
-			flags = add_flags(flags, "INAT_REXPFX")
+			flags = add_flags(flags, "INAT_MAKE_PREFIX(INAT_PFX_REX)")
 
 		# check coprocessor escape : TODO
 		if (match(opcode, fpu_expr))
@@ -316,7 +316,7 @@ END {
 	# print escape opcode map's array
 	print "/* Escape opcode map array */"
 	print "const insn_attr_t const *inat_escape_tables[INAT_ESC_MAX + 1]" \
-	      "[INAT_LPREFIX_MAX + 1] = {"
+	      "[INAT_LSTPFX_MAX + 1] = {"
 	for (i = 0; i < geid; i++)
 		for (j = 0; j < max_lprefix; j++)
 			if (etable[i,j])
@@ -325,7 +325,7 @@ END {
 	# print group opcode map's array
 	print "/* Group opcode map array */"
 	print "const insn_attr_t const *inat_group_tables[INAT_GRP_MAX + 1]"\
-	      "[INAT_LPREFIX_MAX + 1] = {"
+	      "[INAT_LSTPFX_MAX + 1] = {"
 	for (i = 0; i < ggid; i++)
 		for (j = 0; j < max_lprefix; j++)
 			if (gtable[i,j])


-- 
Masami Hiramatsu

Software Engineer
Hitachi Computer Products (America), Inc.
Software Solutions Division

e-mail: mhiramat@redhat.com

  parent reply	other threads:[~2009-10-27 20:42 UTC|newest]

Thread overview: 27+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-10-27 20:42 [PATCH -tip perf/probes 00/10] x86 insn decoder bugfixes Masami Hiramatsu
2009-10-27 20:42 ` [PATCH -tip perf/probes 01/10] x86: Fix SSE opcode map bug Masami Hiramatsu
2009-10-27 20:42 ` [PATCH -tip perf/probes 04/10] x86: AVX instruction set decoder support Masami Hiramatsu
2009-10-27 20:42 ` [PATCH -tip perf/probes 05/10] x86: Add Intel FMA instructions to x86 opcode map Masami Hiramatsu
2009-10-27 20:42 ` Masami Hiramatsu [this message]
2009-10-27 20:42 ` [PATCH -tip perf/probes 03/10] x86: Add pclmulq " Masami Hiramatsu
2009-10-27 20:42 ` [PATCH -tip perf/probes 06/10] kprobe-tracer: Compare both of event-name and event-group to find probe Masami Hiramatsu
2009-10-27 20:43 ` [PATCH -tip perf/probes 09/10] perf/probes: Change probepoint syntax of perf-probe Masami Hiramatsu
2009-10-27 20:43 ` [PATCH -tip perf/probes 07/10] perf/probes: Exit searching after finding target function Masami Hiramatsu
2009-10-27 20:43 ` [PATCH -tip perf/probes 10/10] perf/probes: Support function entry relative line number Masami Hiramatsu
2009-10-27 20:43 ` [PATCH -tip perf/probes 08/10] perf/probes: Change command-line option of perf-probe Masami Hiramatsu
2009-10-29  8:54 ` [PATCH -tip perf/probes 00/10] x86 insn decoder bugfixes Ingo Molnar
2009-10-29 15:10   ` Arnaldo Carvalho de Melo
2009-10-29 16:56   ` Masami Hiramatsu
2009-10-29 20:10     ` Masami Hiramatsu
2009-10-29 20:25       ` Josh Stone
2009-10-29 20:41         ` Masami Hiramatsu
2009-11-02 21:16     ` [PATCH -tip perf/probes 00/10] x86 insn decoder bugfixes and perf-probe syntax changes Masami Hiramatsu
2009-11-02 21:26       ` Frederic Weisbecker
2009-11-02 21:57         ` Masami Hiramatsu
2009-11-03  0:37       ` Masami Hiramatsu
2009-11-03  7:33         ` Ingo Molnar
2009-11-03 15:07           ` Masami Hiramatsu
2009-10-29 17:16   ` [PATCH -tip perf/probes 00/10] x86 insn decoder bugfixes Frank Ch. Eigler
2009-10-29 19:18   ` Roland McGrath
2009-11-03  7:25     ` Ingo Molnar
2009-11-03 12:35       ` Using build-ids in perf tools was " Arnaldo Carvalho de Melo

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=20091027204211.30545.58090.stgit@harusame \
    --to=mhiramat@redhat.com \
    --cc=ananth@in.ibm.com \
    --cc=dle-develop@lists.sourceforge.net \
    --cc=fche@redhat.com \
    --cc=fweisbec@gmail.com \
    --cc=hch@infradead.org \
    --cc=hpa@zytor.com \
    --cc=jbaron@redhat.com \
    --cc=jkenisto@us.ibm.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@elte.hu \
    --cc=peterz@infradead.org \
    --cc=prasad@linux.vnet.ibm.com \
    --cc=rostedt@goodmis.org \
    --cc=srikar@linux.vnet.ibm.com \
    --cc=systemtap@sources.redhat.com \
    /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;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).