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] Problem setting up a custom GDT

To: Mathieu Ropert <mro@xxxxxxxxxx>
Subject: Re: [Xen-devel] Problem setting up a custom GDT
From: Simon Kagstrom <simon.kagstrom@xxxxxx>
Date: Mon, 12 Jun 2006 08:19:31 +0200
Cc: xen-devel list <xen-devel@xxxxxxxxxxxxxxxxxxx>
Delivery-date: Sun, 11 Jun 2006 23:18:51 -0700
Envelope-to: www-data@xxxxxxxxxxxxxxxxxx
In-reply-to: <44895656.8040905@xxxxxxxxxx>
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/cgi-bin/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=unsubscribe>
References: <8764jalhgb.wl%simon.kagstrom@xxxxxx> <44895656.8040905@xxxxxxxxxx>
Sender: xen-devel-bounces@xxxxxxxxxxxxxxxxxxx
User-agent: Wanderlust/2.15.2 (Almost Unreal) SEMI/1.14.6 (Maruoka) FLIM/1.14.8 (Shijō) APEL/10.6 Emacs/21.4 (i486-pc-linux-gnu) MULE/5.0 (SAKAKI)
At Fri, 09 Jun 2006 13:07:02 +0200,
Mathieu Ropert wrote:
> 
> Simon Kagstrom wrote:
> 
> >Hello!
> >
> >I have some problems setting up a custom GDT (I need one where the
> >code is readable). Anyway, I try to switch to my own GDT as follows:
> >
> >   unsigned long frames[16];
> >
> >   volatile unsigned long va = (unsigned long)GDT;
> >   volatile unsigned long pa = to_phys(va);
> >   volatile unsigned long ma = phys_to_machine(pa) & ~_PAGE_RW  | 
> > _PAGE_PRESENT | _PAGE_ACCESSED | _PAGE_DIRTY;
> >
> >   /* Make it read-only */
> >   HYPERVISOR_update_va_mapping(va, (pte_t){ ma }, 0);
> >   frames[0] = ma;
>
> The machine address you pass to Xen is a page table entry. Xen want a 
> machine frame number.
> 
> frames[0] = ma >> PAGE_SHIFT;
> 
> should fix you problem.

Ah, thank you! This fixed the problem!

I see now that Linux uses virt_to_mfn() - I should have looked at that
one...

// Simon

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

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