From mboxrd@z Thu Jan 1 00:00:00 1970 From: Paolo Bonzini Subject: Re: [PATCH] x86 emulator: Add IRET instruction Date: Mon, 26 Jul 2010 10:47:51 +0200 Message-ID: <4C4D4BB7.6010309@redhat.com> References: <1280085618-27368-1-git-send-email-m.gamal005@gmail.com> <4C4CCFD0.6090203@redhat.com> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Cc: avi@redhat.com, mtosatti@redhat.com, kvm@vger.kernel.org To: Mohammed Gamal Return-path: Received: from mx1.redhat.com ([209.132.183.28]:55803 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752715Ab0GZIsg (ORCPT ); Mon, 26 Jul 2010 04:48:36 -0400 In-Reply-To: Sender: kvm-owner@vger.kernel.org List-ID: On 07/26/2010 02:07 AM, Mohammed Gamal wrote: > On Mon, Jul 26, 2010 at 2:59 AM, Paolo Bonzini wrote: >> On 07/25/2010 09:20 PM, Mohammed Gamal wrote: >>> >>> + if (c->op_bytes == 4) >>> + temp_eflags = ((temp_eflags & 0x257fd5) | (ctxt->eflags& >>> 0x1a0000)); >> >> Should this do also >> >> if (c->op_bytes == 2) >> temp_eflags = ((temp_eflags & 0x7fd5) | (ctxt->eflags & ~0xffffL)); >> >> ? > > I don't think this is needed. The temp_eflags value is assigned > directly to eflags if we're operand size is 16 bits. At least that's > what the Intel manual says! That's fine, but please make sure that mov %sp, %bp orw $2, 4(%bp) iret followed at return site by pushf popw %ax does not set bit 1 in %ax. That's the important point (also see how emulate_popf avoids magic hex constants). Paolo