From mboxrd@z Thu Jan 1 00:00:00 1970 From: Kevin Wolf Subject: Re: [RFC PATCH] emulator: Fix task switch into/out of VM86 Date: Tue, 10 Jan 2012 10:28:06 +0100 Message-ID: <4F0C04A6.1080705@redhat.com> References: <1326139810-5448-1-git-send-email-kwolf@redhat.com> <20120110090122.GI2167@redhat.com> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Cc: kvm@vger.kernel.org To: Gleb Natapov Return-path: Received: from mx1.redhat.com ([209.132.183.28]:55294 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755147Ab2AJJYo (ORCPT ); Tue, 10 Jan 2012 04:24:44 -0500 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.14.4/8.14.4) with ESMTP id q0A9OiYd018212 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Tue, 10 Jan 2012 04:24:44 -0500 In-Reply-To: <20120110090122.GI2167@redhat.com> Sender: kvm-owner@vger.kernel.org List-ID: Am 10.01.2012 10:01, schrieb Gleb Natapov: > On Mon, Jan 09, 2012 at 09:10:10PM +0100, Kevin Wolf wrote: >> * This works with VMX, but with SVM I have an additional problem: When >> trying to exit VM86 (usually by an exception) through a task gate in >> the IDT, the code runs into the reason = TASK_SWITCH_CALL path. I >> searched a bit in the documentation, but didn't find any obvious way >> to fix this. >> > Hmm, so exit_int_info is invalid during task switch exit even though > task switch was caused by an exception. I wonder is this the case when > vcpu is not in vm86 mode too? No idea, I would have to try it out. > For vm86 we can change: > > else > reason = TASK_SWITCH_CALL; > > to > else if (vcpu in vm86 mode) > reason = TASK_SWITCH_GATE; > else > reason = TASK_SWITCH_CALL; > > IIRC you can't change tasks by call in vm86 mode. Didn't check it in the manual, but you'll have a hard time accessing a protected mode segment in VM86, so I guess you're right. And in the VM86 branch we can probably fake the rest of the interrupt information so that we can pass the checks in the emulator (basically saying "not a software interrupt" should be enough). Kevin