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 17:23:08 +0200
Cc: "xen-devel@xxxxxxxxxxxxxxxxxxx" <xen-devel@xxxxxxxxxxxxxxxxxxx>
Delivery-date: Thu, 03 Jun 2010 08:24:24 -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=AMFi5cxyLZhHoC3Btq745+I3lkQ7DRUVOdgdBSZyVWg=; b=ds9misVfJbcyJZRFnQ4Hv4dS3IWvNsfxLaZnzAEWomAi4NjJ9WByB6Zr7fKO9kqVxT ZF3LWmsuVEraJdlQY1bCp8acWUeWsgXpIw0DYAgXohtS4OKYUsrVU32t2q+f3Pw5ksZl l5zdbywN4kU3m3IPoHO34g3wCKAAEWXFVPIbY=
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=RybWchPpP4+bXwQbuTAuDwCgiI+hD8d/UVm8ZSelz6f/VgX4mbOc3h1nKh1BeD3ZkV jKWolr3hDNVypnPW+SP4m/WFLDsD3Yx9cmquqY69cgW5VmxousCG5mqLZTzfKLiT75mT GtLDrUnwo/gaO0g4Yo+S8UoC0vbZ8PzG5LiBs=
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
In-reply-to: <C82D6CBE.169A1%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: <AANLkTim04Uva2LfOPP8MKN1OBbYE7XbMjw-zifD2esae@xxxxxxxxxxxxxx> <C82D6CBE.169A1%keir.fraser@xxxxxxxxxxxxx>
Sender: xen-devel-bounces@xxxxxxxxxxxxxxxxxxx
On Thu, Jun 3, 2010 at 3:29 PM, Keir Fraser <keir.fraser@xxxxxxxxxxxxx> wrote:
>
>
>
> On 03/06/2010 14:16, "Sylvestre Gallon" <syl@xxxxxxxxx> wrote:
>
>> 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 ?
>
> This is closer, but page table entries will be 64 bits not 32 bits (hence
> use uint64_t). And also the page tables will have three or four levels
> (depending on whether your guest is 32-bit PAE or 64-bit). So in the 64-bit
> case for example, you would read cr3 to get pagedir_1, then index into
> pagedir_1 to get pagedir_2, then index into pagedir_2 to get pagedir_3, then
> index into pagedir_3 to get the pagetable. And mmu.ptr would point at an
> entry in that pagetable.
>

OK , I see.

I still have a question, does I need to compile my kernel with -m64 ?

If not how can I use 64bits addresses ?

Thanks for your help.

Cheers,
-- 
Sylvestre Gallon

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

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