From mboxrd@z Thu Jan 1 00:00:00 1970 From: Keir Fraser Subject: Re: Can't map the page referenced by HVM-DomU CR3 in Dom0 Date: Tue, 19 Apr 2011 23:14:15 +0100 Message-ID: References: <4DAE056C.30108@gmx.at> Mime-Version: 1.0 Content-Type: text/plain; charset="US-ASCII" Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: <4DAE056C.30108@gmx.at> List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xensource.com Errors-To: xen-devel-bounces@lists.xensource.com To: david Cc: xen-devel@lists.xensource.com List-Id: xen-devel@lists.xenproject.org On 19/04/2011 22:58, "david" wrote: >> xc_translate_foreign_address() will convert a guest virtual address into a >> guest physical address. It's not working out for you because guest cr3 >> values are already guest physical addresses. Thus the virtual-to-physical >> conversion you subject the values to is meaningless. > > ahhh, .. I see. I thought the translation is between guest physical and > real physical address. The toolstack deals entirely with guest physical addresses for HVM guests. There's actually no way, and no need, to find out the underlying real physical addresses. > The way to calculate the correct physical frame > number is cr3 >> PAGE_SHIFT corresponding to xen_cr3_to_pfn(cr3) in > public/arch-x86/xen-x86_64.h, right? Yes, although strictly speaking the xen_cr3_to_pfn() macro is intended to be used only with PV guests' cr3 values (the x86_32 version of that macro is not suitable for use with HVM cr3 values). Consider an HVM guest in 32-bit PAE mode -- its CR3 value may not be page aligned. -- Keir