From patchwork Mon Aug 28 01:56:54 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: =?UTF-8?q?Sergio=20Andr=C3=A9s=20G=C3=B3mez=20Del=20Real?= X-Patchwork-Id: 9924057 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 524A46035E for ; Mon, 28 Aug 2017 02:04:36 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 44BB82869F for ; Mon, 28 Aug 2017 02:04:36 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 39C83286A1; Mon, 28 Aug 2017 02:04:36 +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 EF2CA2869F for ; Mon, 28 Aug 2017 02:04:35 +0000 (UTC) Received: from localhost ([::1]:36524 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dm9Pn-0001Ez-3n for patchwork-qemu-devel@patchwork.kernel.org; Sun, 27 Aug 2017 22:04:35 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:42162) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dm9JL-0005Au-Kz for qemu-devel@nongnu.org; Sun, 27 Aug 2017 21:57:56 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dm9JJ-0001PF-Ky for qemu-devel@nongnu.org; Sun, 27 Aug 2017 21:57:55 -0400 Received: from mail-vk0-x242.google.com ([2607:f8b0:400c:c05::242]:34776) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1dm9JJ-0001Nr-99 for qemu-devel@nongnu.org; Sun, 27 Aug 2017 21:57:53 -0400 Received: by mail-vk0-x242.google.com with SMTP id l132so1887362vke.1 for ; Sun, 27 Aug 2017 18:57:53 -0700 (PDT) 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; bh=csc4rV+F45UbQaFRXt6lvY/+i947G+pQjwkK520n0AY=; b=mMUSYgeTRyrkP09TyITPtVKx3fsV2b+kLdVftd5QBaZwxbOkL/LYacwzcDLd0IOrCW /QW6CCmVJq7xJktSU//33CL9r8h5RolLUAvuHcadcsYIJgcteIkcIxeybsIBwJdS+sRZ SXRzwxkHZk/Hb0JP79p9AwLYtIASRGQ8VVP/m+3WULesIyDJc8jMg9W8CzFb4kgo6HI3 ll9UtsVD3dj87b4IbKoH9YttgZhT65z7wJUIBIl5TYJA75Wck8dUw6PnAcKGizDuHUy9 xKg++gaRUBhE1xPVqpDXYCVF1hsZbNMkCixSzljkV5mAJMc6MBcfZ7wGalQPXXwU2rCx tTYw== 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; bh=csc4rV+F45UbQaFRXt6lvY/+i947G+pQjwkK520n0AY=; b=rNMXzYqT+XWj0S/4ID0sp+1I2RBadkiSa+HLaRjXaT+dxKNBvyuZH+mWt/+MBLC5ra uUzGJaJtolp4nccJ6GlsDMgLprVebDvUE/u9ymTyEsqfo1h4IYZIBdLgeSRHTfIE7El1 0sHgMNKcLXLDXXylPca9e2MeikH7PpZSVVcznDApiU2Y279h9ZEIMCpQ6SNo8kPfpQPd nkbTwHqAGPIReANW4yRvT5CVzkmS8T/gZ1UlKQWIvSiCEJ/ghsVdg9+J9zoaBYdVJLMP kC8zuOAl1vzH3Z0bl8mvAb+WzTq0UoFuqJLltNrl22WcaSqMrEEL4dypBpQQm9QggY76 5dmw== X-Gm-Message-State: AHYfb5gjNBAOw8eqo7MKTY5+N08x1xDk0QoQJbvEyxGzXOsHClBe8ayY 67AQfoS4vzqkPPKV X-Received: by 10.31.14.11 with SMTP id 11mr3479323vko.69.1503885472528; Sun, 27 Aug 2017 18:57:52 -0700 (PDT) Received: from localhost.localdomain ([191.109.6.191]) by smtp.gmail.com with ESMTPSA id y12sm2696824uad.22.2017.08.27.18.57.51 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 27 Aug 2017 18:57:52 -0700 (PDT) From: Sergio Andres Gomez Del Real X-Google-Original-From: Sergio Andres Gomez Del Real To: qemu-devel@nongnu.org Date: Sun, 27 Aug 2017 20:56:54 -0500 Message-Id: <20170828015654.2530-15-Sergio.G.DelReal@gmail.com> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20170828015654.2530-1-Sergio.G.DelReal@gmail.com> References: <20170828015654.2530-1-Sergio.G.DelReal@gmail.com> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2607:f8b0:400c:c05::242 Subject: [Qemu-devel] [PATCH 14/14] hvf: inject General Protection Fault when vmexit through vmcall 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: Sergio Andres Gomez Del Real Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP This commit injects a GP fault when the guest vmexit's by executing a vmcall instruction. Signed-off-by: Sergio Andres Gomez Del Real --- target/i386/hvf-all.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/target/i386/hvf-all.c b/target/i386/hvf-all.c index 25e4fd4eb2..fdb2b12c8a 100644 --- a/target/i386/hvf-all.c +++ b/target/i386/hvf-all.c @@ -1064,7 +1064,9 @@ int hvf_vcpu_exec(CPUState *cpu) macvm_set_rip(cpu, rip + ins_len); break; case VMX_REASON_VMCALL: - /* TODO: inject #GP fault */ + env->exception_injected = EXCP0D_GPF; + env->has_error_code = true; + env->error_code = 0; break; default: fprintf(stderr, "%llx: unhandled exit %llx\n", rip, exit_reason);