Patch for the bug https://bugs.launchpad.net/qemu/+bug/661696
Testcase:
#include <stdio.h>
extern void *x;
int main() {
int a;
asm volatile ("x: fldz\n\
push %%edx\n\
fnstenv -0xc(%%esp)\n\
pop %%edx\n" : "=d" (a) : : "memory");
printf ("%x %x\n", a, &x);
return 0;
}
$ gcc -m32 test.c -o test
$ ./test
80483ae 80483ae
$ ./qemu/i386-linux-user/qemu-i386 ./test
0 80483ae
$ ./qemu-patched/i386-linux-user/qemu-i386 ./test
80483ae 80483ae
qemu-0.13.0-fix_fstenv.diff
Description: Binary data
