SH4 TARGET_NR_clone
Hi,
This patch fix the call of Clone in SH4 system
Regards Michael
This patch implements the correct TARGET_NR_clone for SH4 cpu.
syscall.c +5 -0
@@ -53,6 +53,7 @@//#include <sys/user.h> #include <netinet/ip.h> #include <netinet/tcp.h> +#include <qemu-common.h> #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 */
Quoted 3 lines · michael
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.
Thiemo
Quoted 29 lines
This patch implements the correct
TARGET_NR_clonefor SH4 cpu.Signed-off-by Michael Trimarchi <[email protected]>Index:
linux-user/syscall.c
===================================================================syscall.c +5
-0@@ -53,6 +53,7 @@//#include <sys/user.h> #include <netinet/ip.h> #include <netinet/tcp.h> +#include <qemu-common.h> #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 */
Hi,
Quoted 4 lines · Thiemo Seufer
Quoted 2 lines · michael
Hi,
Quoted 11 lines
Quoted 2 lines
This patch fix the call of Clone in SH4 system
What exactly does it fix? The kernel side of
sys_cloneseems to be no different to other architectures.Thiemo
Is not related to the kernel but how glibc pass the argument to you. Depends on the ARCH_FORK. I just notice that the tid is not in the same position.
Michael
Quoted 34 lines
Quoted 30 lines
This patch implements the correct
TARGET_NR_clonefor SH4 cpu.Signed-off-by Michael Trimarchi <[email protected]>Index:
linux-user/syscall.c
===================================================================syscall.c +5
-0@@ -53,6 +53,7 @@//#include <sys/user.h> #include <netinet/ip.h> #include <netinet/tcp.h> +#include <qemu-common.h> #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 */
Hi,
Quoted 10 lines · Thiemo Seufer
Quoted 4 lines · michael
Hi,
This patch fix the call of Clone in SH4 system
What exactly does it fix? The kernel side of
sys_cloneseems 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.
Quoted 20 lines
Thiemo
Quoted 15 lines
This patch implements the correct
TARGET_NR_clonefor SH4 cpu.Signed-off-by Michael Trimarchi <[email protected]>Index:
linux-user/syscall.c
===================================================================syscall.c +1
-0@@ -53,6 +53,7 @@//#include <sys/user.h> #include <netinet/ip.h> #include <netinet/tcp.h> +#include <qemu-common.h>
Quoted 19 lines
Quoted 5 lines
syscall.c +0
-0#define termios host_termios#define winsize host_winsize@@ -4657,7 +4658,11 @@ ret =get_errno (fsync (arg1));syscall.c line 4668
Quoted 10 lines
syscall.c +4
-0break ;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