From patchwork Thu Sep 22 12:13:42 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Riku Voipio X-Patchwork-Id: 76771 Delivered-To: patch@linaro.org Received: by 10.140.106.72 with SMTP id d66csp11249qgf; Thu, 22 Sep 2016 05:47:02 -0700 (PDT) X-Received: by 10.237.35.18 with SMTP id h18mr1783040qtc.149.1474548422325; Thu, 22 Sep 2016 05:47:02 -0700 (PDT) Return-Path: Received: from lists.gnu.org (lists.gnu.org. [2001:4830:134:3::11]) by mx.google.com with ESMTPS id f1si1017322qtf.91.2016.09.22.05.47.02 for (version=TLS1 cipher=AES128-SHA bits=128/128); Thu, 22 Sep 2016 05:47:02 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 2001:4830:134:3::11 as permitted sender) client-ip=2001:4830:134:3::11; Authentication-Results: mx.google.com; dkim=fail header.i=@linaro.org; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 2001:4830:134:3::11 as permitted sender) smtp.mailfrom=qemu-devel-bounces+patch=linaro.org@nongnu.org; dmarc=fail (p=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1]:43226 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bn3P3-0004kq-OR for patch@linaro.org; Thu, 22 Sep 2016 08:47:01 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:53352) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bn2uW-0000Jz-Dr for qemu-devel@nongnu.org; Thu, 22 Sep 2016 08:15:29 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bn2uQ-0006kD-DW for qemu-devel@nongnu.org; Thu, 22 Sep 2016 08:15:28 -0400 Received: from mail-lf0-f52.google.com ([209.85.215.52]:36646) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bn2uQ-0006k2-5b for qemu-devel@nongnu.org; Thu, 22 Sep 2016 08:15:22 -0400 Received: by mail-lf0-f52.google.com with SMTP id g62so65202811lfe.3 for ; Thu, 22 Sep 2016 05:15:22 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=u9FUiiAzGcoLdBqnPHP9aeTcdSEK0Xnja7LC/Uc5CEU=; b=dvweumKeSXtIS3wuLnt/NnmIu2qdKZ11FMygjQUBKzudExe7AsMUEZRPUxOrzDjg5L Ho0FpRqzS2zdG8oz+6btZwPFPkIh6gKpiBGAjffXEnnvB7xRLuD152kGty0mYJ+00iof yVeh+9vm6nxef+UnKjChw+mLOvhzf4ZeH5/vw= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=u9FUiiAzGcoLdBqnPHP9aeTcdSEK0Xnja7LC/Uc5CEU=; b=S5XmPeU4qnye76haLqGZ2tAjblqDqUfLrMw6/6GsyQudfIXBrnXKocf8chwc7O0kaM YxJcustDqcuMxCOhG5kC7PdXRYZ87+LoUYB+Q6w9PHyYkNklehpvWP3JjGTQ/SG431bb I9V2zLhBTnDcqLnV04Ju1jyUx8HVN5dbmWA26AIu8AVrfylkQuEz02FXWy1nsifQMQdn qCKg+R9Uxa+0JzFYrzDjCZ8bFDs2RLSBDbKNaOR+vFtpK8QTZ+t2EQGASGHewyBPd4Wu kdVQ5vEEZMMPwwCwZJaAuYLt5pXeT73ocv8SPk+W70VoXLcaIlOSsfK4oN69LJgI5ZVA aJ1Q== X-Gm-Message-State: AE9vXwMOQ+XRgzYs5mFJqk0km61+RtscC0dZknXm9jOGFeEdJWFqJNMHbA/gFr/otMHSecEP X-Received: by 10.25.214.42 with SMTP id n42mr763671lfg.109.1474546461172; Thu, 22 Sep 2016 05:14:21 -0700 (PDT) Received: from beaming.home (91-157-170-157.elisa-laajakaista.fi. [91.157.170.157]) by smtp.gmail.com with ESMTPSA id u14sm294378lja.11.2016.09.22.05.14.20 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 22 Sep 2016 05:14:20 -0700 (PDT) From: riku.voipio@linaro.org To: qemu-devel@nongnu.org Date: Thu, 22 Sep 2016 15:13:42 +0300 Message-Id: X-Mailer: git-send-email 2.1.4 In-Reply-To: References: X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 209.85.215.52 Subject: [Qemu-devel] [PULL 22/26] 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: Peter Maydell Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" From: Peter Maydell 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(). Reviewed-by: Richard Henderson Signed-off-by: Peter Maydell Signed-off-by: Riku Voipio --- linux-user/signal.c | 17 ++--------------- 1 file changed, 2 insertions(+), 15 deletions(-) -- 2.1.4 diff --git a/linux-user/signal.c b/linux-user/signal.c index 60fda18..900ee35 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