* [Qemu-devel] [RFC] [PATCH] linux-user: implement m68k atomic syscalls
@ 2013-07-24 7:10 riku.voipio
2013-07-24 18:43 ` Richard Henderson
0 siblings, 1 reply; 2+ messages in thread
From: riku.voipio @ 2013-07-24 7:10 UTC (permalink / raw)
To: qemu-devel; +Cc: Riku Voipio, Laurent Vivier
From: Riku Voipio <riku.voipio@linaro.org>
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).
Cc: Laurent Vivier <laurent@vivier.eu>
Signed-off-by: Riku Voipio <riku.voipio@linaro.org>
---
linux-user/strace.list | 6 ++++++
linux-user/syscall.c | 20 ++++++++++++++++++++
2 files changed, 26 insertions(+)
diff --git a/linux-user/strace.list b/linux-user/strace.list
index 08f115d..4377365 100644
--- a/linux-user/strace.list
+++ b/linux-user/strace.list
@@ -1524,3 +1524,9 @@
#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
diff --git a/linux-user/syscall.c b/linux-user/syscall.c
index 3f6db4b..a98cec5 100644
--- a/linux-user/syscall.c
+++ b/linux-user/syscall.c
@@ -8990,6 +8990,26 @@ 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))
+ ret = -TARGET_EFAULT;
+ 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:
gemu_log("qemu: Unsupported syscall: %d\n", num);
--
1.8.1.2
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [Qemu-devel] [RFC] [PATCH] linux-user: implement m68k atomic syscalls
2013-07-24 7:10 [Qemu-devel] [RFC] [PATCH] linux-user: implement m68k atomic syscalls riku.voipio
@ 2013-07-24 18:43 ` Richard Henderson
0 siblings, 0 replies; 2+ messages in thread
From: Richard Henderson @ 2013-07-24 18:43 UTC (permalink / raw)
To: riku.voipio; +Cc: qemu-devel, Laurent Vivier
On 07/23/2013 09:10 PM, riku.voipio@linaro.org wrote:
> +#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))
> + ret = -TARGET_EFAULT;
> + if (mem_value == arg2)
> + put_user_u32(arg1, arg6);
> + ret = mem_value;
> + break;
> + }
The ret = -TARGET_FAULT doesn't do anything useful
without an associated break.
The kernel queues the expected SIGSEGV for this sort
of failure. Would that happen here?
r~
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2013-07-24 18:44 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-07-24 7:10 [Qemu-devel] [RFC] [PATCH] linux-user: implement m68k atomic syscalls riku.voipio
2013-07-24 18:43 ` Richard Henderson
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).