From mboxrd@z Thu Jan 1 00:00:00 1970 From: Avi Kivity Subject: Re: [PATCH 2/2] x86 emulator: Add into, int, and int3 instructions (opcodes 0xcc-0xce) Date: Wed, 04 Aug 2010 09:21:43 +0300 Message-ID: <4C5906F7.6020009@redhat.com> References: <1280889892-25751-1-git-send-email-m.gamal005@gmail.com> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Cc: mtosatti@redhat.com, kvm@vger.kernel.org To: Mohammed Gamal Return-path: Received: from mx1.redhat.com ([209.132.183.28]:53998 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1758284Ab0HDGVs (ORCPT ); Wed, 4 Aug 2010 02:21:48 -0400 In-Reply-To: <1280889892-25751-1-git-send-email-m.gamal005@gmail.com> Sender: kvm-owner@vger.kernel.org List-ID: On 08/04/2010 05:44 AM, Mohammed Gamal wrote: > This adds support for int instructions to the emulator > > @@ -2963,6 +3025,21 @@ special_insn: > if (rc != X86EMUL_CONTINUE) > goto done; > break; > + case 0xcc: /* int3 */ > + irq = 3; > + goto do_interrupt; > + case 0xcd: /* int n */ > + irq = c->src.val; > + do_interrupt: > + rc = emulate_int(ctxt, ops, irq); > + if (rc != X86EMUL_CONTINUE) > + goto done; > + break; > + case 0xce: /* into */ > + if (ctxt->eflags& EFLG_OF) { > + irq = 4; > + goto do_interrupt; > + } If OF is clear, you fall through and emulate an IRET. > case 0xcf: /* iret */ > rc = emulate_iret(ctxt, ops); > -- I have a truly marvellous patch that fixes the bug which this signature is too narrow to contain.