aboutsummaryrefslogtreecommitdiff
path: root/opcodes
diff options
context:
space:
mode:
authorH.J. Lu <hjl.tools@gmail.com>2009-11-12 02:13:06 +0000
committerH.J. Lu <hjl.tools@gmail.com>2009-11-12 02:13:06 +0000
commitf310f33d50d9bfb1ded3dbf04a23aeb5eed5368b (patch)
tree921a769de2c4d15f752c4008cf622cb04740b340 /opcodes
parent21e1bee4d23dc4a91ccccd69947fc109b4312230 (diff)
downloadgdb-f310f33d50d9bfb1ded3dbf04a23aeb5eed5368b.zip
gdb-f310f33d50d9bfb1ded3dbf04a23aeb5eed5368b.tar.gz
gdb-f310f33d50d9bfb1ded3dbf04a23aeb5eed5368b.tar.bz2
gas/testsuite/
2009-11-11 H.J. Lu <hongjiu.lu@intel.com> * gas/i386/prefix.d: Swap order of ADDR and REP prefixes. * gas/i386/rep.d: Likewise. * gas/i386/x86-64-rep.d: Likewise. opcodes/ 2009-11-11 H.J. Lu <hongjiu.lu@intel.com> * i386-dis.c (all_prefixes): New. (ckprefix): Set all_prefixes. (print_insn): Print all_prefixes instead of lock_prefix, repz_prefix, repnz_prefix, addr_prefix and data_prefix.
Diffstat (limited to 'opcodes')
-rw-r--r--opcodes/ChangeLog7
-rw-r--r--opcodes/i386-dis.c44
2 files changed, 40 insertions, 11 deletions
diff --git a/opcodes/ChangeLog b/opcodes/ChangeLog
index e0f48e9..90d297c 100644
--- a/opcodes/ChangeLog
+++ b/opcodes/ChangeLog
@@ -1,3 +1,10 @@
+2009-11-11 H.J. Lu <hongjiu.lu@intel.com>
+
+ * i386-dis.c (all_prefixes): New.
+ (ckprefix): Set all_prefixes.
+ (print_insn): Print all_prefixes instead of lock_prefix,
+ repz_prefix, repnz_prefix, addr_prefix and data_prefix.
+
2009-11-11 Nick Clifton <nickc@redhat.com>
PR binutils/10924
diff --git a/opcodes/i386-dis.c b/opcodes/i386-dis.c
index b411c83..a8bfa0f 100644
--- a/opcodes/i386-dis.c
+++ b/opcodes/i386-dis.c
@@ -1997,6 +1997,7 @@ static const char *data_prefix;
static const char *addr_prefix;
static const char *repz_prefix;
static const char *repnz_prefix;
+static const char **all_prefixes[5];
static disassemble_info *the_info;
static struct
{
@@ -9572,13 +9573,16 @@ static const struct dis386 rm_table[][8] = {
static void
ckprefix (void)
{
- int newrex;
+ int newrex, i;
rex = 0;
rex_original = 0;
rex_ignored = 0;
prefixes = 0;
used_prefixes = 0;
rex_used = 0;
+ for (i = 0; i < (int) ARRAY_SIZE (all_prefixes); i++)
+ all_prefixes[i] = 0;
+ i = 0;
while (1)
{
FETCH_DATA (the_info, codep + 1);
@@ -9608,12 +9612,27 @@ ckprefix (void)
return;
break;
case 0xf3:
+ if ((prefixes & PREFIX_REPZ) == 0)
+ {
+ all_prefixes[i] = &repz_prefix;
+ i++;
+ }
prefixes |= PREFIX_REPZ;
break;
case 0xf2:
+ if ((prefixes & PREFIX_REPNZ) == 0)
+ {
+ all_prefixes[i] = &repnz_prefix;
+ i++;
+ }
prefixes |= PREFIX_REPNZ;
break;
case 0xf0:
+ if ((prefixes & PREFIX_LOCK) == 0)
+ {
+ all_prefixes[i] = &lock_prefix;
+ i++;
+ }
prefixes |= PREFIX_LOCK;
break;
case 0x2e:
@@ -9635,9 +9654,19 @@ ckprefix (void)
prefixes |= PREFIX_GS;
break;
case 0x66:
+ if ((prefixes & PREFIX_DATA) == 0)
+ {
+ all_prefixes[i] = &data_prefix;
+ i++;
+ }
prefixes |= PREFIX_DATA;
break;
case 0x67:
+ if ((prefixes & PREFIX_ADDR) == 0)
+ {
+ all_prefixes[i] = &addr_prefix;
+ i++;
+ }
prefixes |= PREFIX_ADDR;
break;
case FWAIT_OPCODE:
@@ -10437,16 +10466,9 @@ print_insn (bfd_vma pc, disassemble_info *info)
prefix_obuf[0] = 0;
prefix_obufp = prefix_obuf;
- if (lock_prefix)
- prefix_obufp = stpcpy (prefix_obufp, lock_prefix);
- if (repz_prefix)
- prefix_obufp = stpcpy (prefix_obufp, repz_prefix);
- if (repnz_prefix)
- prefix_obufp = stpcpy (prefix_obufp, repnz_prefix);
- if (addr_prefix)
- prefix_obufp = stpcpy (prefix_obufp, addr_prefix);
- if (data_prefix)
- prefix_obufp = stpcpy (prefix_obufp, data_prefix);
+ for (i = 0; i < (int) ARRAY_SIZE (all_prefixes); i++)
+ if (all_prefixes[i] && *all_prefixes[i])
+ prefix_obufp = stpcpy (prefix_obufp, *all_prefixes[i]);
if (prefix_obuf[0] != 0)
(*info->fprintf_func) (info->stream, "%s", prefix_obuf);