From patchwork Fri Feb 10 18:45:25 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Pranith Kumar X-Patchwork-Id: 9567285 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 1A15060574 for ; Fri, 10 Feb 2017 18:46:06 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 0B2C1285B2 for ; Fri, 10 Feb 2017 18:46:06 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 000F7285B3; Fri, 10 Feb 2017 18:46:05 +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.8 required=2.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, T_DKIM_INVALID 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 9404C285B4 for ; Fri, 10 Feb 2017 18:46:05 +0000 (UTC) Received: from localhost ([::1]:45515 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ccGCq-0004BT-5U for patchwork-qemu-devel@patchwork.kernel.org; Fri, 10 Feb 2017 13:46:04 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:60281) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ccGCM-0004Ak-J6 for qemu-devel@nongnu.org; Fri, 10 Feb 2017 13:45:35 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ccGCI-0004ph-Ic for qemu-devel@nongnu.org; Fri, 10 Feb 2017 13:45:34 -0500 Received: from mail-yw0-x242.google.com ([2607:f8b0:4002:c05::242]:36104) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1ccGCI-0004pO-E8 for qemu-devel@nongnu.org; Fri, 10 Feb 2017 13:45:30 -0500 Received: by mail-yw0-x242.google.com with SMTP id q71so3159902ywg.3 for ; Fri, 10 Feb 2017 10:45:30 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=VTbZn1f+2L75bdyrsF7pw//6OWyuuQ4HFPdwAWmOklo=; b=pq5kP+7xz0Fz61/wfZWBZ6WyERwaxc6UxQzD/wHeKBdkplq+I4MNBOxsLpbjYlS7L3 yiuWHbHUBpoNTNIAgrNEvGqFYA5zuUyYjhdtBws5iL7jQhEJSLj2yxDbmsY2yDQeLtXX Ur6o8zojS3czoWTti91EvVyLVK4keNSc9er6Ib5JnDMgmWOFiO9xf0kt0cwskbLdj++N j0glPXII9Oz0HboGqsHkrKFjzAX8KA7xRLYAFn1WOGOZtUdYMTnrtAw7NBDuEju9Owit s1ov3GinMspNrZP117GQOhdGTJRU6/V4W5xRUA2AAK8rc9WYtb9SUN35D/ugPUdK/D7c Fw0g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=VTbZn1f+2L75bdyrsF7pw//6OWyuuQ4HFPdwAWmOklo=; b=PG+BPFzxYphGhw2xJrAGxLDwKJ2FwXWBHgF5hXVsMFGnw1PdeA/IjxQGJ+dB+1C2mv FUMZF/MwE1SwM1Y70qLZFJAAdxHPhYrnk5pJELiE7oFOl9Kq/IpbPGftxz45RBBa2Wba YH/pYi5oz3alDPsXRSu5B8h36u3OiJKaTmlWsewrYUJJ//+1/H2+fZd53/3krCj3QOh5 nfsFeVviPk7gMjX4wBhT3mF/sD0jAQfy8qmUb/pz3nWkaz816vJ06q0eXjtPGpadfDYw 2PYzCiKZkYQ/ZXTegB0QKyA3etCvck5ZGEY7U20cXhhGUl6xsFL5tm5jhAoAeEb4BBTr VZ3Q== X-Gm-Message-State: AMke39k7CnfQkQyC1Xi09ZROjLW7ylfMU98p1HEE6DeMfrshkJ8SOaio3FIuZH8vuOJPpg== X-Received: by 10.129.177.197 with SMTP id p188mr7492288ywh.183.1486752329770; Fri, 10 Feb 2017 10:45:29 -0800 (PST) Received: from localhost.localdomain (c-73-207-178-95.hsd1.ga.comcast.net. [73.207.178.95]) by smtp.gmail.com with ESMTPSA id p4sm1065798ywe.30.2017.02.10.10.45.28 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 10 Feb 2017 10:45:29 -0800 (PST) From: Pranith Kumar To: Paolo Bonzini , Peter Crosthwaite , Richard Henderson , qemu-devel@nongnu.org (open list:Overall) Date: Fri, 10 Feb 2017 13:45:25 -0500 Message-Id: <20170210184525.10966-3-bobby.prani@gmail.com> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20170210184525.10966-1-bobby.prani@gmail.com> References: <20170210184525.10966-1-bobby.prani@gmail.com> MIME-Version: 1.0 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 2607:f8b0:4002:c05::242 Subject: [Qemu-devel] [PATCH v2 2/2] tcg: Set jmp_env for exceptions from atomic execution 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: =?UTF-8?q?Alex=20Benn=C3=A9e?= Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP The current method of executing atomic code in a guest uses cpu_exec_step_atomic() from the outermost loop. This causes an abort() when single stepping over atomic code since debug exception longjmp will point to the the setlongjmp in cpu_exec(). Properly set jmp_env so that it jumps back here on an exception. CC: Alex Bennée CC: Richard Henderson CC: Paolo Bonzini Signed-off-by: Pranith Kumar --- cpu-exec.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/cpu-exec.c b/cpu-exec.c index 9200c643c2..e61f5747c8 100644 --- a/cpu-exec.c +++ b/cpu-exec.c @@ -242,9 +242,12 @@ static void cpu_exec_step(CPUState *cpu) tb_unlock(); cc->cpu_exec_enter(cpu); - /* execute the generated code */ - trace_exec_tb_nocache(tb, pc); - cpu_tb_exec(cpu, tb); + + if (sigsetjmp(cpu->jmp_env, 0) == 0) { + /* execute the generated code */ + trace_exec_tb_nocache(tb, pc); + cpu_tb_exec(cpu, tb); + } cc->cpu_exec_exit(cpu); tb_lock();