From 589958d6ff391321f081228368ec6096bfad0e09 Mon Sep 17 00:00:00 2001 From: Jan Beulich Date: Thu, 25 Jun 2020 09:27:21 +0200 Subject: x86: fix SYSRET disassembly, improve {,V}CVTSI2S{S,D} and PTWRITE SYSRET can't use the same macro as IRET, since there's no 16-bit operand size form of it. Re-use LQ for it instead. Doing so made obvious that outside of 64-bit mode {,V}CVTSI2S{S,D} and PTWRITE should have an 'l' suffix printed only in suffix-always mode. --- opcodes/ChangeLog | 6 ++++++ opcodes/i386-dis.c | 14 ++++++++------ 2 files changed, 14 insertions(+), 6 deletions(-) (limited to 'opcodes') diff --git a/opcodes/ChangeLog b/opcodes/ChangeLog index ba0febe..a973b26 100644 --- a/opcodes/ChangeLog +++ b/opcodes/ChangeLog @@ -1,3 +1,9 @@ +2020-06-25 Jan Beulich + + * i386-dis.c: Adjust description of "LQ" macro. + (dis386_twobyte): Use LQ for sysret. + (putop): Adjust handling of LQ. + 2020-06-22 Nelson Chu * riscv-opc.c: Move the structures and functions to bfd/elfxx-riscv.c. diff --git a/opcodes/i386-dis.c b/opcodes/i386-dis.c index 441866d..28a9058 100644 --- a/opcodes/i386-dis.c +++ b/opcodes/i386-dis.c @@ -2290,8 +2290,9 @@ struct dis386 { "XZ" => print 'x', 'y', or 'z' if suffix_always is true or no register operands and no broadcast. "XW" => print 's', 'd' depending on the VEX.W bit (for FMA) - "LQ" => print 'l' ('d' in Intel mode) or 'q' for memory operand - or suffix_always is true + "LQ" => print 'l' ('d' in Intel mode) or 'q' for memory + operand or no operand at all in 64bit mode, or if suffix_always + is true. "LB" => print "abs" in 64bit mode and behave as 'B' otherwise "LS" => print "abs" in 64bit mode and behave as 'S' otherwise "LV" => print "abs" for 64bit operand and behave as 'S' otherwise @@ -2606,7 +2607,7 @@ static const struct dis386 dis386_twobyte[] = { { Bad_Opcode }, { "syscall", { XX }, 0 }, { "clts", { XX }, 0 }, - { "sysret%LP", { XX }, 0 }, + { "sysret%LQ", { XX }, 0 }, /* 08 */ { "invd", { XX }, 0 }, { PREFIX_TABLE (PREFIX_0F09) }, @@ -13066,7 +13067,7 @@ putop (const char *in_template, int sizeflag) SAVE_LAST (*p); break; } - if (intel_syntax + if ((intel_syntax && need_modrm) || (modrm.mod == 3 && !(sizeflag & SUFFIX_ALWAYS))) break; if ((rex & REX_W)) @@ -13074,8 +13075,9 @@ putop (const char *in_template, int sizeflag) USED_REX (REX_W); *obufp++ = 'q'; } - else - *obufp++ = 'l'; + else if((address_mode == mode_64bit && need_modrm) + || (sizeflag & SUFFIX_ALWAYS)) + *obufp++ = intel_syntax? 'd' : 'l'; } break; case 'R': -- cgit v1.1