From 3badfd13ded3df818dbd6a48cee7a4ff8e242ab6 Mon Sep 17 00:00:00 2001 From: Masami Hiramatsu Date: Mon, 5 Dec 2011 21:05:39 +0900 Subject: [PATCH] --- yaml --- r: 277307 b: refs/heads/master c: 130b78b2bf16d5d89091db38374faef896360cf9 h: refs/heads/master i: 277305: 9892534927ec398dbfcca0c4267cce7b228a6333 277303: 3df38f9b11e5866db9f48f9ad076b4529426c587 v: v3 --- [refs] | 2 +- trunk/arch/x86/lib/inat.c | 9 ++++++++- trunk/arch/x86/lib/insn.c | 4 +++- 3 files changed, 12 insertions(+), 3 deletions(-) diff --git a/[refs] b/[refs] index cf72d5ae5a2b..c4440ec92227 100644 --- a/[refs] +++ b/[refs] @@ -1,2 +1,2 @@ --- -refs/heads/master: 1056c3e916f12cdd8042ab27dfccbb3a9e871df0 +refs/heads/master: 130b78b2bf16d5d89091db38374faef896360cf9 diff --git a/trunk/arch/x86/lib/inat.c b/trunk/arch/x86/lib/inat.c index 46fc4ee09fc4..88ad5fbda6e1 100644 --- a/trunk/arch/x86/lib/inat.c +++ b/trunk/arch/x86/lib/inat.c @@ -82,9 +82,16 @@ insn_attr_t inat_get_avx_attribute(insn_byte_t opcode, insn_byte_t vex_m, const insn_attr_t *table; if (vex_m > X86_VEX_M_MAX || vex_p > INAT_LSTPFX_MAX) return 0; - table = inat_avx_tables[vex_m][vex_p]; + /* At first, this checks the master table */ + table = inat_avx_tables[vex_m][0]; if (!table) return 0; + if (!inat_is_group(table[opcode]) && vex_p) { + /* If this is not a group, get attribute directly */ + table = inat_avx_tables[vex_m][vex_p]; + if (!table) + return 0; + } return table[opcode]; } diff --git a/trunk/arch/x86/lib/insn.c b/trunk/arch/x86/lib/insn.c index 374562ed6704..5a1f9f3e3fbb 100644 --- a/trunk/arch/x86/lib/insn.c +++ b/trunk/arch/x86/lib/insn.c @@ -202,7 +202,7 @@ void insn_get_opcode(struct insn *insn) m = insn_vex_m_bits(insn); p = insn_vex_p_bits(insn); insn->attr = inat_get_avx_attribute(op, m, p); - if (!inat_accept_vex(insn->attr)) + if (!inat_accept_vex(insn->attr) && !inat_is_group(insn->attr)) insn->attr = 0; /* This instruction is bad */ goto end; /* VEX has only 1 byte for opcode */ } @@ -249,6 +249,8 @@ void insn_get_modrm(struct insn *insn) pfx = insn_last_prefix(insn); insn->attr = inat_get_group_attribute(mod, pfx, insn->attr); + if (insn_is_avx(insn) && !inat_accept_vex(insn->attr)) + insn->attr = 0; /* This is bad */ } }