This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
PATCH: Update x86-64 disassembler for sidt/sgdt
- From: "H. J. Lu" <hjl at lucon dot org>
- To: "Allan B. Cruse" <cruse at cs dot usfca dot edu>
- Cc: binutils at sources dot redhat dot com
- Date: Mon, 8 May 2006 14:17:30 -0700
- Subject: PATCH: Update x86-64 disassembler for sidt/sgdt
- References: <20060508022253.C695528C8CE@nexus.cs.usfca.edu>
On Sun, May 07, 2006 at 07:22:53PM -0700, Allan B. Cruse wrote:
>
>
>
> TO: hjl@lucon.org
>
>
> I noticed an apparent 'bug' in 'as' and 'objdump' for the x86_64 environment
> with regard to the 'sidt' (and likewise 'sgdt') instructions;
>
>
> .data
> idtr: .quad 0
>
> .text
> sidt idtr # This assembles ok; it disassembled as 'sidtl'
> sidtw idtr # This won't assemble; it generates an error-message
> sidtl idtr # This won't assemble; it generates an error-message
> sidtq idtr # This assembles ok; but it disassembled as 'sidtl'
>
> .byte 0x66 # operand-size prefix
> sidt idtr # Now this disassembles as 'sidtw'
>
> .end
>
I don't see why sgdt/sidt should be treate differently from lgdt/lidt.
I will check in this patch if I don't hear any objections in a day or
two.
H.J.
---
gas/testsuite/
2006-05-08 H.J. Lu <hongjiu.lu@intel.com>
* gas/i386/i386.exp: Run x86-64-gidt.
* gas/i386/x86-64-gidt.d: New file.
* gas/i386/x86-64-gidt.s: Likewise.
opcodes/
2006-05-08 H.J. Lu <hongjiu.lu@intel.com>
* i386-dis.c (grps): Update sgdt/sidt for 64bit.
--- binutils/gas/testsuite/gas/i386/i386.exp.gidt 2006-05-01 11:04:15.000000000 -0700
+++ binutils/gas/testsuite/gas/i386/i386.exp 2006-05-08 13:03:19.000000000 -0700
@@ -143,6 +143,7 @@ if [expr ([istarget "i*86-*-*"] || [ista
run_dump_test "x86-64-merom"
run_dump_test "x86-64-rep"
run_dump_test "x86-64-rep-suffix"
+ run_dump_test "x86-64-gidt"
if { ![istarget "*-*-aix*"]
&& ![istarget "*-*-beos*"]
--- binutils/gas/testsuite/gas/i386/x86-64-gidt.d.gidt 2006-05-08 13:02:49.000000000 -0700
+++ binutils/gas/testsuite/gas/i386/x86-64-gidt.d 2006-05-08 13:55:29.000000000 -0700
@@ -0,0 +1,17 @@
+#objdump: -dw
+#name: 64bit load/store global/interrupt description table register.
+
+.*: +file format .*
+
+Disassembly of section .text:
+
+0+000 <foo>:
+ 0: 0f 01 08 [ ]*sidt \(%rax\)
+ 3: 0f 01 18 [ ]*sgdt \(%rax\)
+ 6: 0f 01 00 [ ]*lidt \(%rax\)
+ 9: 0f 01 10 [ ]*lgdt \(%rax\)
+ c: 0f 01 08 [ ]*sidt \(%rax\)
+ f: 0f 01 18 [ ]*sgdt \(%rax\)
+ 12: 0f 01 00 [ ]*lidt \(%rax\)
+ 15: 0f 01 10 [ ]*lgdt \(%rax\)
+ ...
--- binutils/gas/testsuite/gas/i386/x86-64-gidt.s.gidt 2006-05-08 13:02:52.000000000 -0700
+++ binutils/gas/testsuite/gas/i386/x86-64-gidt.s 2006-05-08 13:01:12.000000000 -0700
@@ -0,0 +1,14 @@
+# Instructions to load/store global/interrupt description table
+# register.
+
+ .text
+foo:
+ sidt (%rax)
+ lidt (%rax)
+ sgdt (%rax)
+ lgdt (%rax)
+ sidtq (%rax)
+ lidtq (%rax)
+ sgdtq (%rax)
+ lgdtq (%rax)
+ .p2align 4,0
--- binutils/opcodes/i386-dis.c.gidt 2006-03-07 15:40:19.000000000 -0800
+++ binutils/opcodes/i386-dis.c 2006-05-08 12:37:23.000000000 -0700
@@ -1400,8 +1400,8 @@ static const struct dis386 grps[][8] = {
},
/* GRP7 */
{
- { "sgdtIQ", VMX_Fixup, 0, XX, XX },
- { "sidtIQ", PNI_Fixup, 0, XX, XX },
+ { "sgdt{Q|IQ||}", VMX_Fixup, 0, XX, XX },
+ { "sidt{Q|IQ||}", PNI_Fixup, 0, XX, XX },
{ "lgdt{Q|Q||}", M, XX, XX },
{ "lidt{Q|Q||}", SVME_Fixup, 0, XX, XX },
{ "smswQ", Ev, XX, XX },