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

[Xen-devel] How to convert from virtual to machine address (any macros?)


  • To: xen-devel@xxxxxxxxxxxxxxxxxxx
  • From: "Joana M. F. Trindade" <jmftrindade@xxxxxxxxx>
  • Date: Mon, 23 Feb 2009 20:34:44 -0600
  • Delivery-date: Mon, 23 Feb 2009 18:35:10 -0800
  • Domainkey-signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:date:message-id:subject:from:to:content-type; b=XJQU93TUKBhvyCKEPfm5fPWIT5DrGO19HEVMJ9/eMoNTzDTzlX7VVVykf8WeMtVlJx 34PbWrGeSHkp1hhGOQdD9RETCrPF5l44Ug4Px/hQO6Ep1pwXHX7R5nlko+/7SFbmLZaj fqSvtDZm5v4C6NnH3S4NXPH2U+BGY3ffhKoDg=
  • List-id: Xen developer discussion <xen-devel.lists.xensource.com>

Hi,

I browsed the archives, but could not find an example on this. What are the macros for converting a virtual address to machine address on Xen in x86 architectures?

For example, on a non-virtualized dom0, the following code works:

static int virt_to_phys (struct task_struct *p, unsigned long addr) {
   // (...)
   ret = get_user_pages (p, p->mm, addr, 1, 1, 1, &page, &vma);
   if (ret <= 0) {
      // do something
   }
   offset = addr & (PAGE_SIZE - 1);
   maddr = kmap (page);
   return (int) maddr + offset;
}

However, this mapping seems incorrect on the same dom0 on top of Xen. Therefore, I would like to know if there's an example (or pointers to macros) on how to do the virtual->pseudo-physical->machine address mapping on Xen.

Thanks and regards,
Joana

--
Joana M. F. da Trindade
Visiting Scholar
Center for Reliable and High-Performance Computing
University of Illinois at Urbana-Champaign

Personal Homepage: http://joanatrindade.wikidot.com
LinkedIn: http://www.linkedin.com/in/joanatrindade
_______________________________________________
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®.