From mboxrd@z Thu Jan 1 00:00:00 1970 From: Takuya Yoshikawa Subject: Re: [RFC PATCH] emulator: Fix task switch into/out of VM86 Date: Tue, 10 Jan 2012 13:07:08 +0900 Message-ID: <4F0BB96C.2020504@oss.ntt.co.jp> References: <1326139810-5448-1-git-send-email-kwolf@redhat.com> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-2022-JP Content-Transfer-Encoding: 7bit Cc: kvm@vger.kernel.org To: Kevin Wolf Return-path: Received: from serv2.oss.ntt.co.jp ([222.151.198.100]:52614 "EHLO serv2.oss.ntt.co.jp" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1756015Ab2AJEFt (ORCPT ); Mon, 9 Jan 2012 23:05:49 -0500 In-Reply-To: <1326139810-5448-1-git-send-email-kwolf@redhat.com> Sender: kvm-owner@vger.kernel.org List-ID: (2012/01/10 5:10), Kevin Wolf wrote: > @@ -2254,7 +2258,14 @@ static int load_state_from_tss32(struct x86_emulate_ctxt *ctxt, > if (ctxt->ops->set_cr(ctxt, 3, tss->cr3)) > return emulate_gp(ctxt, 0); > ctxt->_eip = tss->eip; > + > ctxt->eflags = tss->eflags | 2; (Though not directly related to this RFC ...) What is this 2 for? Do we need to set a reserved bit? > + if (ctxt->eflags & 0x20000) You can use a macro to indicate the flag. 1. from arch/x86/kvm/emulate.c: /* EFLAGS bit definitions. */ #define EFLG_ID (1<<21) #define EFLG_VIP (1<<20) #define EFLG_VIF (1<<19) #define EFLG_AC (1<<18) #define EFLG_VM (1<<17) #define EFLG_RF (1<<16) ... #define EFLG_RESERVED_ZEROS_MASK 0xffc0802a #define EFLG_RESERVED_ONE_MASK 2 2. from arch/x86/include/asm/processor-flags.h /* * EFLAGS bits */ #define X86_EFLAGS_CF 0x00000001 /* Carry Flag */ #define X86_EFLAGS_PF 0x00000004 /* Parity Flag */ ... #define X86_EFLAGS_VM 0x00020000 /* Virtual Mode */ #define X86_EFLAGS_AC 0x00040000 /* Alignment Check */ #define X86_EFLAGS_VIF 0x00080000 /* Virtual Interrupt Flag */ #define X86_EFLAGS_VIP 0x00100000 /* Virtual Interrupt Pending */ #define X86_EFLAGS_ID 0x00200000 /* CPUID detection flag */ Two possibilities, not nice, but both are used in emulate.c. Takuya