This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
Re: [PATCH] Add x86 SSE5 instructions to the GNU binary utilities
On Thu, Sep 13, 2007 at 04:51:35PM -0500, rajagopal, dwarak wrote:
> I tried this and it does not work.
>
> {
> /* OPC_EXT_45 */
> { THREE_BYTE_SSE5_0F24 },
> { "movL", { Td, Rd } },
> },
>
> In addition to adding a case in get_valid_dis386() for handling
> IS_3BYTE_OPCODE, it does not work.
>
> To make it work I have to duplicate the modrm bit calculations which is
> done for IS_3BYTE_OPCODE again for THREE_BYTE_SSE5_0F24 in print_insn.
> Also I would need to pass an extra argument with the third opcode to
> get_valid_dis386 to make it work so that it can index the
> THREE_BYTE_SSE5_0F24 table correctly.
>
Will this patch work for you.
H.J.
----
2007-09-13 H.J. Lu <hongjiu.lu@intel.com>
* i386-dis.c (get_valid_dis386): Take a pointer to
disassemble_info. Handle IS_3BYTE_OPCODE.
(print_insn): Updated. Don't handle IS_3BYTE_OPCODE.
--- opcodes/i386-dis.c.3byte 2007-08-31 16:45:21.000000000 -0700
+++ opcodes/i386-dis.c 2007-09-13 15:34:00.000000000 -0700
@@ -3629,7 +3629,7 @@ with the -M switch (multiple options sho
/* Get a pointer to struct dis386 with a valid name. */
static const struct dis386 *
-get_valid_dis386 (const struct dis386 *dp)
+get_valid_dis386 (const struct dis386 *dp, disassemble_info *info)
{
int index;
@@ -3678,6 +3678,15 @@ get_valid_dis386 (const struct dis386 *d
dp = &x86_64_table[dp->op[1].bytemode][index];
break;
+ case IS_3BYTE_OPCODE:
+ FETCH_DATA (info, codep + 2);
+ index = *codep++;
+ dp = &three_byte_table[dp->op[1].bytemode][index];
+ modrm.mod = (*codep >> 6) & 3;
+ modrm.reg = (*codep >> 3) & 7;
+ modrm.rm = *codep & 7;
+ break;
+
case USE_OPC_EXT_TABLE:
index = modrm.mod == 0x3 ? 1 : 0;
dp = &opc_ext_table[dp->op[1].bytemode][index];
@@ -3696,7 +3705,7 @@ get_valid_dis386 (const struct dis386 *d
if (dp->name != NULL)
return dp;
else
- return get_valid_dis386 (dp);
+ return get_valid_dis386 (dp, info);
}
static int
@@ -3897,11 +3906,6 @@ print_insn (bfd_vma pc, disassemble_info
dp = &dis386_twobyte[threebyte];
need_modrm = twobyte_has_modrm[*codep];
codep++;
- if (dp->name == NULL && dp->op[0].bytemode == IS_3BYTE_OPCODE)
- {
- FETCH_DATA (info, codep + 2);
- op = *codep++;
- }
}
else
{
@@ -3964,14 +3968,7 @@ print_insn (bfd_vma pc, disassemble_info
}
}
- if (dp->name == NULL && dp->op[0].bytemode == IS_3BYTE_OPCODE)
- {
- dp = &three_byte_table[dp->op[1].bytemode][op];
- modrm.mod = (*codep >> 6) & 3;
- modrm.reg = (*codep >> 3) & 7;
- modrm.rm = *codep & 7;
- }
- else if (need_modrm)
+ if (need_modrm)
{
FETCH_DATA (info, codep + 1);
modrm.mod = (*codep >> 6) & 3;
@@ -3985,7 +3982,7 @@ print_insn (bfd_vma pc, disassemble_info
}
else
{
- dp = get_valid_dis386 (dp);
+ dp = get_valid_dis386 (dp, info);
if (dp != NULL && putop (dp->name, sizeflag) == 0)
{
for (i = 0; i < MAX_OPERANDS; ++i)