WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-devel

Re: [Xen-devel] Emulating RDTSC

To: "Diwaker Gupta" <diwaker.lists@xxxxxxxxx>
Subject: Re: [Xen-devel] Emulating RDTSC
From: "George Dunlap " <dunlapg@xxxxxxxxx>
Date: Fri, 27 Oct 2006 13:23:27 -0400
Cc: xen-devel <xen-devel@xxxxxxxxxxxxxxxxxxx>
Delivery-date: Fri, 27 Oct 2006 10:23:55 -0700
Domainkey-signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; h=received:message-id:date:from:sender:to:subject:cc:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references:x-google-sender-auth; b=AxeMIkz1XT4BBWS35gPZ/vkLYS5Qk0haHMRzW+YLKOukmkoLJmoLt16XhicMmf5/hARSmj04CU2N5H7M4lD3bIXf84Ki+59e2Wu6FsOeqgZwYba5WWmzThsXHmKD6tE/yZQA/VEPYoNGvKSl7txzLX/Yss/AWvz+yYTajKZFySg=
Envelope-to: www-data@xxxxxxxxxxxxxxxxxx
In-reply-to: <891be9410610261341t6b024ea6i9fe5c37d2ab62f2c@xxxxxxxxxxxxxx>
List-help: <mailto:xen-devel-request@lists.xensource.com?subject=help>
List-id: Xen developer discussion <xen-devel.lists.xensource.com>
List-post: <mailto:xen-devel@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=unsubscribe>
References: <891be9410610261341t6b024ea6i9fe5c37d2ab62f2c@xxxxxxxxxxxxxx>
Sender: xen-devel-bounces@xxxxxxxxxxxxxxxxxxx
First, add emulation for rdtsc in
xen/arch/x86/traps.c:emulate_privileged_op().  (Probably right next to
the implementation of RDMSR makes the most sense.)

Then, set CR4.TSD in this manner:
set_in_cr4(X86_CR4_TSD);

Of course simply enabling TSD will cause all RDTSCs in all domains to
be emulated, which may not be exactly what you want.  You might
consider adding a flag or something to the domain / vcpu struct and
modifying the context switch code to set the TSD flag is set only for
domains that you're interested in, and clear it otherwise.

Let me know if you have any trouble, and I'll see if I can extract a
patch from some old code that I have that did this exact thing.

-George

On 10/26/06, Diwaker Gupta <diwaker.lists@xxxxxxxxx> wrote:
Hi all,

Is it possible to modify Xen such that guests incur a fault when they
try to execute RDTSC and control is then passed to the hypervisor
which can then return whatever it wants to?

I'm starting with x86 PV guests, but using HVM guests is certainly an
option if that hardware makes it easier to achieve this. I'm thinking
that setting CR4.TSD in the guest control registers should be the
first step? Any comments or suggestions much appreciated.

Thanks,
Diwaker
--
Web/Blog/Gallery: http://floatingsun.net/blog

_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel


_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel

<Prev in Thread] Current Thread [Next in Thread>