From patchwork Fri Sep 27 12:10:05 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Riku Voipio X-Patchwork-Id: 278569 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id 2A2AA2C009F for ; Fri, 27 Sep 2013 22:13:21 +1000 (EST) Received: from localhost ([::1]:35936 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VPWv8-0001Ib-Rr for incoming@patchwork.ozlabs.org; Fri, 27 Sep 2013 08:13:18 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:59639) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VPWsK-0005sA-CZ for qemu-devel@nongnu.org; Fri, 27 Sep 2013 08:10:29 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1VPWsA-0008Av-RI for qemu-devel@nongnu.org; Fri, 27 Sep 2013 08:10:24 -0400 Received: from afflict.kos.to ([92.243.29.197]:51436) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VPWsA-0008Aj-L1 for qemu-devel@nongnu.org; Fri, 27 Sep 2013 08:10:14 -0400 Received: from kos.to (a91-156-63-85.elisa-laajakaista.fi [91.156.63.85]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by afflict.kos.to (Postfix) with ESMTPSA id DF1EF26556 for ; Fri, 27 Sep 2013 14:10:13 +0200 (CEST) Received: from voipio (uid 1000) (envelope-from voipio@kos.to) id 5e0a82 by kos.to (DragonFly Mail Agent); Fri, 27 Sep 2013 15:10:08 +0300 From: riku.voipio@linaro.org To: qemu-devel@nongnu.org Date: Fri, 27 Sep 2013 15:10:05 +0300 Message-Id: <89aaf1a6ad91c4cb3224fcca461d71dac9fa3fa6.1380283598.git.riku.voipio@linaro.org> X-Mailer: git-send-email 1.8.1.2 In-Reply-To: References: X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 92.243.29.197 Cc: Riku Voipio , Laurent Vivier Subject: [Qemu-devel] [PATCH 10/11] [v2] linux-user: implement m68k atomic syscalls X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org From: Riku Voipio 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 Signed-off-by: Riku Voipio --- linux-user/strace.list | 6 ++++++ linux-user/syscall.c | 28 ++++++++++++++++++++++++++++ 2 files changed, 34 insertions(+) diff --git a/linux-user/strace.list b/linux-user/strace.list index 4f9c364..cf5841a 100644 --- a/linux-user/strace.list +++ b/linux-user/strace.list @@ -1521,3 +1521,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 aebe36d..b3822b3 100644 --- a/linux-user/syscall.c +++ b/linux-user/syscall.c @@ -9133,6 +9133,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: gemu_log("qemu: Unsupported syscall: %d\n", num);