public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
* [PATCH] i386: cr8 handling
@ 2005-03-01  8:52 Jan Beulich
  2005-03-01 12:06 ` Alan Modra
  0 siblings, 1 reply; 4+ messages in thread
From: Jan Beulich @ 2005-03-01  8:52 UTC (permalink / raw)
  To: binutils

[-- Attachment #1: Type: text/plain, Size: 7993 bytes --]

This adds cr8...15 support as per http://www.amd.com/us-en/assets/ 
content_type/white_papers_and_tech_docs/24594.pdf.

Built and tested on i686-pc-linux-gnu.

Jan

gas/
2005-03-01  Jan Beulich  <jbeulich@novell.com>

	* config/tc-i386.c (build_modrm_byte): Add lock prefix for
cr8...15
	accesses.
	(parse_register): Allow cr8...15 in all modes.

gas/testsuite/
2005-03-01  Jan Beulich  <jbeulich@novell.com>

	* cr-err.[ls]: New.
	* crx.[ds]: New.
	* i386.exp: Run new tests.

opcodes/
2005-03-01  Jan Beulich  <jbeulich@novell.com>

	* i386-dis.c (print_insn): Suppress lock prefix printing for
cr8...15
	accesses.
	(OP_C): Consider lock prefix in non-64-bit modes.

---
/home/jbeulich/src/binutils/mainline/2005-02-28/gas/config/tc-i386.c	2005-02-01
16:15:56.000000000 +0100
+++ 2005-02-28/gas/config/tc-i386.c	2005-02-28 17:42:09.000000000
+0100
@@ -2868,6 +2868,13 @@ build_modrm_byte ()
 	  if ((i.op[source].regs->reg_flags & RegRex) != 0)
 	    i.rex |= REX_EXTX;
 	}
+      if (flag_code != CODE_64BIT && (i.rex & (REX_EXTX|REX_EXTZ)))
+	{
+	  if (!((i.types[0] | i.types[1]) & Control))
+	    abort ();
+	  i.rex &= ~(REX_EXTX|REX_EXTZ);
+	  add_prefix (LOCK_PREFIX_OPCODE);
+	}
     }
   else
     {			/* If it's not 2 reg operands...  */
@@ -5040,6 +5047,7 @@ parse_register (reg_string, end_op)
 
   if (r != NULL
       && ((r->reg_flags & (RegRex64 | RegRex)) | (r->reg_type &
Reg64)) != 0
+      && r->reg_type != Control
       && flag_code != CODE_64BIT)
     return (const reg_entry *) NULL;
 
---
/home/jbeulich/src/binutils/mainline/2005-02-28/gas/testsuite/gas/i386/cr-err.l	1970-01-01
01:00:00.000000000 +0100
+++ 2005-02-28/gas/testsuite/gas/i386/cr-err.l	2005-03-01
08:53:04.000000000 +0100
@@ -0,0 +1,29 @@
+.*: Assembler messages:
+.*:[0-9]+: Error: .\(%cr0\). is not a valid base/index expression
+.*:[0-9]+: Error: .\(%cr7\). is not a valid base/index expression
+.*:[0-9]+: Error: .\(%cr8\). is not a valid base/index expression
+.*:[0-9]+: Error: .\(%cr15\). is not a valid base/index expression
+.*:[0-9]+: Error: .\(%db0\). is not a valid base/index expression
+.*:[0-9]+: Error: .\(%db7\). is not a valid base/index expression
+.*:[0-9]+: Error: .\(%dr0\). is not a valid base/index expression
+.*:[0-9]+: Error: .\(%dr7\). is not a valid base/index expression
+.*:[0-9]+: Error: .\(%tr0\). is not a valid base/index expression
+.*:[0-9]+: Error: .\(%tr7\). is not a valid base/index expression
+.*:[0-9]+: Error: .\(cr0\). is not a valid base/index expression
+.*:[0-9]+: Error: .\(cr7\). is not a valid base/index expression
+.*:[0-9]+: Error: .\(cr8\). is not a valid base/index expression
+.*:[0-9]+: Error: .\(cr15\). is not a valid base/index expression
+.*:[0-9]+: Error: .\(db0\). is not a valid base/index expression
+.*:[0-9]+: Error: .\(db7\). is not a valid base/index expression
+.*:[0-9]+: Error: .\(dr0\). is not a valid base/index expression
+.*:[0-9]+: Error: .\(dr7\). is not a valid base/index expression
+.*:[0-9]+: Error: .\(tr0\). is not a valid base/index expression
+.*:[0-9]+: Error: .\(tr7\). is not a valid base/index expression
+.*:[0-9]+: Error: .\[cr0\]. is not a valid base/index expression
+.*:[0-9]+: Error: .\[cr7\]. is not a valid base/index expression
+.*:[0-9]+: Error: .\[cr8\]. is not a valid base/index expression
+.*:[0-9]+: Error: .\[cr15\]. is not a valid base/index expression
+.*:[0-9]+: Error: .\[dr0\]. is not a valid base/index expression
+.*:[0-9]+: Error: .\[dr7\]. is not a valid base/index expression
+.*:[0-9]+: Error: .\[tr0\]. is not a valid base/index expression
+.*:[0-9]+: Error: .\[tr7\]. is not a valid base/index expression
---
/home/jbeulich/src/binutils/mainline/2005-02-28/gas/testsuite/gas/i386/cr-err.s	1970-01-01
01:00:00.000000000 +0100
+++ 2005-02-28/gas/testsuite/gas/i386/cr-err.s	2005-03-01
08:48:54.000000000 +0100
@@ -0,0 +1,35 @@
+.text
+
+_start:
+	movl	(%cr0), %eax
+	movl	%eax, (%cr7)
+	movl	(%cr8), %eax
+	movl	%eax, (%cr15)
+	movl	(%db0), %eax
+	movl	%eax, (%db7)
+	movl	(%dr0), %eax
+	movl	%eax, (%dr7)
+	movl	(%tr0), %eax
+	movl	%eax, (%tr7)
+
+.att_syntax noprefix
+	movl	(cr0), eax
+	movl	eax, (cr7)
+	movl	(cr8), eax
+	movl	eax, (cr15)
+	movl	(db0), eax
+	movl	eax, (db7)
+	movl	(dr0), eax
+	movl	eax, (dr7)
+	movl	(tr0), eax
+	movl	eax, (tr7)
+
+.intel_syntax noprefix
+	mov	eax, [cr0]
+	mov	[cr7], eax
+	mov	eax, [cr8]
+	mov	[cr15], eax
+	mov	eax, [dr0]
+	mov	[dr7], eax
+	mov	eax, [tr0]
+	mov	[tr7], eax
---
/home/jbeulich/src/binutils/mainline/2005-02-28/gas/testsuite/gas/i386/crx.d	1970-01-01
01:00:00.000000000 +0100
+++ 2005-02-28/gas/testsuite/gas/i386/crx.d	2005-03-01
08:49:51.000000000 +0100
@@ -0,0 +1,20 @@
+#objdump: -dw
+#name: i386 cr8+
+
+.*: +file format .*
+
+Disassembly of section .text:
+
+0+ <_start>:
+[ 	]*[0-9a-f]+:	f0 0f 20 c0[ 	]+movl?[ 	]+?%cr8,%eax
+[ 	]*[0-9a-f]+:	f0 0f 20 c7[ 	]+movl?[ 	]+?%cr8,%edi
+[ 	]*[0-9a-f]+:	f0 0f 22 c0[ 	]+movl?[ 	]+?%eax,%cr8
+[ 	]*[0-9a-f]+:	f0 0f 22 c7[ 	]+movl?[ 	]+?%edi,%cr8
+[ 	]*[0-9a-f]+:	f0 0f 20 c0[ 	]+movl?[ 	]+?%cr8,%eax
+[ 	]*[0-9a-f]+:	f0 0f 20 c7[ 	]+movl?[ 	]+?%cr8,%edi
+[ 	]*[0-9a-f]+:	f0 0f 22 c0[ 	]+movl?[ 	]+?%eax,%cr8
+[ 	]*[0-9a-f]+:	f0 0f 22 c7[ 	]+movl?[ 	]+?%edi,%cr8
+[ 	]*[0-9a-f]+:	f0 0f 20 c0[ 	]+movl?[ 	]+?%cr8,%eax
+[ 	]*[0-9a-f]+:	f0 0f 20 c7[ 	]+movl?[ 	]+?%cr8,%edi
+[ 	]*[0-9a-f]+:	f0 0f 22 c0[ 	]+movl?[ 	]+?%eax,%cr8
+[ 	]*[0-9a-f]+:	f0 0f 22 c7[ 	]+movl?[ 	]+?%edi,%cr8
---
/home/jbeulich/src/binutils/mainline/2005-02-28/gas/testsuite/gas/i386/crx.s	1970-01-01
01:00:00.000000000 +0100
+++ 2005-02-28/gas/testsuite/gas/i386/crx.s	2005-03-01
08:45:59.000000000 +0100
@@ -0,0 +1,18 @@
+.text
+_start:
+	movl	%cr8, %eax
+	movl	%cr8, %edi
+	movl	%eax, %cr8
+	movl	%edi, %cr8
+
+.att_syntax noprefix
+	movl	cr8, eax
+	movl	cr8, edi
+	movl	eax, cr8
+	movl	edi, cr8
+
+.intel_syntax noprefix
+	mov	eax, cr8
+	mov	edi, cr8
+	mov	cr8, eax
+	mov	cr8, edi
---
/home/jbeulich/src/binutils/mainline/2005-02-28/gas/testsuite/gas/i386/i386.exp	2005-01-18
10:43:34.000000000 +0100
+++ 2005-02-28/gas/testsuite/gas/i386/i386.exp	2005-03-01
08:54:40.000000000 +0100
@@ -68,8 +68,9 @@ if [expr ([istarget "i*86-*-*"] ||  [ist
 	run_dump_test "divide"
     }
 
-
     run_dump_test "padlock"
+    run_dump_test "crx"
+    run_list_test "cr-err" ""
 
     # These tests require support for 8 and 16 bit relocs,
     # so we only run them for ELF and COFF targets.
---
/home/jbeulich/src/binutils/mainline/2005-02-28/opcodes/i386-dis.c	2005-01-18
10:44:57.000000000 +0100
+++ 2005-02-28/opcodes/i386-dis.c	2005-02-28 17:39:03.000000000
+0100
@@ -1956,7 +1956,7 @@ print_insn (bfd_vma pc, disassemble_info
   int i;
   char *first, *second, *third;
   int needcomma;
-  unsigned char uses_SSE_prefix;
+  unsigned char uses_SSE_prefix, uses_LOCK_prefix;
   int sizeflag;
   const char *p;
   struct dis_private priv;
@@ -2128,12 +2128,14 @@ print_insn (bfd_vma pc, disassemble_info
       dp = &dis386_twobyte[*++codep];
       need_modrm = twobyte_has_modrm[*codep];
       uses_SSE_prefix = twobyte_uses_SSE_prefix[*codep];
+      uses_LOCK_prefix = (*codep & ~0x02) == 0x20;
     }
   else
     {
       dp = &dis386[*codep];
       need_modrm = onebyte_has_modrm[*codep];
       uses_SSE_prefix = 0;
+      uses_LOCK_prefix = 0;
     }
   codep++;
 
@@ -2147,7 +2149,7 @@ print_insn (bfd_vma pc, disassemble_info
       oappend ("repnz ");
       used_prefixes |= PREFIX_REPNZ;
     }
-  if (prefixes & PREFIX_LOCK)
+  if (!uses_LOCK_prefix && (prefixes & PREFIX_LOCK))
     {
       oappend ("lock ");
       used_prefixes |= PREFIX_LOCK;
@@ -3993,9 +3995,16 @@ static void
 OP_C (int dummy ATTRIBUTE_UNUSED, int sizeflag ATTRIBUTE_UNUSED)
 {
   int add = 0;
-  USED_REX (REX_EXTX);
   if (rex & REX_EXTX)
-    add = 8;
+    {
+      USED_REX (REX_EXTX);
+      add = 8;
+    }
+  else if (!mode_64bit && (prefixes & PREFIX_LOCK))
+    {
+      used_prefixes |= PREFIX_LOCK;
+      add = 8;
+    }
   sprintf (scratchbuf, "%%cr%d", reg + add);
   oappend (scratchbuf + intel_syntax);
 }


[-- Attachment #2: binutils-mainline-i386-cr8.patch --]
[-- Type: text/plain, Size: 7991 bytes --]

This adds cr8...15 support as per http://www.amd.com/us-en/assets/
content_type/white_papers_and_tech_docs/24594.pdf.

Built and tested on i686-pc-linux-gnu.

Jan

gas/
2005-03-01  Jan Beulich  <jbeulich@novell.com>

	* config/tc-i386.c (build_modrm_byte): Add lock prefix for cr8...15
	accesses.
	(parse_register): Allow cr8...15 in all modes.

gas/testsuite/
2005-03-01  Jan Beulich  <jbeulich@novell.com>

	* cr-err.[ls]: New.
	* crx.[ds]: New.
	* i386.exp: Run new tests.

opcodes/
2005-03-01  Jan Beulich  <jbeulich@novell.com>

	* i386-dis.c (print_insn): Suppress lock prefix printing for cr8...15
	accesses.
	(OP_C): Consider lock prefix in non-64-bit modes.

--- /home/jbeulich/src/binutils/mainline/2005-02-28/gas/config/tc-i386.c	2005-02-01 16:15:56.000000000 +0100
+++ 2005-02-28/gas/config/tc-i386.c	2005-02-28 17:42:09.000000000 +0100
@@ -2868,6 +2868,13 @@ build_modrm_byte ()
 	  if ((i.op[source].regs->reg_flags & RegRex) != 0)
 	    i.rex |= REX_EXTX;
 	}
+      if (flag_code != CODE_64BIT && (i.rex & (REX_EXTX|REX_EXTZ)))
+	{
+	  if (!((i.types[0] | i.types[1]) & Control))
+	    abort ();
+	  i.rex &= ~(REX_EXTX|REX_EXTZ);
+	  add_prefix (LOCK_PREFIX_OPCODE);
+	}
     }
   else
     {			/* If it's not 2 reg operands...  */
@@ -5040,6 +5047,7 @@ parse_register (reg_string, end_op)
 
   if (r != NULL
       && ((r->reg_flags & (RegRex64 | RegRex)) | (r->reg_type & Reg64)) != 0
+      && r->reg_type != Control
       && flag_code != CODE_64BIT)
     return (const reg_entry *) NULL;
 
--- /home/jbeulich/src/binutils/mainline/2005-02-28/gas/testsuite/gas/i386/cr-err.l	1970-01-01 01:00:00.000000000 +0100
+++ 2005-02-28/gas/testsuite/gas/i386/cr-err.l	2005-03-01 08:53:04.000000000 +0100
@@ -0,0 +1,29 @@
+.*: Assembler messages:
+.*:[0-9]+: Error: .\(%cr0\). is not a valid base/index expression
+.*:[0-9]+: Error: .\(%cr7\). is not a valid base/index expression
+.*:[0-9]+: Error: .\(%cr8\). is not a valid base/index expression
+.*:[0-9]+: Error: .\(%cr15\). is not a valid base/index expression
+.*:[0-9]+: Error: .\(%db0\). is not a valid base/index expression
+.*:[0-9]+: Error: .\(%db7\). is not a valid base/index expression
+.*:[0-9]+: Error: .\(%dr0\). is not a valid base/index expression
+.*:[0-9]+: Error: .\(%dr7\). is not a valid base/index expression
+.*:[0-9]+: Error: .\(%tr0\). is not a valid base/index expression
+.*:[0-9]+: Error: .\(%tr7\). is not a valid base/index expression
+.*:[0-9]+: Error: .\(cr0\). is not a valid base/index expression
+.*:[0-9]+: Error: .\(cr7\). is not a valid base/index expression
+.*:[0-9]+: Error: .\(cr8\). is not a valid base/index expression
+.*:[0-9]+: Error: .\(cr15\). is not a valid base/index expression
+.*:[0-9]+: Error: .\(db0\). is not a valid base/index expression
+.*:[0-9]+: Error: .\(db7\). is not a valid base/index expression
+.*:[0-9]+: Error: .\(dr0\). is not a valid base/index expression
+.*:[0-9]+: Error: .\(dr7\). is not a valid base/index expression
+.*:[0-9]+: Error: .\(tr0\). is not a valid base/index expression
+.*:[0-9]+: Error: .\(tr7\). is not a valid base/index expression
+.*:[0-9]+: Error: .\[cr0\]. is not a valid base/index expression
+.*:[0-9]+: Error: .\[cr7\]. is not a valid base/index expression
+.*:[0-9]+: Error: .\[cr8\]. is not a valid base/index expression
+.*:[0-9]+: Error: .\[cr15\]. is not a valid base/index expression
+.*:[0-9]+: Error: .\[dr0\]. is not a valid base/index expression
+.*:[0-9]+: Error: .\[dr7\]. is not a valid base/index expression
+.*:[0-9]+: Error: .\[tr0\]. is not a valid base/index expression
+.*:[0-9]+: Error: .\[tr7\]. is not a valid base/index expression
--- /home/jbeulich/src/binutils/mainline/2005-02-28/gas/testsuite/gas/i386/cr-err.s	1970-01-01 01:00:00.000000000 +0100
+++ 2005-02-28/gas/testsuite/gas/i386/cr-err.s	2005-03-01 08:48:54.000000000 +0100
@@ -0,0 +1,35 @@
+.text
+
+_start:
+	movl	(%cr0), %eax
+	movl	%eax, (%cr7)
+	movl	(%cr8), %eax
+	movl	%eax, (%cr15)
+	movl	(%db0), %eax
+	movl	%eax, (%db7)
+	movl	(%dr0), %eax
+	movl	%eax, (%dr7)
+	movl	(%tr0), %eax
+	movl	%eax, (%tr7)
+
+.att_syntax noprefix
+	movl	(cr0), eax
+	movl	eax, (cr7)
+	movl	(cr8), eax
+	movl	eax, (cr15)
+	movl	(db0), eax
+	movl	eax, (db7)
+	movl	(dr0), eax
+	movl	eax, (dr7)
+	movl	(tr0), eax
+	movl	eax, (tr7)
+
+.intel_syntax noprefix
+	mov	eax, [cr0]
+	mov	[cr7], eax
+	mov	eax, [cr8]
+	mov	[cr15], eax
+	mov	eax, [dr0]
+	mov	[dr7], eax
+	mov	eax, [tr0]
+	mov	[tr7], eax
--- /home/jbeulich/src/binutils/mainline/2005-02-28/gas/testsuite/gas/i386/crx.d	1970-01-01 01:00:00.000000000 +0100
+++ 2005-02-28/gas/testsuite/gas/i386/crx.d	2005-03-01 08:49:51.000000000 +0100
@@ -0,0 +1,20 @@
+#objdump: -dw
+#name: i386 cr8+
+
+.*: +file format .*
+
+Disassembly of section .text:
+
+0+ <_start>:
+[ 	]*[0-9a-f]+:	f0 0f 20 c0[ 	]+movl?[ 	]+?%cr8,%eax
+[ 	]*[0-9a-f]+:	f0 0f 20 c7[ 	]+movl?[ 	]+?%cr8,%edi
+[ 	]*[0-9a-f]+:	f0 0f 22 c0[ 	]+movl?[ 	]+?%eax,%cr8
+[ 	]*[0-9a-f]+:	f0 0f 22 c7[ 	]+movl?[ 	]+?%edi,%cr8
+[ 	]*[0-9a-f]+:	f0 0f 20 c0[ 	]+movl?[ 	]+?%cr8,%eax
+[ 	]*[0-9a-f]+:	f0 0f 20 c7[ 	]+movl?[ 	]+?%cr8,%edi
+[ 	]*[0-9a-f]+:	f0 0f 22 c0[ 	]+movl?[ 	]+?%eax,%cr8
+[ 	]*[0-9a-f]+:	f0 0f 22 c7[ 	]+movl?[ 	]+?%edi,%cr8
+[ 	]*[0-9a-f]+:	f0 0f 20 c0[ 	]+movl?[ 	]+?%cr8,%eax
+[ 	]*[0-9a-f]+:	f0 0f 20 c7[ 	]+movl?[ 	]+?%cr8,%edi
+[ 	]*[0-9a-f]+:	f0 0f 22 c0[ 	]+movl?[ 	]+?%eax,%cr8
+[ 	]*[0-9a-f]+:	f0 0f 22 c7[ 	]+movl?[ 	]+?%edi,%cr8
--- /home/jbeulich/src/binutils/mainline/2005-02-28/gas/testsuite/gas/i386/crx.s	1970-01-01 01:00:00.000000000 +0100
+++ 2005-02-28/gas/testsuite/gas/i386/crx.s	2005-03-01 08:45:59.000000000 +0100
@@ -0,0 +1,18 @@
+.text
+_start:
+	movl	%cr8, %eax
+	movl	%cr8, %edi
+	movl	%eax, %cr8
+	movl	%edi, %cr8
+
+.att_syntax noprefix
+	movl	cr8, eax
+	movl	cr8, edi
+	movl	eax, cr8
+	movl	edi, cr8
+
+.intel_syntax noprefix
+	mov	eax, cr8
+	mov	edi, cr8
+	mov	cr8, eax
+	mov	cr8, edi
--- /home/jbeulich/src/binutils/mainline/2005-02-28/gas/testsuite/gas/i386/i386.exp	2005-01-18 10:43:34.000000000 +0100
+++ 2005-02-28/gas/testsuite/gas/i386/i386.exp	2005-03-01 08:54:40.000000000 +0100
@@ -68,8 +68,9 @@ if [expr ([istarget "i*86-*-*"] ||  [ist
 	run_dump_test "divide"
     }
 
-
     run_dump_test "padlock"
+    run_dump_test "crx"
+    run_list_test "cr-err" ""
 
     # These tests require support for 8 and 16 bit relocs,
     # so we only run them for ELF and COFF targets.
--- /home/jbeulich/src/binutils/mainline/2005-02-28/opcodes/i386-dis.c	2005-01-18 10:44:57.000000000 +0100
+++ 2005-02-28/opcodes/i386-dis.c	2005-02-28 17:39:03.000000000 +0100
@@ -1956,7 +1956,7 @@ print_insn (bfd_vma pc, disassemble_info
   int i;
   char *first, *second, *third;
   int needcomma;
-  unsigned char uses_SSE_prefix;
+  unsigned char uses_SSE_prefix, uses_LOCK_prefix;
   int sizeflag;
   const char *p;
   struct dis_private priv;
@@ -2128,12 +2128,14 @@ print_insn (bfd_vma pc, disassemble_info
       dp = &dis386_twobyte[*++codep];
       need_modrm = twobyte_has_modrm[*codep];
       uses_SSE_prefix = twobyte_uses_SSE_prefix[*codep];
+      uses_LOCK_prefix = (*codep & ~0x02) == 0x20;
     }
   else
     {
       dp = &dis386[*codep];
       need_modrm = onebyte_has_modrm[*codep];
       uses_SSE_prefix = 0;
+      uses_LOCK_prefix = 0;
     }
   codep++;
 
@@ -2147,7 +2149,7 @@ print_insn (bfd_vma pc, disassemble_info
       oappend ("repnz ");
       used_prefixes |= PREFIX_REPNZ;
     }
-  if (prefixes & PREFIX_LOCK)
+  if (!uses_LOCK_prefix && (prefixes & PREFIX_LOCK))
     {
       oappend ("lock ");
       used_prefixes |= PREFIX_LOCK;
@@ -3993,9 +3995,16 @@ static void
 OP_C (int dummy ATTRIBUTE_UNUSED, int sizeflag ATTRIBUTE_UNUSED)
 {
   int add = 0;
-  USED_REX (REX_EXTX);
   if (rex & REX_EXTX)
-    add = 8;
+    {
+      USED_REX (REX_EXTX);
+      add = 8;
+    }
+  else if (!mode_64bit && (prefixes & PREFIX_LOCK))
+    {
+      used_prefixes |= PREFIX_LOCK;
+      add = 8;
+    }
   sprintf (scratchbuf, "%%cr%d", reg + add);
   oappend (scratchbuf + intel_syntax);
 }

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] i386: cr8 handling
  2005-03-01  8:52 [PATCH] i386: cr8 handling Jan Beulich
@ 2005-03-01 12:06 ` Alan Modra
  0 siblings, 0 replies; 4+ messages in thread
From: Alan Modra @ 2005-03-01 12:06 UTC (permalink / raw)
  To: Jan Beulich; +Cc: binutils

On Tue, Mar 01, 2005 at 09:51:08AM +0100, Jan Beulich wrote:
> --- /home/jbeulich/src/binutils/mainline/2005-02-28/gas/config/tc-i386.c	2005-02-01 16:15:56.000000000 +0100
> +++ 2005-02-28/gas/config/tc-i386.c	2005-02-28 17:42:09.000000000 +0100
> @@ -2868,6 +2868,13 @@ build_modrm_byte ()
>  	  if ((i.op[source].regs->reg_flags & RegRex) != 0)
>  	    i.rex |= REX_EXTX;
>  	}
> +      if (flag_code != CODE_64BIT && (i.rex & (REX_EXTX|REX_EXTZ)))

Spaces around "|".  (Yes, I know tc-i386.c isn't consistent.)

> +	{
> +	  if (!((i.types[0] | i.types[1]) & Control))
> +	    abort ();
> +	  i.rex &= ~(REX_EXTX|REX_EXTZ);

Same here.

> +	  add_prefix (LOCK_PREFIX_OPCODE);
> +	}
>      }
>    else
>      {			/* If it's not 2 reg operands...  */
> @@ -5040,6 +5047,7 @@ parse_register (reg_string, end_op)
>  
>    if (r != NULL
>        && ((r->reg_flags & (RegRex64 | RegRex)) | (r->reg_type & Reg64)) != 0
> +      && r->reg_type != Control

I think this should be
      && (r->reg_type != Control || (cpu_arch_flags & CpuSledgehammer) != 0)

ie. Only enable cr8..cr15 if given ".arch sledgehammer".

>        && flag_code != CODE_64BIT)
>      return (const reg_entry *) NULL;

Otherwise the patch looks OK to apply.  Of course, you'll need to adjust
your testcases to supply .arch.

-- 
Alan Modra
IBM OzLabs - Linux Technology Centre

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] i386: cr8 handling
  2005-03-01 14:19 Jan Beulich
@ 2005-03-01 22:07 ` Alan Modra
  0 siblings, 0 replies; 4+ messages in thread
From: Alan Modra @ 2005-03-01 22:07 UTC (permalink / raw)
  To: Jan Beulich; +Cc: binutils

On Tue, Mar 01, 2005 at 03:20:04PM +0100, Jan Beulich wrote:
> Also, I'd think it should be
>       && (r->reg_type != Control || !(cpu_arch_flags &
> CpuSledgehammer))

Yes, I meant to write "== 0" rather than "!= 0".

> Please let me know if you indeed want me to add this additional check.

Yes, I think the test is worth having.

> Why? CpuUnknownFlags contains CpuSledgehammer, so it should be enabled
> by default.

Right.  Too late at night when I reviewed.

-- 
Alan Modra
IBM OzLabs - Linux Technology Centre

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] i386: cr8 handling
@ 2005-03-01 14:19 Jan Beulich
  2005-03-01 22:07 ` Alan Modra
  0 siblings, 1 reply; 4+ messages in thread
From: Jan Beulich @ 2005-03-01 14:19 UTC (permalink / raw)
  To: amodra; +Cc: binutils

>> @@ -5040,6 +5047,7 @@ parse_register (reg_string, end_op)
>>  
>>    if (r != NULL
>>        && ((r->reg_flags & (RegRex64 | RegRex)) | (r->reg_type &
Reg64)) != 0
>> +      && r->reg_type != Control
>
>I think this should be
>      && (r->reg_type != Control || (cpu_arch_flags & CpuSledgehammer)
!= 0)
>
>ie. Only enable cr8..cr15 if given ".arch sledgehammer".

I thought about that, too. But SledgeHammer isn't really the right
thing here, because only newer (future) processors are going to support
this. The granularity of these CPU-level things isn't right these days
anymore; you'd have to have a way to specify individual features...
Also, I'd think it should be
      && (r->reg_type != Control || !(cpu_arch_flags &
CpuSledgehammer))
Please let me know if you indeed want me to add this additional check.

>Otherwise the patch looks OK to apply.  Of course, you'll need to
adjust
>your testcases to supply .arch.

Why? CpuUnknownFlags contains CpuSledgehammer, so it should be enabled
by default.

Thanks, Jan

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2005-03-01 22:07 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-03-01  8:52 [PATCH] i386: cr8 handling Jan Beulich
2005-03-01 12:06 ` Alan Modra
2005-03-01 14:19 Jan Beulich
2005-03-01 22:07 ` Alan Modra

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).