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] x86 instruction emulation in hvm

To: Keir Fraser <keir.fraser@xxxxxxxxxxxxx>
Subject: Re: [Xen-devel] x86 instruction emulation in hvm
From: Emre Can Sezer <ecsezer@xxxxxxxx>
Date: Mon, 11 May 2009 18:15:37 -0400
Cc: Xen Devel <xen-devel@xxxxxxxxxxxxxxxxxxx>
Delivery-date: Mon, 11 May 2009 15:16:13 -0700
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
In-reply-to: <C6290823.A474%keir.fraser@xxxxxxxxxxxxx>
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/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=unsubscribe>
References: <C6290823.A474%keir.fraser@xxxxxxxxxxxxx>
Sender: xen-devel-bounces@xxxxxxxxxxxxxxxxxxx
User-agent: Thunderbird 2.0.0.21 (Windows/20090302)
Yup. Not only did hvm_get_segment_register() work like a charm, but I also ran into another problem as you have foretold.

The instruction is fxsave, which uses a mask to copy some CPU information to a 512byte memory. Any chance of an emulation function for this instruction?

As a side note, I know of quite a few research papers that mention emulating memory writes to pages, some using Xen. This leads me to believe that the problem of emulating most of these functions should have been solved. I know it's not relevant for Xen production code, but I'm wondering if there is a full emulator (perhaps QEMU?) inside Xen that I can switch to instead of trying to add these functionalities in an ad-hoc manner?

John



Keir Fraser wrote:
On 07/05/2009 20:39, "Emre Can Sezer" <ecsezer@xxxxxxxx> wrote:

I'm running an HVM guest using shadow page tables on a 64bit machine.
I'm working on a project where I mark certain pages read-only and
capture the writes into these pages.  I then try to emulate the write
instructions using x86_emulate as is done in arch/x86/mm/shadow/multi.c.

The instruction I'm trying to emulate is:
asm("mov %%gs,%0" : "=m" (p->thread.gsindex));

Since the source operand is a segment register, and the x86_emulate_ops
structure that is being used does not have a ops->read_segment function
defined, the emulation fails.

Is there an easy way to add or activate this functionality?  Perhaps a
full emulator, since one would expect to see other cases of memory
writes that are not handled as well.

Easily implemented -- you pass through to hvm_get_segment_register(). My
guess is you'll quickly fault on another instruction which is not so easily
fixed up, however.

 -- Keir



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

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