Re: Potential bug? Jonathan S. Shapiro (shap@eros-os.org)
Fri, 30 Jun 2000 16:35:07 -0400

Yep. That's definitely serious. I'll look at that one later tonight.

The right question is: why isn't the absence of a bcopy_c causing a compile-time error?

I think the answer is that this code isn't getting used...

shap



From: "Vadim Lebedev" <vlebedev@aplio.fr> To: "Brian Denheyer" <briand@zipcon.net>; "Jonathan S. Shapiro" <shap@eros-os.org>
Cc: <eros-port@eros-os.org>
Sent: Friday, June 30, 2000 4:35 PM
Subject: RE: Potential bug?

>
> It seems that sys/machine/util-inline.hxx
>
> is SERIOUSLY broken
>
> ....
> 1. __bcopy_g uses "movsw" while it should be using "movsb"
> 2. __bcopy_const should be named bcopy_c
>
>
> inline void
> __bcopy_g(const void *from, void *to, size_t len)
> {
> __asm__ __volatile__ ("cld\n\t"
> "rep\n\t"
> "movsw\n\t" /* !!!!! SHOULD BE movsb
> : /* no output */
> :"c" (len),"S" (from),"D" (to)
> :"cx","si","di","memory");
> }
>
>
> #define __bcopy_const(s,d,count) \((count%4==0) ? \
> __bcopy_by4((s),(d),(count)) : \
> ((count%2==0) ? \
> __bcopy_by2((s),(d),(count)) : \
> __bcopy_g((s),(d),(count))))
>
> #define bcopy(s,d,count) \
> (__builtin_constant_p(count) ? \
> __bcopy_c((s),(d),(count)) : \
> __bcopy_g((s),(d),(count)))
>
>
> Best regards
> Vadim
>
>
>