lkml.org 
[lkml]   [1998]   [Mar]   [15]   [last100]   RSS Feed
Views: [more markup]  [less markup]  [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
FromAlan Modra <>
SubjectRe: [patch] x86, small syscall entry speedup, 2.1.90
DateSun, 15 Mar 1998 17:57:29 +1030 (CST)
Linus Torvalds wrote:
> On Fri, 13 Mar 1998, MOLNAR Ingo wrote:
> > 
> > this patch speeds up syscall entry and page faults by 1 cycle on a pentium
> > ;) It's tested.
> 
> It also won't actually compile with any sane assembler. Admittedly "gas"
> isn't sane, but maybe somebody will clean gas up some day.
> 
> Please fix gas instead of making the kernel uglier..
> 
> 		Linus
> 
> > -	mov %dx,%ds; \
> > -	mov %dx,%es;
> > +	movb %dx,%ds; \
> > +	movb %dx,%es;

Here's the patch to gas.  Seems to work OK.

1998-03-15  Alan Modra  <alan@SPRI.Levels.UniSA.Edu.Au>

	* config/tc-i386.c (md_assemble):   Add no_word_prefix_needed
	variable and don't emit a data-size prefix byte for segment
	register or control/debug register moves.  Check for incorrect
	suffix on these instructions too.

diff -ur gas-980310/gas/config/tc-i386.c gas/gas/config/tc-i386.c
--- gas-980310/gas/config/tc-i386.c	Tue Mar  3 19:40:21 1998
+++ gas/gas/config/tc-i386.c	Sun Mar 15 15:47:46 1998
@@ -1093,6 +1093,7 @@
     expressionS *exp;
     unsigned int overlap2;
     unsigned int found_reverse_match;
+    int no_word_prefix_needed = 0;
 
     overlap0 = overlap1 = overlap2 = found_reverse_match = 0;
     for (t = current_templates->start;
@@ -1276,6 +1277,22 @@
     if (overlap0 & Imm1)
       i.imm_operands = 0;	/* kludge for shift insns */
 
+    if (t->operand_types[0] & (SReg3|SReg2|Control|Debug|Test))
+      {
+	no_word_prefix_needed = 1;
+	if (i.suffix)
+	  {
+	    if ((i.suffix != WORD_OPCODE_SUFFIX
+		 && (t->operand_types[0] & (SReg3|SReg2)))
+		|| (i.suffix != DWORD_OPCODE_SUFFIX
+		    && (t->operand_types[0] & (Control|Debug|Test))))
+	      {
+		as_bad ("register does not match opcode suffix");
+		return;
+	      }
+	  }
+      }
+
     if (found_reverse_match)
       {
 	unsigned int save;
@@ -1301,7 +1318,8 @@
 	  t->base_opcode |= W;
 	/* Now select between word & dword operations via the
 				   operand size prefix. */
-	if ((i.suffix == WORD_OPCODE_SUFFIX) ^ flag_16bit_code)
+	if ((i.suffix == WORD_OPCODE_SUFFIX) != flag_16bit_code
+	    && !no_word_prefix_needed)
 	  {
 	    if (i.prefixes == MAX_PREFIXES)
 	      {
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu

\
 
 \ /
  Last update: 2005-03-22 12:41    [from the cache]
©2003-2008