This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
PATCH: Correct x86 disassembler for sldt, smsw and str
- From: "H. J. Lu" <hjl at lucon dot org>
- To: binutils at sources dot redhat dot com
- Date: Tue, 18 Jul 2006 12:46:37 -0700
- Subject: PATCH: Correct x86 disassembler for sldt, smsw and str
We currently diassemble
0f 00 08 strl (%eax)
But it is invalid
[hjl@gnu-13 invmem]$ echo "strl (%eax)" | as -o x.o -
{standard input}: Assembler messages:
{standard input}:1: Error: suffix or operands invalid for `str'
This patch removes suffix from those instructions. For memory operand,
it is always 16bit. For register operand, the size is determined by
the register size.
H.J.
---
gas/testsuite/
2006-07-18 H.J. Lu <hongjiu.lu@intel.com>
* gas/i386/opcode.s: Add sldt, smsw and str.
* gas/i386/x86-64-opcode.s: Likewise.
* gas/i386/opcode.d: Updated.
* gas/i386/x86-64-opcode.d: Likewise.
opcodes/
2006-07-18 H.J. Lu <hongjiu.lu@intel.com>
* i386-dis.c (grps): Change "sldtQ", "strQ" and "smswQ" to
"sldt", "str" and "smsw".
--- binutils/gas/testsuite/gas/i386/opcode.d.modrm 2006-06-12 12:50:18.000000000 -0700
+++ binutils/gas/testsuite/gas/i386/opcode.d 2006-07-18 12:45:27.000000000 -0700
@@ -573,4 +573,13 @@ Disassembly of section .text:
9bf: 66 0f be 90 90 90 90 90 [ ]*movsbw 0x90909090\(%eax\),%dx
9c7: 66 0f c1 90 90 90 90 90 [ ]*xadd %dx,0x90909090\(%eax\)
9cf: 66 90 [ ]*xchg %ax,%ax
+ 9d1: 0f 00 c0 [ ]*sldt %eax
+ 9d4: 66 0f 00 c0 [ ]*sldt %ax
+ 9d8: 0f 00 00 [ ]*sldt \(%eax\)
+ 9db: 0f 01 e0 [ ]*smsw %eax
+ 9de: 66 0f 01 e0 [ ]*smsw %ax
+ 9e2: 0f 01 20 [ ]*smsw \(%eax\)
+ 9e5: 0f 00 c8 [ ]*str %eax
+ 9e8: 66 0f 00 c8 [ ]*str %ax
+ 9ec: 0f 00 08 [ ]*str \(%eax\)
\.\.\.
--- binutils/gas/testsuite/gas/i386/opcode.s.modrm 2006-06-12 12:50:18.000000000 -0700
+++ binutils/gas/testsuite/gas/i386/opcode.s 2006-07-18 12:43:37.000000000 -0700
@@ -568,5 +568,15 @@ foo:
xchg %ax,%ax
+ sldt %eax
+ sldt %ax
+ sldt (%eax)
+ smsw %eax
+ smsw %ax
+ smsw (%eax)
+ str %eax
+ str %ax
+ str (%eax)
+
# Force a good alignment.
.p2align 4,0
--- binutils/gas/testsuite/gas/i386/x86-64-opcode.d.modrm 2006-06-12 12:50:18.000000000 -0700
+++ binutils/gas/testsuite/gas/i386/x86-64-opcode.d 2006-07-18 12:38:32.000000000 -0700
@@ -263,6 +263,9 @@ Disassembly of section .text:
[ ]*[0-9a-f]+:[ ]+41 0f 01 38[ ]+invlpg[ ]+\(%r8\)[ ]*(#.*)*
[ ]*[0-9a-f]+:[ ]+0f 01 38[ ]+invlpg[ ]+\(%rax\)[ ]*(#.*)*
[ ]*[0-9a-f]+:[ ]+0f 00 c0[ ]+sldt[ ]+%eax[ ]*(#.*)*
+[ ]*[0-9a-f]+:[ ]+48 0f 00 c0[ ]+sldt[ ]+%rax[ ]*(#.*)*
+[ ]*[0-9a-f]+:[ ]+66 0f 00 c0[ ]+sldt[ ]+%ax[ ]*(#.*)*
+[ ]*[0-9a-f]+:[ ]+0f 00 00[ ]+sldt[ ]+\(%rax\)[ ]*(#.*)*
[ ]*[0-9a-f]+:[ ]+e6 00[ ]+out[ ]+%al,\$0[x0]*[ ]*(#.*)*
[ ]*[0-9a-f]+:[ ]+66 e7 00[ ]+out[ ]+%ax,\$0[x0]*[ ]*(#.*)*
[ ]*[0-9a-f]+:[ ]+e7 00[ ]+out[ ]+%eax,\$0[x0]*[ ]*(#.*)*
@@ -271,4 +274,12 @@ Disassembly of section .text:
[ ]*[0-9a-f]+:[ ]+90[ ]+nop[ ]*(#.*)*
[ ]*[0-9a-f]+:[ ]+48 90[ ]+rex64 nop[ ]*(#.*)*
[ ]*[0-9a-f]+:[ ]+49 90[ ]+xchg[ ]+%rax,%r8[ ]*(#.*)*
+[ ]*[0-9a-f]+:[ ]+48 0f 01 e0[ ]+smsw[ ]+%rax[ ]*(#.*)*
+[ ]*[0-9a-f]+:[ ]+0f 01 e0[ ]+smsw[ ]+%eax[ ]*(#.*)*
+[ ]*[0-9a-f]+:[ ]+66 0f 01 e0[ ]+smsw[ ]+%ax[ ]*(#.*)*
+[ ]*[0-9a-f]+:[ ]+0f 01 20[ ]+smsw[ ]+\(%rax\)[ ]*(#.*)*
+[ ]*[0-9a-f]+:[ ]+48 0f 00 c8[ ]+str[ ]+%rax[ ]*(#.*)*
+[ ]*[0-9a-f]+:[ ]+0f 00 c8[ ]+str[ ]+%eax[ ]*(#.*)*
+[ ]*[0-9a-f]+:[ ]+66 0f 00 c8[ ]+str[ ]+%ax[ ]*(#.*)*
+[ ]*[0-9a-f]+:[ ]+0f 00 08[ ]+str[ ]+\(%rax\)[ ]*(#.*)*
#pass
--- binutils/gas/testsuite/gas/i386/x86-64-opcode.s.modrm 2006-06-12 12:50:18.000000000 -0700
+++ binutils/gas/testsuite/gas/i386/x86-64-opcode.s 2006-07-18 12:41:49.000000000 -0700
@@ -373,6 +373,9 @@
# SLDT
# SLDT (%eax) # -- 67 -- -- 0F 00 00 ; A32 override: (Addr64) = ZEXT(Addr32 )
SLDT %eax # -- -- -- -- 0F 00 C0
+ SLDT %rax # -- -- -- 48 0F 00 C0
+ SLDT %ax # 66 -- -- -- 0F 00 C0
+ SLDT (%rax) # -- -- -- -- 0F 00 00
# SWAPGS
@@ -392,7 +395,17 @@
xchg %ax,%ax # 66 -- -- -- 90
xchg %eax,%eax # -- -- -- -- 87 C0
xchg %rax,%rax # -- -- -- -- 90
- rex64 xchg %rax,%rax # 48 -- -- -- 90
+ rex64 xchg %rax,%rax # -- -- -- 48 90
xchg %rax,%r8 # -- -- -- 49 90
+ smsw %rax # -- -- -- 48 0F 01 e0
+ smsw %eax # -- -- -- -- 0F 01 e0
+ smsw %ax # 66 -- -- -- 0F 01 e0
+ smsw (%rax) # -- -- -- -- 0F 01 20
+
+ str %rax # -- -- -- 48 0F 00 c8
+ str %eax # -- -- -- -- 0F 00 c8
+ str %ax # 66 -- -- -- 0F 00 c8
+ str (%rax) # -- -- -- -- 0F 00 08
+
.p2align 4,0
--- binutils/opcodes/i386-dis.c.modrm 2006-07-15 10:33:32.000000000 -0700
+++ binutils/opcodes/i386-dis.c 2006-07-18 12:33:26.000000000 -0700
@@ -1398,8 +1398,8 @@ static const struct dis386 grps[][8] = {
},
/* GRP6 */
{
- { "sldtQ", Ev, XX, XX, XX },
- { "strQ", Ev, XX, XX, XX },
+ { "sldt", Ev, XX, XX, XX },
+ { "str", Ev, XX, XX, XX },
{ "lldt", Ew, XX, XX, XX },
{ "ltr", Ew, XX, XX, XX },
{ "verr", Ew, XX, XX, XX },
@@ -1413,7 +1413,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 },
- { "smswQ", Ev, XX, XX, XX },
+ { "smsw", Ev, XX, XX, XX },
{ "(bad)", XX, XX, XX, XX },
{ "lmsw", Ew, XX, XX, XX },
{ "invlpg", INVLPG_Fixup, w_mode, XX, XX, XX },