From mboxrd@z Thu Jan 1 00:00:00 1970 From: Sylvestre Gallon Subject: Re: How works Xen mmu ? Date: Thu, 3 Jun 2010 15:16:29 +0200 Message-ID: References: Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Return-path: In-Reply-To: List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xensource.com Errors-To: xen-devel-bounces@lists.xensource.com To: Keir Fraser Cc: "xen-devel@lists.xensource.com" List-Id: xen-devel@lists.xenproject.org On Wed, Jun 2, 2010 at 10:07 PM, Keir Fraser wr= ote: > On 18/05/2010 09:01, "Sylvestre Gallon" wrote: > >> My need is to simply perform an identity mapping at 0xb8000 to allow >> my operating system to access the vga frammebuffer. So my first idea >> was to use HYPERVISOR_mmu_update like this : >> >> mmu_update_t mmu; >> uint8_t *buf =3D (uint8_t *) 0xb8000; >> >> mmu.ptr =3D 0xb8000 | MMU_MACHPHYS_UPDATE >> mmu.val =3D 0xb8000 >> HYPERVISOR_mmu_update(&mmu, 1, NULL, DOMID_SELF); > > You need to use MMU_NORMAL_PT_UPDATE command, passing a pointer to a pte > (pagetable entry) in mmu.ptr and the value to write to that pte in mmu.va= l. > > =A0-- Keir > Thanks for you response. If I understand I need to do something like that : mmu_update_t mmu; addr =3D get_cr3(); // getting page directory addr &=3D 0xfffff000; // remove pdir flags addr =3D ((uint32_t*) addr_[0]; // get address of first page dir (0xb8000 is in the first pdir) addr +=3D 0xb8 * 4; // 0xb8000 must be the pte 0xb8 into= pdir 0 mmu.ptr =3D pte | MMU_NORMAL_PT_UPDATE; mmu.val =3D 0xb8000 | 0x3; // 0x3 for pte present and rw flags HYPERVISOR_mmu_update(&mmu, 1, NULL, DOMID_SELF); while(42); But when I try this code I get an unhandled page fault :/ Do I have misunderstood something ? Thanks a lot for your time, Cheers, --=20 Sylvestre Gallon