Xen 
 
Home About Xen.org Xen Xen Summit Wiki Mailing List Bug Tracker Xen Downloads
 
   
 

xen-devel

Re: [Xen-devel] where is writable page table implemented?

To: "Tim Deegan" <Tim.Deegan@xxxxxxxxxx>
Subject: Re: [Xen-devel] where is writable page table implemented?
From: weiming <zephyr.zhao@xxxxxxxxx>
Date: Mon, 24 Mar 2008 14:26:02 -0400
Cc: xen-devel <xen-devel@xxxxxxxxxxxxxxxxxxx>
Delivery-date: Mon, 24 Mar 2008 11:26:28 -0700
Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=beta; h=domainkey-signature:received:received:message-id:date:from:to:subject:cc:in-reply-to:mime-version:content-type:references; bh=MvXlUd9XCmU1LBvUBDKiC/bE80a2Q8fixIV7e/8A/34=; b=k5I9A/2Ps5SnXacQbe0CkwecoJf9LJuPDlfHKdoHWQzeorMI/ETx0VnVG2zzKCFhst4QG+YRMKAL0rv9TyXZbqlbJoLNOJUdDLauNYU87moF0J5wjGJOpQvsTf1D+Pun6/XQgSx2sl76B2Xsz4DbwDeWKbYQJ+reEOAIEKQN6CY=
Domainkey-signature: a=rsa-sha1; c=nofws; d=gmail.com; s=beta; h=message-id:date:from:to:subject:cc:in-reply-to:mime-version:content-type:references; b=EjnpFCmcoFjPTaBoq3N3zh778Pvfs2IBmAm4M69qsA9qSfrfgzrtKQz6BAkx5WkyPd81FF2rJhwIzKuRbIolI2GkTVXCo0c5ZENE/ISw6hnrm2ZWNMnfTggCWnbPtO2WqGDrqHAlAu160UiNyY1geAiq7r31T15N4wZJ2hUE8b4=
Envelope-to: www-data@xxxxxxxxxxxxxxxxxx
In-reply-to: <20080324162510.GD30315@xxxxxxxxxxxxxxxxxxxxx>
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: <add59a3f0803240918m1f882115h7c2ba64e2ca2139a@xxxxxxxxxxxxxx> <20080324162510.GD30315@xxxxxxxxxxxxxxxxxxxxx>
Sender: xen-devel-bounces@xxxxxxxxxxxxxxxxxxx
Hi Tim,

Thanks a lot!

Now, I know that fixup_page_fault() -> ptwr_do_page_fault handles the write attempts to a pagetable page.

But
1) how does the guest OS tell xen which page is a pagetable page?  What if the guest doesn't do so? I assume xen should check if a pagetable had already been registered or not. But in do_mmuext_op(), there is no such check before setting the cr3.

2) in ptwr_do_page_fault(), it should disconnect the page from page directory and then mark the page as writable.  Where are they done? In x86_emulate()?

Thanks in advance!
Weiming




On Mon, Mar 24, 2008 at 12:25 PM, Tim Deegan <Tim.Deegan@xxxxxxxxxx> wrote:
At 12:18 -0400 on 24 Mar (1206361139), weiming wrote:
> Hi,
>
> I want to read the code about the implementation of writable page table. But
> I can't find it in the source codes.

xen/arch/x86/mm.c, the functions after the comment "Writable Pagetables"
(ptwr_*)

The guest is responsible for revoking write access to its own
pagetables, but that is checked by the recursive pagetable walk started
by the MMUEXT_PIN_* hypercall.

Cheers,

Tim.

--
Tim Deegan <Tim.Deegan@xxxxxxxxxx>
Principal Software Engineer, Citrix Systems (R&D) Ltd.
[Company #02300071, SL9 0DZ, UK.]

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