From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1KWDPr-0002J9-0R for qemu-devel@nongnu.org; Thu, 21 Aug 2008 12:53:43 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1KWDPo-0002Ht-Qy for qemu-devel@nongnu.org; Thu, 21 Aug 2008 12:53:42 -0400 Received: from [199.232.76.173] (port=36251 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1KWDPo-0002Hp-LZ for qemu-devel@nongnu.org; Thu, 21 Aug 2008 12:53:40 -0400 Received: from ms01.sssup.it ([193.205.80.99]:39293 helo=sssup.it) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1KWDPo-00044F-5H for qemu-devel@nongnu.org; Thu, 21 Aug 2008 12:53:40 -0400 Message-ID: <48AD9DA7.5010003@gandalf.sssup.it> Date: Thu, 21 Aug 2008 18:53:59 +0200 From: michael MIME-Version: 1.0 Subject: Re: [Qemu-devel] SH4 TARGET_NR_clone References: <4875D472.5020807@gandalf.sssup.it> <20080710094853.GA4303@networkno.de> In-Reply-To: <20080710094853.GA4303@networkno.de> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Reply-To: qemu-devel@nongnu.org List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: jan.kiszka@web.de Hi, Thiemo Seufer wrote: > michael wrote: > >> Hi, >> >> This patch fix the call of Clone in SH4 system >> > > What exactly does it fix? The kernel side of sys_clone seems to be no > different to other architectures. > Look at the libc code: nptl/sysdeps/unix/sysv/linux/fork.c the fork is implemente in this file. The ARCH_FORK is different in i386 an sh code. sh code: /* TLS pointer argument is passed as the 5-th argument. */ #define ARCH_FORK() \ INLINE_SYSCALL (clone, 5, \ CLONE_CHILD_SETTID | CLONE_CHILD_CLEARTID | SIGCHLD, 0, \ NULL, &THREAD_SELF->tid, NULL) i386 code: #define ARCH_FORK() \ INLINE_SYSCALL (clone, 5, \ CLONE_CHILD_SETTID | CLONE_CHILD_CLEARTID | SIGCHLD, 0, \ NULL, NULL, &THREAD_SELF->tid) As you can see the 4th and 5th argument are inverted, and it maybe justify my problem. > > Thiemo > > > >> This patch implements the correct TARGET_NR_clone for SH4 >> cpu. >> >> Signed-off-by: Michael Trimarchi >> >> Index: linux-user/syscall.c >> =================================================================== >> --- linux-user/syscall.c (revision 4865) >> +++ linux-user/syscall.c (working copy) >> @@ -53,6 +53,7 @@ >> //#include >> #include >> #include >> +#include >> >> #define termios host_termios >> #define winsize host_winsize >> @@ -4657,7 +4658,11 @@ >> ret = get_errno(fsync(arg1)); >> break; >> case TARGET_NR_clone: >> +#if !defined(TARGET_SH4) >> ret = get_errno(do_fork(cpu_env, arg1, arg2, arg3, arg4, arg5)); >> +#else >> + ret = get_errno(do_fork(cpu_env, arg1, arg2, arg3, arg5, arg4)); >> +#endif >> break; >> #ifdef __NR_exit_group >> /* new thread calls */ >> > > > > Regards Michael