Re: Serious bug in save_flags

From: Alan Modra (alan@linuxcare.com)
Date: Sat Mar 18 2000 - 21:47:55 EST


On Sat, 18 Mar 2000, Linus Torvalds wrote:

> 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.

Oh well, not the first time. I had to write a little program before I
believed you though. :-) Now it's clear that save_flags is safe. (And I
found the simple code bug that was locking my machine.)

What about switch_to() though? Ah! -fno-omit-frame-pointer for sched.c
Don't ever move switch_to() to a leaf function...

#include <stdio.h>

int main(void)
{
  int i, j;
  asm ("pushl %0; pushl %1; pushfl; popl 4(%%esp); pop %1; pop %0"
       : "=&r" (i), "=&r" (j)
       : "0" (0xdeadbeef), "1" (0xc0ffee));
  printf ("%08x %08x\n", i, j); /* If i is zapped, Linus is right */
  return 0;
}

-- 
Linuxcare. Support for the Revolution.

- 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:25 EST