[PATCH, i386]: Emit cld instruction when stringops are used
Richard Guenther
richard.guenther@gmail.com
Thu Mar 6 21:02:00 GMT 2008
On Thu, Mar 6, 2008 at 6:29 PM, Chris Lattner <clattner@apple.com> wrote:
> > No, gcc was never doing that, and there is no point to start doing
> > that.
> > If inline asm thinks it can't trust the psABI, it has to do cld on
> > its own.
> > And AFAIK inline asm that uses stos*/movs* etc. typically has cld at
> > the
> > beginning. If inline asm uses std, it must do cld before returning
> > back to
> > compiler generated code (again, from what I've seen asm that uses std
> > has the corresponding cld too).
>
> You forget that there is a ton of code in the world that does:
>
> void foo() {
> asm ( " rep; movsb", ...)
> }
>
> Knowing that the direction flag is clear on entry to the function.
> You propose auditing all the *existing* inline asm code active in the
> world? I thought the issue here was that *user* space can't trust
> that the direction flag is clear because of the kernel bug: if so,
> this isn't just about inline asm in the kernel.
Such code was broken in the past anyway, no need to try to fix that now.
Richard.
More information about the Gcc-patches
mailing list