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/
Home Products Support Community News


Re: [Xen-devel] xen and cr0,cr3,cr4

To: Adam Sulmicki <adam@xxxxxxxxxxxx>
Subject: Re: [Xen-devel] xen and cr0,cr3,cr4
From: Ian Pratt <Ian.Pratt@xxxxxxxxxxxx>
Date: Sun, 28 Nov 2004 22:55:34 +0000
Cc: Keir Fraser <Keir.Fraser@xxxxxxxxxxxx>, xen-devel@xxxxxxxxxxxxxxxxxxxxx, Ian.Pratt@xxxxxxxxxxxx
Delivery-date: Sun, 28 Nov 2004 22:56:35 +0000
Envelope-to: xen+James.Bulpin@xxxxxxxxxxxx
In-reply-to: Your message of "Sun, 28 Nov 2004 17:54:33 EST." <20041128173654.O19514-100000@xxxxxxxxxxxxxxxxxxxx>
List-archive: <http://sourceforge.net/mailarchive/forum.php?forum=xen-devel>
List-help: <mailto:xen-devel-request@lists.sourceforge.net?subject=help>
List-id: List for Xen developers <xen-devel.lists.sourceforge.net>
List-post: <mailto:xen-devel@lists.sourceforge.net>
List-subscribe: <https://lists.sourceforge.net/lists/listinfo/xen-devel>, <mailto:xen-devel-request@lists.sourceforge.net?subject=subscribe>
List-unsubscribe: <https://lists.sourceforge.net/lists/listinfo/xen-devel>, <mailto:xen-devel-request@lists.sourceforge.net?subject=unsubscribe>
Sender: xen-devel-admin@xxxxxxxxxxxxxxxxxxxxx
> > All accesses to control registers, whether read or write, are
> > disallowed outside ring 0. There is no way to allow such accesses so,
> > yes, they would hve to indirect thru Xen.
> >
> > You should know the value in %cr3 anyway. Why do you need to read %cr0
> > and %cr4?
> well, it just a module I have which examines the current page tables,
> settings and prints out physical and virutal memory maps.
> It currently works under plain linux and from inside of xen. Now that I
> have basic 4kb pages working (on pentium 3, with PSE enabled) it would be
> nice to have it working from inside of xenolinux too, so that I can iron
> out remaining issues with 4kb pages.
> you are right that cr0 and cr4 are not strictly necessary but nice to
> have, just to verify that things are what they appear to be.
> as for cr3, I suppose I know what it was in xen, but I just hoped not to
> assume anything. Either way can I rely on xen_start_info.pt_base ?

Nope, that's the initial page table when the machine boots.

Even if it were possible from ring 1, reading cr3 directly
wouldn't necessary give you want you want e.g. if you 're in one
of the shadow page table modes.

The easiest way to get the base within Linux is current->mm->pgd
(modulo lazy switching).


SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users.
Discover which products truly live up to the hype. Start reading now. 
Xen-devel mailing list