Re: [Q] Implementation of spin_lock on i386: why "rep;nop" ?

From: Brian Gerst (bgerst@didntduck.org)
Date: Tue Sep 18 2001 - 23:06:26 EST


Jamie Lokier wrote:
>
> Alan Cox wrote:
> > > The "rep;nop" line looks dubious, since the IA-32 programmer's manual from
> > > Intel (year 2001) mentions that the behaviour of REP is undefined when it
> > > is not used with string opcodes. BTW, according to the same manual, REP is
> > > supposed to modify ecx, but it looks like is is not the case here... which
> > > is fortunate, since ecx is never saved. :-)
> >
> > rep nop is a pentium IV operation. Its retroactively after testing defined
> > to be portable and ok.
>
> Are we sure that the value of ECX doesn't matter on a 386? Or does it
> count down doing nops ECX times on a 386?

Older processors ignore the rep prefix when used with non-string
opcodes. %ecx should not be affected.

--
						Brian Gerst
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/



This archive was generated by hypermail 2b29 : Sun Sep 23 2001 - 21:00:28 EST