Greetings, On Mon, Apr 16, 2007 at 01:48:24AM +0700, Mulyadi Santosa wrote: > > I have allocated some pages with multiple calls to __get_free_pages(), > > and added them to a vm area with calls to vm_insert_page(). > > > > The question is: given an arbitrary kernel address contained by one of > > the pages, does Linux expose an API to translate that address to the > > userland address (vm area address)? > > AFAIK, check find_vma(), defined in include/linux/mm.h I can see that I have not been as clear as I could have been. Firstly I think it's called logical address, not virtual address, when allocated with __get_free_pages(), so I will start using that term instead. The problem is not finding the struct vm_area_struct * -- I can have that conveniently stored in private data. The problem is that I have allocated N non-consecutive pages, and added them to a mmap ranging from A to B of size N * PAGE_SIZE. My problem is that I have a logical address contained by one of the pages, and I need to find the corresponding userland address (ranging from A and B). Let's say the user read address USERADDR, which the memory map translates to LOGICADDR. What I want is the reverse translation, in kernel space, so I can printk it or copy it to userspace on ioctl or something similar. I hope this is clearer, if not feel free to ask, and I will elaborate the best I can. Sincerely, Thomas -- To unsubscribe from this list: send an email with "unsubscribe kernelnewbies" to ecartis@xxxxxxxxxxxx Please read the FAQ at http://kernelnewbies.org/FAQ