From f310f33d50d9bfb1ded3dbf04a23aeb5eed5368b Mon Sep 17 00:00:00 2001 From: "H.J. Lu" Date: Thu, 12 Nov 2009 02:13:06 +0000 Subject: [PATCH] gas/testsuite/ 2009-11-11 H.J. Lu * 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 * 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. --- gas/testsuite/ChangeLog | 6 ++++ gas/testsuite/gas/i386/prefix.d | 2 +- gas/testsuite/gas/i386/rep.d | 42 +++++++++++------------ gas/testsuite/gas/i386/x86-64-rep.d | 52 ++++++++++++++--------------- opcodes/ChangeLog | 7 ++++ opcodes/i386-dis.c | 44 ++++++++++++++++++------ 6 files changed, 94 insertions(+), 59 deletions(-) diff --git a/gas/testsuite/ChangeLog b/gas/testsuite/ChangeLog index 931e92cb971..ea1fd5148ea 100644 --- a/gas/testsuite/ChangeLog +++ b/gas/testsuite/ChangeLog @@ -1,3 +1,9 @@ +2009-11-11 H.J. Lu + + * gas/i386/prefix.d: Swap order of ADDR and REP prefixes. + * gas/i386/rep.d: Likewise. + * gas/i386/x86-64-rep.d: Likewise. + 2009-11-06 Sebastian Pop * gas/i386/x86-64-lwp.s: Updated to also contain patterns diff --git a/gas/testsuite/gas/i386/prefix.d b/gas/testsuite/gas/i386/prefix.d index 0cb79ff844b..517906d6091 100644 --- a/gas/testsuite/gas/i386/prefix.d +++ b/gas/testsuite/gas/i386/prefix.d @@ -10,5 +10,5 @@ Disassembly of section .text: 5: 9b df e0 [ ]*fstsw %ax 8: 9b df e0 [ ]*fstsw %ax b: 9b 67 df e0 [ ]*addr16 fstsw %ax - f: 36 67 66 f3 a7 [ ]*repz addr16 cmpsw %es:\(%di\),%ss:\(%si\) + f: 36 67 66 f3 a7 [ ]*addr16 repz cmpsw %es:\(%di\),%ss:\(%si\) #pass diff --git a/gas/testsuite/gas/i386/rep.d b/gas/testsuite/gas/i386/rep.d index 27992486394..0e0e3741ad9 100644 --- a/gas/testsuite/gas/i386/rep.d +++ b/gas/testsuite/gas/i386/rep.d @@ -27,25 +27,25 @@ Disassembly of section .text: 2b: f3 ab[ ]+rep stos %eax,%es:\(%edi\) 2d: f3 a7[ ]+repz cmpsl %es:\(%edi\),%ds:\(%esi\) 2f: f3 af[ ]+repz scas %es:\(%edi\),%eax - 31: 67 f3 6c[ ]+rep addr16 insb \(%dx\),%es:\(%di\) - 34: 67 f3 6e[ ]+rep addr16 outsb %ds:\(%si\),\(%dx\) - 37: 67 f3 a4[ ]+rep addr16 movsb %ds:\(%si\),%es:\(%di\) - 3a: 67 f3 ac[ ]+rep addr16 lods %ds:\(%si\),%al - 3d: 67 f3 aa[ ]+rep addr16 stos %al,%es:\(%di\) - 40: 67 f3 a6[ ]+repz addr16 cmpsb %es:\(%di\),%ds:\(%si\) - 43: 67 f3 ae[ ]+repz addr16 scas %es:\(%di\),%al - 46: 67 66 f3 6d[ ]+rep addr16 insw \(%dx\),%es:\(%di\) - 4a: 67 66 f3 6f[ ]+rep addr16 outsw %ds:\(%si\),\(%dx\) - 4e: 67 66 f3 a5[ ]+rep addr16 movsw %ds:\(%si\),%es:\(%di\) - 52: 67 66 f3 ad[ ]+rep addr16 lods %ds:\(%si\),%ax - 56: 67 66 f3 ab[ ]+rep addr16 stos %ax,%es:\(%di\) - 5a: 67 66 f3 a7[ ]+repz addr16 cmpsw %es:\(%di\),%ds:\(%si\) - 5e: 67 66 f3 af[ ]+repz addr16 scas %es:\(%di\),%ax - 62: 67 f3 6d[ ]+rep addr16 insl \(%dx\),%es:\(%di\) - 65: 67 f3 6f[ ]+rep addr16 outsl %ds:\(%si\),\(%dx\) - 68: 67 f3 a5[ ]+rep addr16 movsl %ds:\(%si\),%es:\(%di\) - 6b: 67 f3 ad[ ]+rep addr16 lods %ds:\(%si\),%eax - 6e: 67 f3 ab[ ]+rep addr16 stos %eax,%es:\(%di\) - 71: 67 f3 a7[ ]+repz addr16 cmpsl %es:\(%di\),%ds:\(%si\) - 74: 67 f3 af[ ]+repz addr16 scas %es:\(%di\),%eax + 31: 67 f3 6c[ ]+addr16 rep insb \(%dx\),%es:\(%di\) + 34: 67 f3 6e[ ]+addr16 rep outsb %ds:\(%si\),\(%dx\) + 37: 67 f3 a4[ ]+addr16 rep movsb %ds:\(%si\),%es:\(%di\) + 3a: 67 f3 ac[ ]+addr16 rep lods %ds:\(%si\),%al + 3d: 67 f3 aa[ ]+addr16 rep stos %al,%es:\(%di\) + 40: 67 f3 a6[ ]+addr16 repz cmpsb %es:\(%di\),%ds:\(%si\) + 43: 67 f3 ae[ ]+addr16 repz scas %es:\(%di\),%al + 46: 67 66 f3 6d[ ]+addr16 rep insw \(%dx\),%es:\(%di\) + 4a: 67 66 f3 6f[ ]+addr16 rep outsw %ds:\(%si\),\(%dx\) + 4e: 67 66 f3 a5[ ]+addr16 rep movsw %ds:\(%si\),%es:\(%di\) + 52: 67 66 f3 ad[ ]+addr16 rep lods %ds:\(%si\),%ax + 56: 67 66 f3 ab[ ]+addr16 rep stos %ax,%es:\(%di\) + 5a: 67 66 f3 a7[ ]+addr16 repz cmpsw %es:\(%di\),%ds:\(%si\) + 5e: 67 66 f3 af[ ]+addr16 repz scas %es:\(%di\),%ax + 62: 67 f3 6d[ ]+addr16 rep insl \(%dx\),%es:\(%di\) + 65: 67 f3 6f[ ]+addr16 rep outsl %ds:\(%si\),\(%dx\) + 68: 67 f3 a5[ ]+addr16 rep movsl %ds:\(%si\),%es:\(%di\) + 6b: 67 f3 ad[ ]+addr16 rep lods %ds:\(%si\),%eax + 6e: 67 f3 ab[ ]+addr16 rep stos %eax,%es:\(%di\) + 71: 67 f3 a7[ ]+addr16 repz cmpsl %es:\(%di\),%ds:\(%si\) + 74: 67 f3 af[ ]+addr16 repz scas %es:\(%di\),%eax ... diff --git a/gas/testsuite/gas/i386/x86-64-rep.d b/gas/testsuite/gas/i386/x86-64-rep.d index 66fc03636c5..d3f2acfdc62 100644 --- a/gas/testsuite/gas/i386/x86-64-rep.d +++ b/gas/testsuite/gas/i386/x86-64-rep.d @@ -32,30 +32,30 @@ Disassembly of section .text: 37: f3 48 ab[ ]+rep stos %rax,%es:\(%rdi\) 3a: f3 48 a7[ ]+repz cmpsq %es:\(%rdi\),%ds:\(%rsi\) 3d: f3 48 af[ ]+repz scas %es:\(%rdi\),%rax - 40: 67 f3 6c[ ]+rep addr32 insb \(%dx\),%es:\(%edi\) - 43: 67 f3 6e[ ]+rep addr32 outsb %ds:\(%esi\),\(%dx\) - 46: 67 f3 a4[ ]+rep addr32 movsb %ds:\(%esi\),%es:\(%edi\) - 49: 67 f3 ac[ ]+rep addr32 lods %ds:\(%esi\),%al - 4c: 67 f3 aa[ ]+rep addr32 stos %al,%es:\(%edi\) - 4f: 67 f3 a6[ ]+repz addr32 cmpsb %es:\(%edi\),%ds:\(%esi\) - 52: 67 f3 ae[ ]+repz addr32 scas %es:\(%edi\),%al - 55: 67 66 f3 6d[ ]+rep addr32 insw \(%dx\),%es:\(%edi\) - 59: 67 66 f3 6f[ ]+rep addr32 outsw %ds:\(%esi\),\(%dx\) - 5d: 67 66 f3 a5[ ]+rep addr32 movsw %ds:\(%esi\),%es:\(%edi\) - 61: 67 66 f3 ad[ ]+rep addr32 lods %ds:\(%esi\),%ax - 65: 67 66 f3 ab[ ]+rep addr32 stos %ax,%es:\(%edi\) - 69: 67 66 f3 a7[ ]+repz addr32 cmpsw %es:\(%edi\),%ds:\(%esi\) - 6d: 67 66 f3 af[ ]+repz addr32 scas %es:\(%edi\),%ax - 71: 67 f3 6d[ ]+rep addr32 insl \(%dx\),%es:\(%edi\) - 74: 67 f3 6f[ ]+rep addr32 outsl %ds:\(%esi\),\(%dx\) - 77: 67 f3 a5[ ]+rep addr32 movsl %ds:\(%esi\),%es:\(%edi\) - 7a: 67 f3 ad[ ]+rep addr32 lods %ds:\(%esi\),%eax - 7d: 67 f3 ab[ ]+rep addr32 stos %eax,%es:\(%edi\) - 80: 67 f3 a7[ ]+repz addr32 cmpsl %es:\(%edi\),%ds:\(%esi\) - 83: 67 f3 af[ ]+repz addr32 scas %es:\(%edi\),%eax - 86: 67 f3 48 a5[ ]+rep addr32 movsq %ds:\(%esi\),%es:\(%edi\) - 8a: 67 f3 48 ad[ ]+rep addr32 lods %ds:\(%esi\),%rax - 8e: 67 f3 48 ab[ ]+rep addr32 stos %rax,%es:\(%edi\) - 92: 67 f3 48 a7[ ]+repz addr32 cmpsq %es:\(%edi\),%ds:\(%esi\) - 96: 67 f3 48 af[ ]+repz addr32 scas %es:\(%edi\),%rax + 40: 67 f3 6c[ ]+addr32 rep insb \(%dx\),%es:\(%edi\) + 43: 67 f3 6e[ ]+addr32 rep outsb %ds:\(%esi\),\(%dx\) + 46: 67 f3 a4[ ]+addr32 rep movsb %ds:\(%esi\),%es:\(%edi\) + 49: 67 f3 ac[ ]+addr32 rep lods %ds:\(%esi\),%al + 4c: 67 f3 aa[ ]+addr32 rep stos %al,%es:\(%edi\) + 4f: 67 f3 a6[ ]+addr32 repz cmpsb %es:\(%edi\),%ds:\(%esi\) + 52: 67 f3 ae[ ]+addr32 repz scas %es:\(%edi\),%al + 55: 67 66 f3 6d[ ]+addr32 rep insw \(%dx\),%es:\(%edi\) + 59: 67 66 f3 6f[ ]+addr32 rep outsw %ds:\(%esi\),\(%dx\) + 5d: 67 66 f3 a5[ ]+addr32 rep movsw %ds:\(%esi\),%es:\(%edi\) + 61: 67 66 f3 ad[ ]+addr32 rep lods %ds:\(%esi\),%ax + 65: 67 66 f3 ab[ ]+addr32 rep stos %ax,%es:\(%edi\) + 69: 67 66 f3 a7[ ]+addr32 repz cmpsw %es:\(%edi\),%ds:\(%esi\) + 6d: 67 66 f3 af[ ]+addr32 repz scas %es:\(%edi\),%ax + 71: 67 f3 6d[ ]+addr32 rep insl \(%dx\),%es:\(%edi\) + 74: 67 f3 6f[ ]+addr32 rep outsl %ds:\(%esi\),\(%dx\) + 77: 67 f3 a5[ ]+addr32 rep movsl %ds:\(%esi\),%es:\(%edi\) + 7a: 67 f3 ad[ ]+addr32 rep lods %ds:\(%esi\),%eax + 7d: 67 f3 ab[ ]+addr32 rep stos %eax,%es:\(%edi\) + 80: 67 f3 a7[ ]+addr32 repz cmpsl %es:\(%edi\),%ds:\(%esi\) + 83: 67 f3 af[ ]+addr32 repz scas %es:\(%edi\),%eax + 86: 67 f3 48 a5[ ]+addr32 rep movsq %ds:\(%esi\),%es:\(%edi\) + 8a: 67 f3 48 ad[ ]+addr32 rep lods %ds:\(%esi\),%rax + 8e: 67 f3 48 ab[ ]+addr32 rep stos %rax,%es:\(%edi\) + 92: 67 f3 48 a7[ ]+addr32 repz cmpsq %es:\(%edi\),%ds:\(%esi\) + 96: 67 f3 48 af[ ]+addr32 repz scas %es:\(%edi\),%rax #pass diff --git a/opcodes/ChangeLog b/opcodes/ChangeLog index e0f48e973cd..90d297c6179 100644 --- a/opcodes/ChangeLog +++ b/opcodes/ChangeLog @@ -1,3 +1,10 @@ +2009-11-11 H.J. Lu + + * 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 PR binutils/10924 diff --git a/opcodes/i386-dis.c b/opcodes/i386-dis.c index b411c830eef..a8bfa0f3433 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); -- 2.30.2