This is the mail archive of the binutils@sources.redhat.com 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] x86: reject invalid mnemonic prefixes


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))

Attachment: binutils-mainline-x86-ill-prefixes.patch
Description: Text document


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