aboutsummaryrefslogtreecommitdiff
path: root/opcodes/i386-dis.c
diff options
context:
space:
mode:
authorH.J. Lu <hjl.tools@gmail.com>2007-09-14 00:20:03 +0000
committerH.J. Lu <hjl.tools@gmail.com>2007-09-14 00:20:03 +0000
commit8bb15339419de4a3ceb5db9d3dd53a06406d3fe1 (patch)
treeb7370d3f85fefb7e96c472b441b20676bbe2cc8b /opcodes/i386-dis.c
parent8e8b1f6967225dd21fdc103487c1b62b41e875cf (diff)
downloadgdb-8bb15339419de4a3ceb5db9d3dd53a06406d3fe1.zip
gdb-8bb15339419de4a3ceb5db9d3dd53a06406d3fe1.tar.gz
gdb-8bb15339419de4a3ceb5db9d3dd53a06406d3fe1.tar.bz2
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 here.
Diffstat (limited to 'opcodes/i386-dis.c')
-rw-r--r--opcodes/i386-dis.c29
1 files changed, 13 insertions, 16 deletions
diff --git a/opcodes/i386-dis.c b/opcodes/i386-dis.c
index 2af341f..0c7f77a 100644
--- a/opcodes/i386-dis.c
+++ b/opcodes/i386-dis.c
@@ -3629,7 +3629,7 @@ with the -M switch (multiple options should be separated by commas):\n"));
/* 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 *dp)
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 *dp)
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 *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 *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 *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)