WARNING - OLD ARCHIVES

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

xen-devel

Re: [Xen-devel] How works Xen mmu ?

To: Keir Fraser <keir.fraser@xxxxxxxxxxxxx>
Subject: Re: [Xen-devel] How works Xen mmu ?
From: Sylvestre Gallon <syl@xxxxxxxxx>
Date: Thu, 3 Jun 2010 15:16:29 +0200
Cc: "xen-devel@xxxxxxxxxxxxxxxxxxx" <xen-devel@xxxxxxxxxxxxxxxxxxx>
Delivery-date: Thu, 03 Jun 2010 06:28:42 -0700
Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:mime-version:sender:received :in-reply-to:references:from:date:x-google-sender-auth:message-id :subject:to:cc:content-type:content-transfer-encoding; bh=GEPpsYBFS9BsCFd+EnMOrL/Yr6UGu5Dvr5GsPc7nISA=; b=LiRofLd5DJhoEQI5EKlMcqR9JayvgKztATQBQYt+z+1KzuDoeuGZU0sDz/5U4cm+kV 63oRGh/eXTmVOt213FqxceYcQcMAOTj0gN3211ma2Ug2TCnGM9701w254Q8UUr3isAP0 cyQMA7nUxP6q0wY3Vm1Bl6xC/+4IDTVleGgSY=
Domainkey-signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:sender:in-reply-to:references:from:date :x-google-sender-auth:message-id:subject:to:cc:content-type :content-transfer-encoding; b=K8lhgOcUmRgPO6UyrV2ZjiKbSpF2TqJU5VN2zNVgDPQP98OymQ9mukzO1HfRu+up7P /Z2phX8hA0xSDPGoPnLVunAsCm/8hM5j8JSYDemxdOLF+judKt0JuTNTUu2h/ax4ffK1 2CAj0d2BA9Esk24AcSYympTTloDtRBRIwpaGo=
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
In-reply-to: <C82C7886.16838%keir.fraser@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>
References: <AANLkTin-_SRSmKm6Y_Tb25ueouqzb3sPrQtnuA_seqOT@xxxxxxxxxxxxxx> <C82C7886.16838%keir.fraser@xxxxxxxxxxxxx>
Sender: xen-devel-bounces@xxxxxxxxxxxxxxxxxxx
On Wed, Jun 2, 2010 at 10:07 PM, Keir Fraser <keir.fraser@xxxxxxxxxxxxx> wrote:
> On 18/05/2010 09:01, "Sylvestre Gallon" <syl@xxxxxxxxx> 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 = (uint8_t *) 0xb8000;
>>
>> mmu.ptr = 0xb8000 | MMU_MACHPHYS_UPDATE
>> mmu.val = 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.val.
>
>  -- Keir
>

Thanks for you response.

If I understand I need to do something like that :

mmu_update_t mmu;

addr = get_cr3();                     // getting page directory
addr &= 0xfffff000;                   // remove pdir flags
addr = ((uint32_t*) addr_[0];     // get address of first page dir
(0xb8000 is in the first pdir)
addr += 0xb8 * 4;                    // 0xb8000 must be the pte 0xb8 into pdir 0

mmu.ptr = pte | MMU_NORMAL_PT_UPDATE;
mmu.val = 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,

-- 
Sylvestre Gallon

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

<Prev in Thread] Current Thread [Next in Thread>