From: Alexander Graf Subject: Re: [PATCH 5/9] Add VMLOAD and VMSAVE handlers v5 Date: Thu, 30 Oct 2008 19:44:43 +0100 Message-ID: <71E40A19-2D2B-4884-94F6-910363EEE0C4@suse.de> References: <1224522290-11740-1-git-send-email-agraf@suse.de> <1224522290-11740-2-git-send-email-agraf@suse.de> <1224522290-11740-3-git-send-email-agraf@suse.de> <1224522290-11740-4-git-send-email-agraf@suse.de> <1224522290-11740-5-git-send-email-agraf@suse.de> <1224522290-11740-6-git-send-email-agraf@suse.de> <4909F793.4080404@codemonkey.ws> Mime-Version: 1.0 (Apple Message framework v929.2) Content-Type: text/plain; charset=US-ASCII; format=flowed; delsp=yes Content-Transfer-Encoding: 7bit Cc: kvm@vger.kernel.org, joro@8bytes.org, avi@redhat.com To: Anthony Liguori Return-path: Received: from ns1.suse.de ([195.135.220.2]:43171 "EHLO mx1.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1757505AbYJ3Sos (ORCPT ); Thu, 30 Oct 2008 14:44:48 -0400 In-Reply-To: <4909F793.4080404@codemonkey.ws> Sender: kvm-owner@vger.kernel.org List-ID: On 30.10.2008, at 19:06, Anthony Liguori wrote: > Alexander Graf wrote: >> This implements the VMLOAD and VMSAVE instructions, that usually >> surround >> the VMRUN instructions. Both instructions load / restore the same >> elements, >> so we only need to implement them once. >> >> v2 fixes CPL checking and replaces memcpy by assignments >> v3 makes use of the new permission checking >> snip >> >> +static int vmload_interception(struct vcpu_svm *svm, struct >> kvm_run *kvm_run) >> +{ >> + if (nested_svm_check_permissions(svm)) >> + return 1; >> + >> + svm->next_rip = kvm_rip_read(&svm->vcpu) + 3; >> + skip_emulated_instruction(&svm->vcpu); >> + >> + nested_svm_do(svm, svm->vmcb->save.rax, 0, NULL, >> nested_svm_vmload); >> > > The whole trampoline thing seems awkward to me. I think it would be > more reasonable to just open code this routine and use helper > functions when appropriate. What exactly do you mean? Do you prefer to duplicate the guest-page- mapping code several times? Alex