Re: Serious bug in save_flags

From: Linus Torvalds (torvalds@transmeta.com)
Date: Sat Mar 18 2000 - 12:31:23 EST


On Sun, 19 Mar 2000, Alan Modra wrote:
>
> Unless I'm very much mistaken, I've hit a bad problem with save_flags and
> restore_flags on x86 with --fomit-frame-pointer.

You're mistaken.

The magic to know about is that the x86 will, for a "pop" instruction, use
the %esp _after_ the pop for any modrm calculations, so

        pushfl
        popl 0x18(%esp)

the "0x18(%esp)" address will be calculated using %esp after the popl,
which is obviously the same as the %esp before the pushfl, which in turn
is exactly what gcc thinks it should be.

Of course, this didn't used to be true - one of the changes between the
286 and the 386 was exactly this "which %esp will be used" issue (or maybe
it was between the 186 and the 286 - quite a long time ago, in any case).
However, it had been an undocumented issue until then, and it IS
documented now.

                Linus

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



This archive was generated by hypermail 2b29 : Thu Mar 23 2000 - 21:00:24 EST