Commit 0b6d3ae0723ba226cf07c549a948d4680fb7923b

Authored by aurel32
1 parent 7478757e

qemu sh4 nptl support

(Michael Trimarchi)

git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@5223 c046a42c-6fe2-441c-8c8c-71466251a162
configure
@@ -1437,6 +1437,7 @@ case "$target_cpu" in @@ -1437,6 +1437,7 @@ case "$target_cpu" in
1437 echo "#define TARGET_ARCH \"sh4\"" >> $config_h 1437 echo "#define TARGET_ARCH \"sh4\"" >> $config_h
1438 echo "#define TARGET_SH4 1" >> $config_h 1438 echo "#define TARGET_SH4 1" >> $config_h
1439 bflt="yes" 1439 bflt="yes"
  1440 + target_nptl="yes"
1440 ;; 1441 ;;
1441 sparc) 1442 sparc)
1442 echo "TARGET_ARCH=sparc" >> $config_mak 1443 echo "TARGET_ARCH=sparc" >> $config_mak
linux-user/main.c
@@ -1887,6 +1887,7 @@ void cpu_loop (CPUState *env) @@ -1887,6 +1887,7 @@ void cpu_loop (CPUState *env)
1887 1887
1888 switch (trapnr) { 1888 switch (trapnr) {
1889 case 0x160: 1889 case 0x160:
  1890 + env->pc += 2;
1890 ret = do_syscall(env, 1891 ret = do_syscall(env,
1891 env->gregs[3], 1892 env->gregs[3],
1892 env->gregs[4], 1893 env->gregs[4],
@@ -1896,7 +1897,6 @@ void cpu_loop (CPUState *env) @@ -1896,7 +1897,6 @@ void cpu_loop (CPUState *env)
1896 env->gregs[0], 1897 env->gregs[0],
1897 env->gregs[1]); 1898 env->gregs[1]);
1898 env->gregs[0] = ret; 1899 env->gregs[0] = ret;
1899 - env->pc += 2;  
1900 break; 1900 break;
1901 case EXCP_INTERRUPT: 1901 case EXCP_INTERRUPT:
1902 /* just indicate that signals should be handled asap */ 1902 /* just indicate that signals should be handled asap */
linux-user/syscall.c
@@ -53,6 +53,7 @@ @@ -53,6 +53,7 @@
53 //#include <sys/user.h> 53 //#include <sys/user.h>
54 #include <netinet/ip.h> 54 #include <netinet/ip.h>
55 #include <netinet/tcp.h> 55 #include <netinet/tcp.h>
  56 +#include <qemu-common.h>
56 57
57 #define termios host_termios 58 #define termios host_termios
58 #define winsize host_winsize 59 #define winsize host_winsize
@@ -4662,7 +4663,11 @@ abi_long do_syscall(void *cpu_env, int num, abi_long arg1, @@ -4662,7 +4663,11 @@ abi_long do_syscall(void *cpu_env, int num, abi_long arg1,
4662 ret = get_errno(fsync(arg1)); 4663 ret = get_errno(fsync(arg1));
4663 break; 4664 break;
4664 case TARGET_NR_clone: 4665 case TARGET_NR_clone:
  4666 +#if defined(TARGET_SH4)
  4667 + ret = get_errno(do_fork(cpu_env, arg1, arg2, arg3, arg5, arg4));
  4668 +#else
4665 ret = get_errno(do_fork(cpu_env, arg1, arg2, arg3, arg4, arg5)); 4669 ret = get_errno(do_fork(cpu_env, arg1, arg2, arg3, arg4, arg5));
  4670 +#endif
4666 break; 4671 break;
4667 #ifdef __NR_exit_group 4672 #ifdef __NR_exit_group
4668 /* new thread calls */ 4673 /* new thread calls */
target-sh4/cpu.h
@@ -141,6 +141,11 @@ void sh4_cpu_list(FILE *f, int (*cpu_fprintf)(FILE *f, const char *fmt, ...)); @@ -141,6 +141,11 @@ void sh4_cpu_list(FILE *f, int (*cpu_fprintf)(FILE *f, const char *fmt, ...));
141 void cpu_sh4_write_mmaped_utlb_addr(CPUSH4State *s, target_phys_addr_t addr, 141 void cpu_sh4_write_mmaped_utlb_addr(CPUSH4State *s, target_phys_addr_t addr,
142 uint32_t mem_value); 142 uint32_t mem_value);
143 143
  144 +static inline void cpu_set_tls(CPUSH4State *env, target_ulong newtls)
  145 +{
  146 + env->gbr = newtls;
  147 +}
  148 +
144 #include "softfloat.h" 149 #include "softfloat.h"
145 150
146 #define CPUState CPUSH4State 151 #define CPUState CPUSH4State