This is the mail archive of the binutils@sourceware.org mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

PATCH: Fix disassembling x86-64 debug register


On Sat, Feb 11, 2006 at 08:54:30AM -0800, H. J. Lu wrote:
> Control registers in 64bit mode are always 64bit. We disassemble
> control register move as "movl" today. I am checking this patch to
> turn it to "movq".
> 
> We have the same problem with debug register. But the assembler
> rejects "%dr14", which is reserved, like "%cr14.". I will fix it
> in a separate patch.
> 

%dr14" is only supported in 64bit. Here is the patch to fix debug
register moves.


H.J.
----
gas/testsuite/

2006-02-11  H.J. Lu  <hongjiu.lu@intel.com>

	* gas/i386/i386.exp: Add "x86-64-drx" and "x86-64-drx-suffix".

	* gas/i386/x86-64-crx-suffix.d: Minor update.

	* gas/i386/x86-64-drx-suffix.d: New file.
	* i386/x86-64-drx.d: Likewise.
	* x86-64-drx.s: Likewise.

opcodes/

2006-02-11  H.J. Lu  <hongjiu.lu@intel.com>

	* i386-dis.c (dis386_twobyte): Use "movZ" for debug register
	moves.

--- binutils/gas/testsuite/gas/i386/i386.exp.drx	2006-02-11 09:01:12.000000000 -0800
+++ binutils/gas/testsuite/gas/i386/i386.exp	2006-02-11 09:15:39.000000000 -0800
@@ -134,6 +134,8 @@ if [expr ([istarget "i*86-*-*"] || [ista
     run_dump_test "x86-64-prescott"
     run_dump_test "x86-64-crx"
     run_dump_test "x86-64-crx-suffix"
+    run_dump_test "x86-64-drx"
+    run_dump_test "x86-64-drx-suffix"
 
     if { ![istarget "*-*-aix*"]
       && ![istarget "*-*-beos*"]
--- binutils/gas/testsuite/gas/i386/x86-64-crx-suffix.d.drx	2006-02-11 09:00:58.000000000 -0800
+++ binutils/gas/testsuite/gas/i386/x86-64-crx-suffix.d	2006-02-11 09:24:48.000000000 -0800
@@ -1,6 +1,5 @@
 #objdump: -dwMsuffix
 #name: x86-64 control register related opcodes (with suffixes)
-#source: x86-64-crx.s
 
 .*: +file format elf64-x86-64
 
--- binutils/gas/testsuite/gas/i386/x86-64-drx-suffix.d.drx	2006-02-11 09:26:03.000000000 -0800
+++ binutils/gas/testsuite/gas/i386/x86-64-drx-suffix.d	2006-02-11 09:20:53.000000000 -0800
@@ -0,0 +1,21 @@
+#objdump: -dwMsuffix
+#name: x86-64 debug register related opcodes (with suffixes)
+#source: x86-64-drx.s
+
+.*: +file format elf64-x86-64
+
+Disassembly of section .text:
+
+0+ <_start>:
+[ 	]*[0-9a-f]+:	44 0f 21 c0[ 	]+movq[ 	]+?%db8,%rax
+[ 	]*[0-9a-f]+:	44 0f 21 c7[ 	]+movq[ 	]+?%db8,%rdi
+[ 	]*[0-9a-f]+:	44 0f 23 c0[ 	]+movq[ 	]+?%rax,%db8
+[ 	]*[0-9a-f]+:	44 0f 23 c7[ 	]+movq[ 	]+?%rdi,%db8
+[ 	]*[0-9a-f]+:	44 0f 21 c0[ 	]+movq[ 	]+?%db8,%rax
+[ 	]*[0-9a-f]+:	44 0f 21 c7[ 	]+movq[ 	]+?%db8,%rdi
+[ 	]*[0-9a-f]+:	44 0f 23 c0[ 	]+movq[ 	]+?%rax,%db8
+[ 	]*[0-9a-f]+:	44 0f 23 c7[ 	]+movq[ 	]+?%rdi,%db8
+[ 	]*[0-9a-f]+:	44 0f 21 c0[ 	]+movq[ 	]+?%db8,%rax
+[ 	]*[0-9a-f]+:	44 0f 21 c7[ 	]+movq[ 	]+?%db8,%rdi
+[ 	]*[0-9a-f]+:	44 0f 23 c0[ 	]+movq[ 	]+?%rax,%db8
+[ 	]*[0-9a-f]+:	44 0f 23 c7[ 	]+movq[ 	]+?%rdi,%db8
--- binutils/gas/testsuite/gas/i386/x86-64-drx.d.drx	2006-02-11 09:15:15.000000000 -0800
+++ binutils/gas/testsuite/gas/i386/x86-64-drx.d	2006-02-11 09:20:44.000000000 -0800
@@ -0,0 +1,20 @@
+#objdump: -dw
+#name: x86-64 debug register related opcodes
+
+.*: +file format elf64-x86-64
+
+Disassembly of section .text:
+
+0+ <_start>:
+[ 	]*[0-9a-f]+:	44 0f 21 c0[ 	]+movq?[ 	]+?%db8,%rax
+[ 	]*[0-9a-f]+:	44 0f 21 c7[ 	]+movq?[ 	]+?%db8,%rdi
+[ 	]*[0-9a-f]+:	44 0f 23 c0[ 	]+movq?[ 	]+?%rax,%db8
+[ 	]*[0-9a-f]+:	44 0f 23 c7[ 	]+movq?[ 	]+?%rdi,%db8
+[ 	]*[0-9a-f]+:	44 0f 21 c0[ 	]+movq?[ 	]+?%db8,%rax
+[ 	]*[0-9a-f]+:	44 0f 21 c7[ 	]+movq?[ 	]+?%db8,%rdi
+[ 	]*[0-9a-f]+:	44 0f 23 c0[ 	]+movq?[ 	]+?%rax,%db8
+[ 	]*[0-9a-f]+:	44 0f 23 c7[ 	]+movq?[ 	]+?%rdi,%db8
+[ 	]*[0-9a-f]+:	44 0f 21 c0[ 	]+movq?[ 	]+?%db8,%rax
+[ 	]*[0-9a-f]+:	44 0f 21 c7[ 	]+movq?[ 	]+?%db8,%rdi
+[ 	]*[0-9a-f]+:	44 0f 23 c0[ 	]+movq?[ 	]+?%rax,%db8
+[ 	]*[0-9a-f]+:	44 0f 23 c7[ 	]+movq?[ 	]+?%rdi,%db8
--- binutils/gas/testsuite/gas/i386/x86-64-drx.s.drx	2006-02-11 09:15:19.000000000 -0800
+++ binutils/gas/testsuite/gas/i386/x86-64-drx.s	2006-02-11 09:16:09.000000000 -0800
@@ -0,0 +1,18 @@
+.text
+_start:
+	movq	%dr8, %rax
+	movq	%dr8, %rdi
+	movq	%rax, %dr8
+	movq	%rdi, %dr8
+
+.att_syntax noprefix
+	movq	dr8, rax
+	movq	dr8, rdi
+	movq	rax, dr8
+	movq	rdi, dr8
+
+.intel_syntax noprefix
+	mov	rax, dr8
+	mov	rdi, dr8
+	mov	dr8, rax
+	mov	dr8, rdi
--- binutils/opcodes/i386-dis.c.drx	2006-02-11 09:01:12.000000000 -0800
+++ binutils/opcodes/i386-dis.c	2006-02-11 09:03:38.000000000 -0800
@@ -832,9 +832,9 @@ static const struct dis386 dis386_twobyt
   { "(bad)",		XX, XX, XX },
   /* 20 */
   { "movZ",		Rm, Cm, XX },
-  { "movL",		Rm, Dm, XX },
+  { "movZ",		Rm, Dm, XX },
   { "movZ",		Cm, Rm, XX },
-  { "movL",		Dm, Rm, XX },
+  { "movZ",		Dm, Rm, XX },
   { "movL",		Rd, Td, XX },
   { "(bad)",		XX, XX, XX },
   { "movL",		Td, Rd, XX },


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]