qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] gcc 4.4 miscompiling cpu_exec() ?
@ 2010-02-23 14:50 Jay Foad
       [not found] ` <4B840A59.3060407@aurel32.net>
  2010-02-23 17:58 ` [Qemu-devel] " Paolo Bonzini
  0 siblings, 2 replies; 6+ messages in thread
From: Jay Foad @ 2010-02-23 14:50 UTC (permalink / raw)
  To: qemu-devel

I'm building QEMU mipsel-linux-user with Ubuntu's GCC 4.4 on an x86
host. Whenever I try to run a trivial MIPS executable, QEMU segfaults
in cpu_loop() shortly after the call to cpu_mips_exec().

The problem seems to be that cpu_exec() doesn't preserve ebp. It tries to:

    saved_env_reg = (host_reg_t) env;

where env is a global variable decorated with asm("ebp"). This saves
ebp to the stack, but later on, in some function inlined into
cpu_exec(), the value on the stack gets overwritten with something
else.

Has anyone else seen this?

The full GCC version string is:

gcc (Ubuntu 4.4.1-4ubuntu9) 4.4.1

The following versions of GCC don't seem to suffer from the same problem:

gcc-4.1 (GCC) 4.1.3 20080704 (prerelease) (Ubuntu 4.1.2-27ubuntu1)
gcc-4.2 (GCC) 4.2.4 (Ubuntu 4.2.4-5ubuntu1)
gcc-4.3 (Ubuntu 4.3.4-5ubuntu1) 4.3.4

Thanks,
Jay.

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2010-02-23 18:21 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-02-23 14:50 [Qemu-devel] gcc 4.4 miscompiling cpu_exec() ? Jay Foad
     [not found] ` <4B840A59.3060407@aurel32.net>
2010-02-23 17:57   ` Jay Foad
2010-02-23 17:58 ` [Qemu-devel] " Paolo Bonzini
2010-02-23 18:17   ` Jay Foad
2010-02-23 18:18     ` Paolo Bonzini
2010-02-23 18:21     ` [Qemu-devel] [PATCH] declare saved_env_reg as volatile Paolo Bonzini

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).