[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-devel] Query regarding x86_emulate_memop() function


  • To: xen-devel@xxxxxxxxxxxxxxxxxxx
  • From: Abhinav Srivastava <abhinavs_iitkgp@xxxxxxxxxxx>
  • Date: Fri, 6 Jun 2008 22:38:22 +0530 (IST)
  • Delivery-date: Fri, 06 Jun 2008 10:08:49 -0700
  • Domainkey-signature: a=rsa-sha1; q=dns; c=nofws; s=s1024; d=yahoo.co.in; h=Received:X-Mailer:Date:From:Subject:To:MIME-Version:Content-Type:Content-Transfer-Encoding:Message-ID; b=aYGvE/9oIjFwz+h4s5wI+KKUPgRcFOvFPk9+SANzttl2VekEGPbR6Ce0rA2gKMp/ibEafO/giFrDByxmsfVykUaHNVZYQXoTSUgYSiU69PHBv3kdhZjI92Yo1gHY2zs5M7Zsbduv0Vl12t0xDwWXSus5elfSoIZrZLeGyZ+wJ/I=;
  • List-id: Xen developer discussion <xen-devel.lists.xensource.com>

Hi there,

I have a question regarding the functionality of x86_emulate_memop (Xen 3.1) or 
x86_emulate (Xen 3.2) function. This function gets called from sh_page_fault() 
function which is invoked when Xen receives a page fault.

Since I am not clear completely about the emulation operation performed by Xen, 
I have following questions with a below mentioned scenario?

1) Suppose I have a memory location that I need to protect it from being 
written by a guest OS. Since a page table protection works at a page level, we 
have to mark that complete page read-only inside the shadow page table. So, 
whenever a guest tries to write on that page, writes are propagated to shadow 
page table. Due to read only page this would create a page-fault and 
sh_page_fault code would be invoked. In the sh_page_fault code, we can check 
whether on this page the memory location which is being written (using CR2 
register) is protected or not. If not, my goal is to let this operation go 
through. And, I heard here this emulation thing comes into the picture.

After checking and deciding this operation should go through, i call "goto 
emulate" from sh_page_fault code assuming it would emulate that operation and 
update the eip to the next instruction.

Question: Is this understanding correct? The reason why I am asking is that 
since page is write-protected, it means while emulating it should again fault. 
Then, how does this emulation work? And, what is the use of this function? In 
what context it should be used and in what context it is invoked from 
sh_page_fault().

And, if I have to achieve above-mentioned (scenario) functionality which part 
of the code I should lookinto/change to achieve that.

I would really appreciate if some could explain me this.

Thanks,
Abhinav




      Bring your gang together. Do your thing. Find your favourite Yahoo! group 
at http://in.promos.yahoo.com/groups/

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


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.