linux-user: Enable NPTL for m68k
authorPeter Maydell <peter.maydell@linaro.org>
Tue, 16 Jul 2013 17:44:55 +0000 (18:44 +0100)
committerRiku Voipio <riku.voipio@linaro.org>
Mon, 22 Jul 2013 18:54:20 +0000 (21:54 +0300)
For m68k, per-thread data is a purely kernel construct with no
CPU level support. Implement it via a field in the TaskState structure,
used by cpu_set_tls() and the set_thread_area/get_thread_area
syscalls. This allows us to enable compilation with NPTL.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: Laurent Vivier <laurent@vivier.eu>
Signed-off-by: Riku Voipio <riku.voipio@linaro.org>
configure
linux-user/m68k/target_cpu.h
linux-user/qemu.h
linux-user/syscall.c

index ab3dc3cbca06273a614b0745c085d44b677fbf2d..f065edc8bb6253812ad523772b717a9a618f03d4 100755 (executable)
--- a/configure
+++ b/configure
@@ -4210,7 +4210,6 @@ case "$target_name" in
   m68k)
     bflt="yes"
     gdb_xml_files="cf-core.xml cf-fp.xml"
-    target_nptl="no"
   ;;
   microblaze|microblazeel)
     TARGET_ARCH=microblaze
index 8a2a305a0b3dc710433d457ad680e33807848448..cad9c90dd07e9bbd5be906f513d4641de96d1c4f 100644 (file)
@@ -29,6 +29,10 @@ static inline void cpu_clone_regs(CPUM68KState *env, target_ulong newsp)
     env->dregs[0] = 0;
 }
 
-/* TODO: need to implement cpu_set_tls() */
+static inline void cpu_set_tls(CPUM68KState *env, target_ulong newtls)
+{
+    TaskState *ts = env->opaque;
+    ts->tp_value = newtls;
+}
 
 #endif
index 8c420da5c7edcbb25dbc2459f2e508375096bb02..1ff0fa8b1273339f47cd790f293c3188c881cd59 100644 (file)
@@ -121,6 +121,7 @@ typedef struct TaskState {
 #endif
 #ifdef TARGET_M68K
     int sim_syscalls;
+    abi_ulong tp_value;
 #endif
 #if defined(TARGET_ARM) || defined(TARGET_M68K) || defined(TARGET_UNICORE32)
     /* Extra fields for semihosted binaries.  */
index 00a0390ea930a5cdfa08b94b9188ac129c866e85..9619656d3c9c109eb8b78132102ef6373732e3dd 100644 (file)
@@ -8558,6 +8558,12 @@ abi_long do_syscall(void *cpu_env, int num, abi_long arg1,
 #elif defined(TARGET_I386) && defined(TARGET_ABI32)
       ret = do_set_thread_area(cpu_env, arg1);
       break;
+#elif defined(TARGET_M68K)
+      {
+          TaskState *ts = ((CPUArchState *)cpu_env)->opaque;
+          ts->tp_value = arg1;
+          break;
+      }
 #else
       goto unimplemented_nowarn;
 #endif
@@ -8566,6 +8572,12 @@ abi_long do_syscall(void *cpu_env, int num, abi_long arg1,
     case TARGET_NR_get_thread_area:
 #if defined(TARGET_I386) && defined(TARGET_ABI32)
         ret = do_get_thread_area(cpu_env, arg1);
+#elif defined(TARGET_M68K)
+        {
+            TaskState *ts = ((CPUArchState *)cpu_env)->opaque;
+            ret = ts->tp_value;
+            break;
+        }
 #else
         goto unimplemented_nowarn;
 #endif