[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

RE: [Xen-devel] Remapping memory in a HVM DomU from one pfn to another?


  • To: "Keir Fraser" <keir.fraser@xxxxxxxxxxxxx>, <xen-devel@xxxxxxxxxxxxxxxxxxx>
  • From: "James Harper" <james.harper@xxxxxxxxxxxxxxxx>
  • Date: Tue, 10 Jun 2008 17:18:25 +1000
  • Delivery-date: Tue, 10 Jun 2008 00:18:49 -0700
  • List-id: Xen developer discussion <xen-devel.lists.xensource.com>
  • Thread-index: AcjKL7zJukTKL6OfRRmjF/we8x04QQAAqW7tACV2VdA=
  • Thread-topic: [Xen-devel] Remapping memory in a HVM DomU from one pfn to another?

> > I think I need to do the following:
> >
> > 1. Allocate a page of memory from the 'non-paged pool'
> > 2. Get the pfn of the memory I allocated (src pfn), and the pfn of
where
> > I want to remap the memory to (dst pfn)
> > 3. Get the mfn(?) of the memory currently mapped to the src pfn
> > 4. Tell Xen to remap the mfn to the dst pfn
> >
> > Can this be done? Any tips on the calls I need to make to do it?
>From a
> > quick look through the include files it kind of looks like I could
use
> > XENMEM_translate_gpfn_list to get the mfn from the pfn, but I don't
know
> > if that does what I want to do and I don't know where to go from
> > there... any suggestions?
> 
> XENMEM_exchange. Look at 'struct xen_memory_exchange' in
> xen/include/public/memory.h. Note that GMFN means PFN for an HVM
guest.
> Hopefully it is all self-explanatory enough.
> 

Almost self-explanatory...

How do I use a 'XEN_GUEST_HANDLE(xen_pfn_t)'? 

Given the structure:

"
struct xen_memory_reservation {
    XEN_GUEST_HANDLE(xen_pfn_t) extent_start;
}
"

Do I say something like:

"
struct xen_memory_reservation xmr;
ULONG pfn;

pfn = get_pfn_from_somewhere();
set_xen_guest_handle(xmr.extent_start, pfn);
"

If I just want to swap one page, then am I right in saying that
nr_extents = 1 and extent_order = 0?

I guess I'll give it a go tonight... the worst it can do is not work :)

Thanks

James


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


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.