From mboxrd@z Thu Jan 1 00:00:00 1970 From: Avi Kivity Subject: Re: [PATCH 7/9] Add VMLOAD and VMSAVE handlers Date: Mon, 01 Sep 2008 17:27:53 +0300 Message-ID: <48BBFBE9.70905@qumranet.com> References: <1220270281-15720-1-git-send-email-agraf@suse.de> <1220270281-15720-2-git-send-email-agraf@suse.de> <1220270281-15720-3-git-send-email-agraf@suse.de> <1220270281-15720-4-git-send-email-agraf@suse.de> <1220270281-15720-5-git-send-email-agraf@suse.de> <1220270281-15720-6-git-send-email-agraf@suse.de> <1220270281-15720-7-git-send-email-agraf@suse.de> <1220270281-15720-8-git-send-email-agraf@suse.de> <48BBEDCA.4030006@qumranet.com> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Cc: kvm@vger.kernel.org, joro@8bytes.org, anthony@codemonkey.ws To: Alexander Graf Return-path: Received: from il.qumranet.com ([212.179.150.194]:35893 "EHLO il.qumranet.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751108AbYIAO1z (ORCPT ); Mon, 1 Sep 2008 10:27:55 -0400 In-Reply-To: Sender: kvm-owner@vger.kernel.org List-ID: Alexander Graf wrote: > > On Sep 1, 2008, at 3:27 PM, Avi Kivity 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. >>> >>> +static int nested_svm_vmloadsave(struct vmcb *from_vmcb, struct >>> vmcb *to_vmcb) >>> +{ >>> + memcpy(&to_vmcb->save.fs, &from_vmcb->save.fs, sizeof(struct >>> vmcb_seg)); >>> + memcpy(&to_vmcb->save.gs, &from_vmcb->save.gs, sizeof(struct >>> vmcb_seg)); >>> + memcpy(&to_vmcb->save.tr, &from_vmcb->save.tr, sizeof(struct >>> vmcb_seg)); >>> + memcpy(&to_vmcb->save.ldtr, &from_vmcb->save.ldtr, >>> + sizeof(struct vmcb_seg)); >>> >> >> You can use simple assignment here. > > Uh ... like to_vmcb->save.fs = from_vmcb->save.fs; ? That works? Welcome to 1983 (or whenever this was introduced) :) >> >> Don't we need to check that svm is enabled in the guest as well (and >> inject #UD if not)? > > The EFER_SVME check happens in nested_svm_do. This way all SVM > operations get the check without code duplication. But the cpl check is not done? Sad. -- error compiling committee.c: too many arguments to function