From: Jan Beulich Date: Fri, 1 Dec 2006 15:17:32 +0000 (+0000) Subject: opcodes/ X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=ed7841b3f015cb072844e81fb5623f2aed3d90b5;p=binutils-gdb.git opcodes/ 2006-11-30 Jan Beulich * i386-dis.c (SEG_Fixup): Delete. (Sv): Use OP_SEG. (putop): New suffix character 'D'. (dis386): Use it. (grps): Likewise. (OP_SEG): Handle bytemode other than w_mode. gas/testsuite/ 2006-11-30 Jan Beulich * gas/i386/intel.d: Adjust. * gas/i386/naked.d: Adjust. * gas/i386/opcode.d: Adjust. --- diff --git a/gas/testsuite/ChangeLog b/gas/testsuite/ChangeLog index 33821537f94..580dcd90ea7 100644 --- a/gas/testsuite/ChangeLog +++ b/gas/testsuite/ChangeLog @@ -1,3 +1,9 @@ +2006-11-30 Jan Beulich + + * gas/i386/intel.d: Adjust. + * gas/i386/naked.d: Adjust. + * gas/i386/opcode.d: Adjust. + 2006-11-30 Jan Beulich * gas/i386/x86-64-io.[sd]: New. diff --git a/gas/testsuite/gas/i386/intel.d b/gas/testsuite/gas/i386/intel.d index 02b1a0a197f..184cdbca4fb 100644 --- a/gas/testsuite/gas/i386/intel.d +++ b/gas/testsuite/gas/i386/intel.d @@ -138,9 +138,9 @@ Disassembly of section .text: 1a3: 89 90 90 90 90 90 [ ]*mov %edx,0x90909090\(%eax\) 1a9: 8a 90 90 90 90 90 [ ]*mov 0x90909090\(%eax\),%dl 1af: 8b 90 90 90 90 90 [ ]*mov 0x90909090\(%eax\),%edx - 1b5: 8c 90 90 90 90 90 [ ]*movw %ss,0x90909090\(%eax\) + 1b5: 8c 90 90 90 90 90 [ ]*mov %ss,0x90909090\(%eax\) 1bb: 8d 90 90 90 90 90 [ ]*lea 0x90909090\(%eax\),%edx - 1c1: 8e 90 90 90 90 90 [ ]*movw 0x90909090\(%eax\),%ss + 1c1: 8e 90 90 90 90 90 [ ]*mov 0x90909090\(%eax\),%ss 1c7: 8f 80 90 90 90 90 [ ]*popl 0x90909090\(%eax\) 1cd: 90 [ ]*nop 1ce: 91 [ ]*xchg %eax,%ecx diff --git a/gas/testsuite/gas/i386/naked.d b/gas/testsuite/gas/i386/naked.d index 66214d58add..29f72b54c6f 100644 --- a/gas/testsuite/gas/i386/naked.d +++ b/gas/testsuite/gas/i386/naked.d @@ -11,8 +11,8 @@ Disassembly of section .text: a: b2 20 [ ]*mov \$0x20,%dl c: bb 00 00 00 00 [ ]*mov \$0x0,%ebx d: (R_386_)?(dir)?32 .text 11: d9 c9 [ ]*fxch %st\(1\) - 13: 36 8c a4 81 d2 04 00 00 [ ]*movw %fs,%ss:0x4d2\(%ecx,%eax,4\) - 1b: 8c 2c ed 00 00 00 00 [ ]*movw %gs,0x0\(,%ebp,8\) + 13: 36 8c a4 81 d2 04 00 00 [ ]*mov %fs,%ss:0x4d2\(%ecx,%eax,4\) + 1b: 8c 2c ed 00 00 00 00 [ ]*mov %gs,0x0\(,%ebp,8\) 22: 26 88 25 00 00 00 00 [ ]*mov %ah,%es:0x0 29: 2e 8b 74 14 80 [ ]*mov %cs:0xffffff80\(%esp,%edx,1\),%esi 2e: f3 65 a5 [ ]*rep movsl %gs:\(%esi\),%es:\(%edi\) diff --git a/gas/testsuite/gas/i386/opcode.d b/gas/testsuite/gas/i386/opcode.d index 9bcba095502..99d99706128 100644 --- a/gas/testsuite/gas/i386/opcode.d +++ b/gas/testsuite/gas/i386/opcode.d @@ -137,9 +137,9 @@ Disassembly of section .text: 1a3: 89 90 90 90 90 90 [ ]*mov %edx,0x90909090\(%eax\) 1a9: 8a 90 90 90 90 90 [ ]*mov 0x90909090\(%eax\),%dl 1af: 8b 90 90 90 90 90 [ ]*mov 0x90909090\(%eax\),%edx - 1b5: 8c 90 90 90 90 90 [ ]*movw %ss,0x90909090\(%eax\) + 1b5: 8c 90 90 90 90 90 [ ]*mov %ss,0x90909090\(%eax\) 1bb: 8d 90 90 90 90 90 [ ]*lea 0x90909090\(%eax\),%edx - 1c1: 8e 90 90 90 90 90 [ ]*movw 0x90909090\(%eax\),%ss + 1c1: 8e 90 90 90 90 90 [ ]*mov 0x90909090\(%eax\),%ss 1c7: 8f 80 90 90 90 90 [ ]*popl 0x90909090\(%eax\) 1cd: 90 [ ]*nop 1ce: 91 [ ]*xchg %eax,%ecx diff --git a/opcodes/ChangeLog b/opcodes/ChangeLog index ffd2326e27b..ad63d72d862 100644 --- a/opcodes/ChangeLog +++ b/opcodes/ChangeLog @@ -1,3 +1,12 @@ +2006-11-30 Jan Beulich + + * i386-dis.c (SEG_Fixup): Delete. + (Sv): Use OP_SEG. + (putop): New suffix character 'D'. + (dis386): Use it. + (grps): Likewise. + (OP_SEG): Handle bytemode other than w_mode. + 2006-11-30 Jan Beulich * i386-dis.c (zAX): New. diff --git a/opcodes/i386-dis.c b/opcodes/i386-dis.c index 7e5c3057046..de5afbfb274 100644 --- a/opcodes/i386-dis.c +++ b/opcodes/i386-dis.c @@ -102,7 +102,6 @@ static void PNI_Fixup (int, int); static void SVME_Fixup (int, int); static void INVLPG_Fixup (int, int); static void BadOp (void); -static void SEG_Fixup (int, int); static void VMX_Fixup (int, int); static void REP_Fixup (int, int); @@ -241,7 +240,6 @@ fetch_data (struct disassemble_info *info, bfd_byte *addr) #define Cm OP_C, m_mode #define Dm OP_D, m_mode #define Td OP_T, d_mode -#define Sv SEG_Fixup, v_mode #define RMeAX OP_REG, eAX_reg #define RMeBX OP_REG, eBX_reg @@ -293,6 +291,7 @@ fetch_data (struct disassemble_info *info, bfd_byte *addr) #define indirDX OP_IMREG, indir_dx_reg #define Sw OP_SEG, w_mode +#define Sv OP_SEG, v_mode #define Ap OP_DIR, 0 #define Ob OP_OFF64, b_mode #define Ov OP_OFF64, v_mode @@ -503,6 +502,8 @@ struct dis386 { 'B' => print 'b' if suffix_always is true 'C' => print 's' or 'l' ('w' or 'd' in Intel mode) depending on operand . size prefix + 'D' => print 'w' if no register operands or 'w', 'l' or 'q', if + . suffix_always is true 'E' => print 'e' if 32-bit form of jcxz 'F' => print 'w' or 'l' depending on address size prefix (loop insns) 'G' => print 'w' or 'l' depending on operand size prefix (i/o insns) @@ -695,9 +696,9 @@ static const struct dis386 dis386[] = { { "movS", Ev, Gv, XX, XX }, { "movB", Gb, Eb, XX, XX }, { "movS", Gv, Ev, XX, XX }, - { "movQ", Sv, Sw, XX, XX }, + { "movD", Sv, Sw, XX, XX }, { "leaS", Gv, M, XX, XX }, - { "movQ", Sw, Sv, XX, XX }, + { "movD", Sw, Sv, XX, XX }, { "popU", stackEv, XX, XX, XX }, /* 90 */ { "xchgS", NOP_Fixup1, eAX_reg, NOP_Fixup2, eAX_reg, XX, XX }, @@ -1600,8 +1601,8 @@ static const struct dis386 grps[][8] = { }, /* GRP6 */ { - { "sldt", Ev, XX, XX, XX }, - { "str", Ev, XX, XX, XX }, + { "sldtD", Sv, XX, XX, XX }, + { "strD", Sv, XX, XX, XX }, { "lldt", Ew, XX, XX, XX }, { "ltr", Ew, XX, XX, XX }, { "verr", Ew, XX, XX, XX }, @@ -1615,7 +1616,7 @@ static const struct dis386 grps[][8] = { { "sidt{Q|IQ||}", PNI_Fixup, 0, XX, XX, XX }, { "lgdt{Q|Q||}", M, XX, XX, XX }, { "lidt{Q|Q||}", SVME_Fixup, 0, XX, XX, XX }, - { "smsw", Ev, XX, XX, XX }, + { "smswD", Sv, XX, XX, XX }, { "(bad)", XX, XX, XX, XX }, { "lmsw", Ew, XX, XX, XX }, { "invlpg", INVLPG_Fixup, w_mode, XX, XX, XX }, @@ -3748,6 +3749,23 @@ putop (const char *template, int sizeflag) used_prefixes |= (prefixes & PREFIX_DATA); } break; + case 'D': + if (intel_syntax || !(sizeflag & SUFFIX_ALWAYS)) + break; + USED_REX (REX_MODE64); + if (mod == 3) + { + if (rex & REX_MODE64) + *obufp++ = 'q'; + else if (sizeflag & DFLAG) + *obufp++ = intel_syntax ? 'd' : 'l'; + else + *obufp++ = 'w'; + used_prefixes |= (prefixes & PREFIX_DATA); + } + else + *obufp++ = 'w'; + break; case 'E': /* For jcxz/jecxz */ if (address_mode == mode_64bit) { @@ -4865,9 +4883,12 @@ OP_J (int bytemode, int sizeflag) } static void -OP_SEG (int dummy ATTRIBUTE_UNUSED, int sizeflag ATTRIBUTE_UNUSED) +OP_SEG (int bytemode, int sizeflag) { - oappend (names_seg[reg]); + if (bytemode == w_mode) + oappend (names_seg[reg]); + else + OP_E (mod == 3 ? bytemode : w_mode, sizeflag); } static void @@ -5610,55 +5631,6 @@ BadOp (void) oappend ("(bad)"); } -static void -SEG_Fixup (int extrachar, int sizeflag) -{ - if (mod == 3) - { - /* We need to add a proper suffix with - - movw %ds,%ax - movl %ds,%eax - movq %ds,%rax - movw %ax,%ds - movl %eax,%ds - movq %rax,%ds - */ - const char *suffix; - - if (prefixes & PREFIX_DATA) - suffix = "w"; - else - { - USED_REX (REX_MODE64); - if (rex & REX_MODE64) - suffix = "q"; - else - suffix = "l"; - } - strcat (obuf, suffix); - } - else - { - /* We need to fix the suffix for - - movw %ds,(%eax) - movw %ds,(%rax) - movw (%eax),%ds - movw (%rax),%ds - - Override "mov[l|q]". */ - char *p = obuf + strlen (obuf) - 1; - - /* We might not have a suffix. */ - if (*p == 'v') - ++p; - *p = 'w'; - } - - OP_E (extrachar, sizeflag); -} - static void VMX_Fixup (int extrachar ATTRIBUTE_UNUSED, int sizeflag) {