Some x86 kernel bugs

H.J. Lu (hjl@lucon.org)
Sat, 28 Mar 1998 01:22:26 -0800 (PST)


Hi, Linus,

Using binutils 2.8.1.0.26, I found a few x86 kernel bugs. In linux
2.0.33 and 2.1.90, there are many

btl %al, xxxxxxxx
btrl %al, xxxxxxxx

The old binutils silently turned them into

btl %eax, xxxxxxxx
btrl %eax, xxxxxxxx

But binutils 2.8.1.0.26 flags them as error since the valid register
for btl/btrl is 16-bit or 32-bit. I am not sure if they are serious
or not. From what I have seen, they are mainly from SMP codes.

BTW, I am enclosng a preliminary patch for binutils 2.8.1.0.27 against
binutils 2.8.1.0.26.

Thanks.

-- 
H.J. Lu (hjl@gnu.org)
---
Index: bfd/configure
===================================================================
RCS file: /home/work/cvs/gnu/binutils/bfd/configure,v
retrieving revision 1.40
diff -u -r1.40 configure
--- bfd/configure	1998/03/26 23:33:24	1.40
+++ bfd/configure	1998/03/28 02:49:00
@@ -993,7 +993,7 @@
 
 PACKAGE=bfd
 
-VERSION=2.8.1.0.26
+VERSION=2.8.1.0.27
 
 if test "`cd $srcdir && pwd`" != "`pwd`" && test -f $srcdir/config.status; then
   { echo "configure: error: source directory already configured; run "make distclean" there first" 1>&2; exit 1; }
Index: bfd/configure.in
===================================================================
RCS file: /home/work/cvs/gnu/binutils/bfd/configure.in,v
retrieving revision 1.43
diff -u -r1.43 configure.in
--- bfd/configure.in	1998/03/26 23:33:25	1.43
+++ bfd/configure.in	1998/03/28 02:48:55
@@ -7,7 +7,7 @@
 AC_CANONICAL_SYSTEM
 AC_ISC_POSIX
 
-AM_INIT_AUTOMAKE(bfd, 2.8.1.0.26)
+AM_INIT_AUTOMAKE(bfd, 2.8.1.0.27)
 
 dnl These must be called before AM_PROG_LIBTOOL, because it may want
 dnl to call AC_CHECK_PROG.
Index: gas/ChangeLog.linux
===================================================================
RCS file: /home/work/cvs/gnu/binutils/gas/ChangeLog.linux,v
retrieving revision 1.37
diff -u -r1.37 ChangeLog.linux
--- gas/ChangeLog.linux	1998/03/27 09:04:04	1.37
+++ gas/ChangeLog.linux	1998/03/28 07:58:56
@@ -1,3 +1,10 @@
+Fri Mar 27 23:58:47 1998  H.J. Lu  (hjl@gnu.org)
+
+	* config/tc-i386.h (OperandSizeMask): New.
+
+	* config/tc-i386.c (md_assemble): Emit WORD_PREFIX_OPCODE only
+	when there is an ambiguity.
+
 Thu Mar 26 08:43:53 1998  H.J. Lu  (hjl@gnu.org)
 
 	* Makefile.am (diststuff): Depend on $(DISTFILES) instead of
Index: gas/config/tc-i386.c
===================================================================
RCS file: /home/work/cvs/gnu/binutils/gas/config/tc-i386.c,v
retrieving revision 1.34
diff -u -r1.34 tc-i386.c
--- gas/config/tc-i386.c	1998/03/27 18:54:53	1.34
+++ gas/config/tc-i386.c	1998/03/28 07:57:30
@@ -1201,7 +1201,7 @@
     /* If there's no opcode suffix and it is needed, we try to invent
        one based on register operands. */
     if (!i.suffix && i.reg_operands
-	&& (t->opcode_modifier & (ByteOperand|WordOperand|DWordOperand)))
+	&& (t->opcode_modifier & OperandSizeMask))
       {
 	/* We take i.suffix from the LAST register operand specified.  This
 	   assumes that the last register operands is the destination register
@@ -1315,7 +1315,10 @@
 			MAX_PREFIXES);
 		return;
 	      }
-	    i.prefix[i.prefixes++] = WORD_PREFIX_OPCODE;
+	    /* We only emit an operand size prefix if there is an
+	       ambiguity. */
+	    if ((t->opcode_modifier & OperandSizeMask) != WordOperand)
+	      i.prefix[i.prefixes++] = WORD_PREFIX_OPCODE;
 	  }
       }
 
Index: gas/config/tc-i386.h
===================================================================
RCS file: /home/work/cvs/gnu/binutils/gas/config/tc-i386.h,v
retrieving revision 1.19
diff -u -r1.19 tc-i386.h
--- gas/config/tc-i386.h	1998/03/26 23:33:48	1.19
+++ gas/config/tc-i386.h	1998/03/28 07:48:53
@@ -301,6 +301,7 @@
 #define ByteOperand 0x200000	/* allow byte operand size */
 #define WordOperand 0x400000	/* allow word operand size */
 #define DWordOperand 0x800000	/* allow double word operand size */
+#define OperandSizeMask (ByteOperand|WordOperand|DWordOperand)
 
   /* (opcode_modifier & COMES_IN_ALL_SIZES) is true if the
      instuction comes in byte, word, and dword sizes and is encoded into
Index: include/opcode/ChangeLog.linux
===================================================================
RCS file: /home/work/cvs/gnu/binutils/include/opcode/ChangeLog.linux,v
retrieving revision 1.13
diff -u -r1.13 ChangeLog.linux
--- include/opcode/ChangeLog.linux	1998/03/27 16:28:41	1.13
+++ include/opcode/ChangeLog.linux	1998/03/28 07:42:58
@@ -1,3 +1,7 @@
+Fri Mar 27 18:48:31 1998  H.J. Lu  <hjl@gnu.org>
+
+	* i386.h (i386_optab): Add more WordOperand.
+
 Thu Mar 26 19:23:24 1998  H.J. Lu  <hjl@gnu.org>
 
 	* i386.h (i386_optab): Use ByteOperand, WordOperand and
Index: include/opcode/i386.h
===================================================================
RCS file: /home/work/cvs/gnu/binutils/include/opcode/i386.h,v
retrieving revision 1.26
diff -u -r1.26 i386.h
--- include/opcode/i386.h	1998/03/27 18:54:58	1.26
+++ include/opcode/i386.h	1998/03/28 07:37:06
@@ -700,14 +700,14 @@
 /* processor control */
 {"fninit", 0, 0xdbe3, _, NoModrm, { 0, 0, 0} },
 {"finit", 0, 0x9bdbe3, _, NoModrm, { 0, 0, 0} },
-{"fldcw", 1, 0xd9, 5, Modrm, { WordMem, 0, 0} },
-{"fnstcw", 1, 0xd9, 7, Modrm, { WordMem, 0, 0} },
-{"fstcw", 1, 0x9bd9, 7, Modrm, { WordMem, 0, 0} },
-{"fnstsw", 1, 0xdfe0, _, NoModrm, { Acc, 0, 0} },
-{"fnstsw", 1, 0xdd, 7, Modrm, { WordMem, 0, 0} },
+{"fldcw", 1, 0xd9, 5, Modrm|WordOperand, { WordMem, 0, 0} },
+{"fnstcw", 1, 0xd9, 7, Modrm|WordOperand, { WordMem, 0, 0} },
+{"fstcw", 1, 0x9bd9, 7, Modrm|WordOperand, { WordMem, 0, 0} },
+{"fnstsw", 1, 0xdfe0, _, NoModrm|WordOperand, { Acc, 0, 0} },
+{"fnstsw", 1, 0xdd, 7, Modrm|WordOperand, { WordMem, 0, 0} },
 {"fnstsw", 0, 0xdfe0, _, NoModrm, { 0, 0, 0} },
-{"fstsw", 1, 0x9bdfe0, _, NoModrm, { Acc, 0, 0} },
-{"fstsw", 1, 0x9bdd, 7, Modrm, { WordMem, 0, 0} },
+{"fstsw", 1, 0x9bdfe0, _, NoModrm|WordOperand, { Acc, 0, 0} },
+{"fstsw", 1, 0x9bdd, 7, Modrm|WordOperand, { WordMem, 0, 0} },
 {"fstsw", 0, 0x9bdfe0, _, NoModrm, { 0, 0, 0} },
 {"fnclex", 0, 0xdbe2, _, NoModrm, { 0, 0, 0} },
 {"fclex", 0, 0x9bdbe2, _, NoModrm, { 0, 0, 0} },

- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.rutgers.edu