From mboxrd@z Thu Jan 1 00:00:00 1970 From: "Zhengwang Ruan (Royo)" Subject: Re: why xen use x86_emulation() in page_fault Date: Tue, 11 Oct 2011 20:04:05 +0800 Message-ID: <4E9430B5.70608@gmail.com> References: <20111011081829.GB88076@ocelot.phlegethon.org> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: <20111011081829.GB88076@ocelot.phlegethon.org> List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xensource.com Errors-To: xen-devel-bounces@lists.xensource.com To: xen-devel@lists.xensource.com List-Id: xen-devel@lists.xenproject.org Hi Tim, I am a freshman to this member-list and interested in some contents in your reply, looking forward to your answer. :) At 2011-10-11 16:18, Tim Deegan wrote: > At 09:39 +0800 on 11 Oct (1318325957), cc Luit wrote: >> Hi, everyone, I have a question, >> in the shadow_page_fault or ept mechanism, xen will use the x86_emulation >> for some instructions, I'm wondering why it must use it, if after we fix the >> SPT or EPT table, just VMEntry to HVM to re-excute this instruction but not >> emulate in xen, is there some problems? > In the shadow pagetable code, we keep the shadows up-to-date by: > 1 - making all shadowed pagetables read-only; > 2 - intercepting the page faults when the guest writes to them; and > 3 - updating the guest pagetable and the shadow at the same time, > with whatever change the guest was making. > > For step 3 we need to emulate the instruction that caused the pagefault > so that we can tell what was being written. > > There are other reasons for the emulator to be called (emulating MMIO > instructions, emulating real-mode&c) but that's why the shadow > pagetable code uses it. 1, Does this emulator set up a emulation environment to execute instructions for a VM(guest OS)? 2, Real-mode code you talked above is used to execute the first 16-bit initial code of a guest OS? Does it have other usages in current Xen implementation? Thanks, Royo (Zhengwang) > Cheers, > > Tim. > > _______________________________________________ > Xen-devel mailing list > Xen-devel@lists.xensource.com > http://lists.xensource.com/xen-devel