From patchwork Thu Jul 28 15:44:50 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 9251425 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id B2C33607D8 for ; Thu, 28 Jul 2016 15:45:33 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id A173D27D13 for ; Thu, 28 Jul 2016 15:45:33 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 91F7D27D4D; Thu, 28 Jul 2016 15:45:33 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.9 required=2.0 tests=BAYES_00,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 04AF627D13 for ; Thu, 28 Jul 2016 15:45:33 +0000 (UTC) Received: from localhost ([::1]:54073 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bSnV5-0004jC-S7 for patchwork-qemu-devel@patchwork.kernel.org; Thu, 28 Jul 2016 11:45:31 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:57562) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bSnUX-0004gC-BA for qemu-devel@nongnu.org; Thu, 28 Jul 2016 11:44:58 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bSnUV-0007Vl-D7 for qemu-devel@nongnu.org; Thu, 28 Jul 2016 11:44:56 -0400 Received: from orth.archaic.org.uk ([2001:8b0:1d0::2]:58488) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bSnUV-0007Va-6J for qemu-devel@nongnu.org; Thu, 28 Jul 2016 11:44:55 -0400 Received: from pm215 by orth.archaic.org.uk with local (Exim 4.84_2) (envelope-from ) id 1bSnUU-0003ZF-ME; Thu, 28 Jul 2016 16:44:54 +0100 From: Peter Maydell To: qemu-devel@nongnu.org Date: Thu, 28 Jul 2016 16:44:50 +0100 Message-Id: <1469720690-32060-7-git-send-email-peter.maydell@linaro.org> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1469720690-32060-1-git-send-email-peter.maydell@linaro.org> References: <1469720690-32060-1-git-send-email-peter.maydell@linaro.org> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 2001:8b0:1d0::2 Subject: [Qemu-devel] [PATCH 6/6] linux-user: Implement force_sigsegv() via force_sig() X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Riku Voipio , patches@linaro.org Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP Now that we have a force_sig() with the semantics we need, we can implement force_sigsegv() to call it rather than open-coding the call to queue_signal(). Signed-off-by: Peter Maydell --- linux-user/signal.c | 17 ++--------------- 1 file changed, 2 insertions(+), 15 deletions(-) diff --git a/linux-user/signal.c b/linux-user/signal.c index cadb989..6f975b9 100644 --- a/linux-user/signal.c +++ b/linux-user/signal.c @@ -512,8 +512,7 @@ void signal_init(void) } } -#if !defined(TARGET_OPENRISC) && !defined(TARGET_UNICORE32) && \ - !defined(TARGET_X86_64) +#if !(defined(TARGET_X86_64) || defined(TARGET_UNICORE32)) /* Force a synchronously taken signal. The kernel force_sig() function * also forces the signal to "not blocked, not ignored", but for QEMU * that work is done in process_pending_signals(). @@ -531,9 +530,6 @@ static void force_sig(int sig) info._sifields._kill._uid = 0; queue_signal(env, info.si_signo, QEMU_SI_KILL, &info); } -#endif - -#if !(defined(TARGET_X86_64) || defined(TARGET_UNICORE32)) /* Force a SIGSEGV if we couldn't write to memory trying to set * up the signal frame. oldsig is the signal we were trying to handle @@ -541,22 +537,13 @@ static void force_sig(int sig) */ static void force_sigsegv(int oldsig) { - CPUState *cpu = thread_cpu; - CPUArchState *env = cpu->env_ptr; - target_siginfo_t info; - if (oldsig == SIGSEGV) { /* Make sure we don't try to deliver the signal again; this will * end up with handle_pending_signal() calling dump_core_and_abort(). */ sigact_table[oldsig - 1]._sa_handler = TARGET_SIG_DFL; } - info.si_signo = TARGET_SIGSEGV; - info.si_errno = 0; - info.si_code = TARGET_SI_KERNEL; - info._sifields._kill._pid = 0; - info._sifields._kill._uid = 0; - queue_signal(env, info.si_signo, QEMU_SI_KILL, &info); + force_sig(TARGET_SIGSEGV); } #endif