Re: Opteron bug

From: Jakub Jelinek
Date: Mon Jun 21 2004 - 00:49:29 EST


On Mon, Jun 21, 2004 at 02:54:53AM +0300, Denis Vlasenko wrote:
> On Sunday 20 June 2004 15:02, Jakub Jelinek wrote:
> > On Sun, Jun 20, 2004 at 01:47:17PM +0200, R. J. Wysocki wrote:
> > > Well, is there any case in which the gcc can produce such stuff?
> >
> > GCC doesn't ever generate std instruction (only cld), though users
> > can use it in inline assembly or assembly source file.
> > AFAIK x86_64 glibc doesn't use it at all either.
>
> glibc-2.3/sysdeps/i386/memcopy.h:
>
> #define BYTE_COPY_BWD(dst_ep, src_ep, nbytes) \
> do \
> { \
> int __d0; \
> asm volatile(/* Set the direction flag, so copying goes backwards. */ \
> "std\n" \
> /* Copy bytes. */ \
> "rep\n" \
> "movsb\n" \
> /* Clear the dir flag. Convention says it should be 0. */ \
> "cld" : \
> "=D" (dst_ep), "=S" (src_ep), "=c" (__d0) : \
> "0" (dst_ep - 1), "1" (src_ep - 1), "2" (nbytes) : \
> "memory"); \
> dst_ep += 1; \
> src_ep += 1; \
> } while (0)
>
> WORD_COPY_BWD also does this

I know, but I said x86_64 glibc, which doesn't do this.

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