Skip to contentSkip to conversation

How to convert from virtual to machine address (any macros?)

DISCUSSION Joana M. F. Trindade 1 participant 1 message Feb 24, 2009

lore
Share & tools
lore
#0 lore raw

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

Signature · 7 lines
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
[email protected]
http://lists.xensource.com/xen-devel