]> xenbits.xensource.com Git - qemu-xen.git/commitdiff
MIPS Userland TLS register emulation, by Daniel Jacobowitz.
authorths <ths@c046a42c-6fe2-441c-8c8c-71466251a162>
Fri, 2 Mar 2007 20:48:00 +0000 (20:48 +0000)
committerths <ths@c046a42c-6fe2-441c-8c8c-71466251a162>
Fri, 2 Mar 2007 20:48:00 +0000 (20:48 +0000)
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@2465 c046a42c-6fe2-441c-8c8c-71466251a162

linux-user/main.c
linux-user/mips/syscall_nr.h
linux-user/syscall.c
target-mips/cpu.h
target-mips/op.c
target-mips/translate.c

index 3eb573db6919bb8c45a93c9f9f17f744449bc137..36713844863221f6989cc9db6b7900aed9b26638 100644 (file)
@@ -1297,6 +1297,7 @@ static const uint8_t mips_syscall_args[] = {
        MIPS_SYS(sys_add_key    , 5)
        MIPS_SYS(sys_request_key        , 4)
        MIPS_SYS(sys_keyctl     , 5)
+       MIPS_SYS(sys_set_thread_area, 1)
 };
 
 #undef MIPS_SYS
index 3593e65d05246580e290bdb5cdd2eedece0203b0..e869bcdd6640dea995bfad8fc8946bb45f946fc3 100644 (file)
 #define TARGET_NR_add_key                      (TARGET_NR_Linux + 280)
 #define TARGET_NR_request_key          (TARGET_NR_Linux + 281)
 #define TARGET_NR_keyctl                       (TARGET_NR_Linux + 282)
-
+#define TARGET_NR_set_thread_area      (TARGET_NR_Linux + 283)
index 76b36524a1ce5c136f93dd17f31ad4354a566e3e..acd098d87cf27ec212cbffe0e07255ffeb1ab9fd 100644 (file)
@@ -165,6 +165,9 @@ _syscall3(int,sys_syslog,int,type,char*,bufp,int,len)
 #ifdef __NR_exit_group
 _syscall1(int,exit_group,int,error_code)
 #endif
+#if defined(TARGET_NR_set_tid_address) && defined(__NR_set_tid_address)
+_syscall1(int,set_tid_address,int *,tidptr)
+#endif
 
 extern int personality(int);
 extern int flock(int, int);
@@ -3968,6 +3971,15 @@ long do_syscall(void *cpu_env, int num, long arg1, long arg2, long arg3,
 #endif
 #ifdef TARGET_NR_set_thread_area
     case TARGET_NR_set_thread_area:
+#ifdef TARGET_MIPS
+      ((CPUMIPSState *) cpu_env)->tls_value = arg1;
+      ret = 0;
+      break;
+#else
+      goto unimplemented_nowarn;
+#endif
+#endif
+#ifdef TARGET_NR_get_thread_area
     case TARGET_NR_get_thread_area:
         goto unimplemented_nowarn;
 #endif
@@ -3975,10 +3987,17 @@ long do_syscall(void *cpu_env, int num, long arg1, long arg2, long arg3,
     case TARGET_NR_getdomainname:
         goto unimplemented_nowarn;
 #endif
+
+#if defined(TARGET_NR_set_tid_address) && defined(__NR_set_tid_address)
+    case TARGET_NR_set_tid_address:
+      ret = get_errno(set_tid_address((int *) arg1));
+      break;
+#endif
+
     default:
     unimplemented:
         gemu_log("qemu: Unsupported syscall: %d\n", num);
-#if defined(TARGET_NR_setxattr) || defined(TARGET_NR_set_thread_area) || defined(TARGET_NR_getdomainname)
+#if defined(TARGET_NR_setxattr) || defined(TARGET_NR_get_thread_area) || defined(TARGET_NR_getdomainname)
     unimplemented_nowarn:
 #endif
         ret = -ENOSYS;
index 21651beb0e0ce13538ce7f70c3cf4648589db782..69335a0189141722f940e23e45548aecb4be33ba 100644 (file)
@@ -268,6 +268,10 @@ struct CPUMIPSState {
     int SYNCI_Step; /* Address step size for SYNCI */
     int CCRes; /* Cycle count resolution/divisor */
 
+#if defined(CONFIG_USER_ONLY)
+    target_ulong tls_value;
+#endif
+
     CPU_COMMON
 
     int ram_size;
index 21795ad3700ab852a3928384a409bc22a9d61c3a..7c7ce3ba3e45a9475494890bdff8456848c7d014 100644 (file)
@@ -2021,6 +2021,13 @@ void op_tlbr (void)
 #endif
 
 /* Specials */
+#if defined (CONFIG_USER_ONLY)
+void op_tls_value (void)
+{
+  T0 = env->tls_value;
+}
+#endif
+
 void op_pmon (void)
 {
     CALL_FROM_TB1(do_pmon, PARAM1);
index 5a77e906f13e66fa9e71e25d67a58efa61c4ade8..a9f7b75c465a8d14db485d175411a605a2441c7e 100644 (file)
@@ -4728,6 +4728,12 @@ static void decode_opc (CPUState *env, DisasContext *ctx)
            case 3:
                gen_op_rdhwr_ccres();
                break;
+#if defined (CONFIG_USER_ONLY)
+           case 29:
+               gen_op_tls_value ();
+               GEN_STORE_TN_REG(rt, T0);
+               break;
+#endif
            default:            /* Invalid */
                MIPS_INVAL("rdhwr");
                generate_exception(ctx, EXCP_RI);