From mboxrd@z Thu Jan 1 00:00:00 1970 From: Avi Kivity Subject: [PATCH v2 0/2] Trap and propagate divide errors when emulating DIV Date: Thu, 26 Aug 2010 11:58:59 +0300 Message-ID: <1282813141-20473-1-git-send-email-avi@redhat.com> To: Marcelo Tosatti , kvm@vger.kernel.org Return-path: Received: from mx1.redhat.com ([209.132.183.28]:61710 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752495Ab0HZI7E (ORCPT ); Thu, 26 Aug 2010 04:59:04 -0400 Received: from int-mx01.intmail.prod.int.phx2.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) by mx1.redhat.com (8.13.8/8.13.8) with ESMTP id o7Q8x37U023855 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Thu, 26 Aug 2010 04:59:03 -0400 Received: from cleopatra.tlv.redhat.com (cleopatra.tlv.redhat.com [10.35.255.11]) by int-mx01.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id o7Q8x2Eu011021 for ; Thu, 26 Aug 2010 04:59:03 -0400 Sender: kvm-owner@vger.kernel.org List-ID: KVM recently started emulating DIV and IDIV. However, those instructions trap when given the right operands. Since figuring out when to trap or not is difficult, we just execute the instruction and see if the processor trapped or not. Avi Kivity (2): x86: allow kernel exception fixup for divide errors (#DE) - dropped KVM: x86 emulator: add macros for executing instructions that may trap KVM: x86 emulator: trap and propagate #DE from DIV and IDIV - propagate return code to x86_emulate_insn() arch/x86/kvm/emulate.c | 63 ++++++++++++++++++++++++++++++++++++++++++++--- 1 files changed, 59 insertions(+), 4 deletions(-)