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] Manual differ from source code about Unrestricted Guest

To: confucius <henanwxr@xxxxxxxxxxx>
Subject: Re: [Xen-devel] Manual differ from source code about Unrestricted Guest
From: Ian Campbell <Ian.Campbell@xxxxxxxxxx>
Date: Tue, 7 Jun 2011 17:19:58 +0100
Cc: "xen-devel@xxxxxxxxxxxxxxxxxxx" <xen-devel@xxxxxxxxxxxxxxxxxxx>
Delivery-date: Tue, 07 Jun 2011 09:20:29 -0700
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
In-reply-to: <1307461264749-4462113.post@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>
Organization: Citrix Systems, Inc.
References: <1307461264749-4462113.post@xxxxxxxxxxxxx>
Sender: xen-devel-bounces@xxxxxxxxxxxxxxxxxxx
On Tue, 2011-06-07 at 16:41 +0100, confucius wrote:
> As italics show:
> Some processors allow guest software to run in unpaged protected mode or in
> real-address
> mode, such guest called “unrestricted guest”.
> If CR0.PG = 0, each linear address is passed directly to the EPT mechanism
> for translation to a physical address.”
> References to Intel® 64 and IA-32 Architectures Software Developer’s Manual
> Volume 3B:System Programming Guide, Part 2  22.8 UNRESTRICTED GUESTS
> When we set CR0.PG=0 of a guest, I think it doesn’t need construct a page
> table for the unpaged guest, but I found it construct an identify_map table
> for unpaged guest in the source codes of xen. As follow: 
> Xen-4.0/tools/libxc/xc_hvm_build.c 
> setup_guest()
> {
> …………………
> /*
>      * Identity-map page table is required for running with CR0.PG=0 when
>      * using Intel EPT. Create a 32-bit non-PAE page directory of
> superpages.
>      */
>     if ( (ident_pt = xc_map_foreign_range(
>               xc_handle, dom, PAGE_SIZE, PROT_READ | PROT_WRITE,
>               special_pfn(SPECIALPAGE_IDENT_PT))) == NULL )
>         goto error_out;
>     for ( i = 0; i < PAGE_SIZE / sizeof(*ident_pt); i++ )
>         ident_pt[i] = ((i << 22) | _PAGE_PRESENT | _PAGE_RW | _PAGE_USER |
>                        _PAGE_ACCESSED | _PAGE_DIRTY | _PAGE_PSE);
>     munmap(ident_pt, PAGE_SIZE);
> …………………
> }
> Why construct such identity map table for unpaged guest?

AIUI although the guest is in unpaged mode the _host_ is not and
therefore a pagetable is required from somewhere. Since the guest thinks
it is in unpaged mode it isn't going to provide one and therefore the
hypervisor must provide them.

> In my opinion, guset_cr3 doesn’t function when set CR0.PG=0, can guest_cr3
> of this unpaged guest point to identity map table?

I don't think so -- the use of this identity map table is transparent to
the guest. The identity map is just part of the business of providing
the illusion of unpaged mode to the guest.


> --
> View this message in context: 
> http://xen.1045712.n5.nabble.com/Manual-differ-from-source-code-about-Unrestricted-Guest-tp4462113p4462113.html
> Sent from the Xen - Dev mailing list archive at Nabble.com.
> _______________________________________________
> Xen-devel mailing list
> Xen-devel@xxxxxxxxxxxxxxxxxxx
> http://lists.xensource.com/xen-devel

Xen-devel mailing list