]> rtime.felk.cvut.cz Git - lisovros/qemu_apohw.git/commitdiff
[v2] linux-user: implement m68k atomic syscalls
authorRiku Voipio <riku.voipio@linaro.org>
Wed, 24 Jul 2013 06:44:26 +0000 (09:44 +0300)
committerRiku Voipio <riku.voipio@linaro.org>
Tue, 24 Sep 2013 07:47:07 +0000 (10:47 +0300)
With nptl enabled, atomic_cmpxchg_32 and atomic_barrier
system calls are needed. This patch enabled really dummy
versions of the system calls, modeled after the m68k
kernel code.

With this patch I am able to execute m68k binaries
with qemu linux-user (busybox compiled for coldfire).

[v2] que an segfault instead of returning a EFAULT
to keep in line with kernel code.

Cc: Laurent Vivier <laurent@vivier.eu>
Signed-off-by: Riku Voipio <riku.voipio@linaro.org>
linux-user/strace.list
linux-user/syscall.c

index 4f9c3646646e0f93cbd4f0d6c834a00ab5c75bd0..cf5841af60eed3589a331088ac9b4b567be665b0 100644 (file)
 #ifdef TARGET_NR_pipe2
 { TARGET_NR_pipe2, "pipe2", NULL, NULL, NULL },
 #endif
+#ifdef TARGET_NR_atomic_cmpxchg_32
+{ TARGET_NR_atomic_cmpxchg_32, "atomic_cmpxchg_32", NULL, NULL, NULL },
+#endif
+#ifdef TARGET_NR_atomic_barrier
+{ TARGET_NR_atomic_barrier, "atomic_barrier", NULL, NULL, NULL },
+#endif
index aebe36dea70e077c1f5b37b84d6e189e4625039e..b3822b32a0cb54388b1c1e36f590f0979957d2c8 100644 (file)
@@ -9132,6 +9132,34 @@ abi_long do_syscall(void *cpu_env, int num, abi_long arg1,
         }
         break;
     }
+#endif
+#ifdef TARGET_NR_atomic_cmpxchg_32
+    case TARGET_NR_atomic_cmpxchg_32:
+    {
+        /* should use start_exclusive from main.c */
+        abi_ulong mem_value;
+        if (get_user_u32(mem_value, arg6)) {
+            target_siginfo_t info;
+            info.si_signo = SIGSEGV;
+            info.si_errno = 0;
+            info.si_code = TARGET_SEGV_MAPERR;
+            info._sifields._sigfault._addr = arg6;
+            queue_signal((CPUArchState *)cpu_env, info.si_signo, &info);
+            ret = 0xdeadbeef;
+
+        }
+        if (mem_value == arg2)
+            put_user_u32(arg1, arg6);
+        ret = mem_value;
+        break;
+    }
+#endif
+#ifdef TARGET_NR_atomic_barrier
+    case TARGET_NR_atomic_barrier:
+    {
+        /* Like the kernel implementation and the qemu arm barrier, no-op this? */
+        break;
+    }
 #endif
     default:
     unimplemented: