[PATCH] x86: reject invalid mnemonic prefixes

Jan Beulich JBeulich@novell.com
Tue Jul 5 12:40:00 GMT 2005


Prefixes were not always checked for (non-)64-bit-ness.

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

Jan

gas/
2005-07-05  Jan Beulich  <jbeulich@novell.com>

	* config/tc-i386.c (parse_insn): Reject prefix if unavailable
in
	current mode.

---
/home/jbeulich/src/binutils/mainline/2005-07-05/gas/config/tc-i386.c	2005-07-05
09:14:29.000000000 +0200
+++ 2005-07-05/gas/config/tc-i386.c	2005-07-05 14:28:54.861774728
+0200
@@ -1643,6 +1643,15 @@ parse_insn (line, mnemonic)
 	  && current_templates
 	  && (current_templates->start->opcode_modifier & IsPrefix))
 	{
+	  if (current_templates->start->cpu_flags
+	      & (flag_code != CODE_64BIT ? Cpu64 : CpuNo64))
+	    {
+	      as_bad ((flag_code != CODE_64BIT
+		       ? _("`%s' is only supported in 64-bit mode")
+		       : _("`%s' is not supported in 64-bit mode")),
+		      current_templates->start->name);
+	      return NULL;
+	    }
 	  /* If we are in 16-bit mode, do not allow addr16 or data16.
 	     Similarly, in 32-bit mode, do not allow addr32 or data32. 
*/
 	  if ((current_templates->start->opcode_modifier & (Size16 |
Size32))

-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: binutils-mainline-x86-ill-prefixes.patch
URL: <https://sourceware.org/pipermail/binutils/attachments/20050705/d76a67e1/attachment.ksh>


More information about the Binutils mailing list