[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] Re: qemu-ppc fails to run clone with CLONE_VM, threaded pro
From: |
Josh Triplett |
Subject: |
[Qemu-devel] Re: qemu-ppc fails to run clone with CLONE_VM, threaded programs, non-static programs |
Date: |
Fri, 21 Oct 2005 23:54:34 -0700 |
User-agent: |
Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.7.12) Gecko/20051007 Debian/1.7.12-1 |
Josh Triplett wrote:
> I'm attempting to run cross-compiled programs with qemu-ppc. Basic
> statically-linked programs work perfectly. However, if I attempt to run
> non-static programs or threaded programs, or if I attempt to call
> clone() with the CLONE_VM flag set, I get an invalid data memory access.
>
> Threaded programs get an error when calling pthread_create, with an
> invalid data memory access at 0x00000018. A simple test program using
> clone with CLONE_VM gets an invalid data memory access at 0x00000008.
> Non-static programs get an invalid data memory access at various
> addresses around 0x0de00000, before ever reaching main().
I worked with pbrook on #qemu to debug this issue. The problem turns
out to be that qemu's do_fork function on PowerPC zeroes out r7-r31 in
the new CPU state structure after a clone, which it should not do, as
the child's registers should match the parent; it also does not zero
register r3, which holds the return value and should be zero in the
child. I've prepared and attached a patch which should solve this problem.
- Josh Triplett
diff -Naur qemu-0.7.0.orig/linux-user/syscall.c qemu-0.7.0/linux-user/syscall.c
--- qemu-0.7.0.orig/linux-user/syscall.c 2005-10-21 19:56:04.000000000
-0700
+++ qemu-0.7.0/linux-user/syscall.c 2005-10-21 20:02:20.000000000 -0700
@@ -1560,11 +1560,7 @@
if (!newsp)
newsp = env->gpr[1];
new_env->gpr[1] = newsp;
- {
- int i;
- for (i = 7; i < 32; i++)
- new_env->gpr[i] = 0;
- }
+ new_env->gpr[3] = 0;
#else
#error unsupported target CPU
#endif
signature.asc
Description: OpenPGP digital signature