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.