Re: virtual address to vma address

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

 



Hi

On Tue, Apr 17, 2007 at 06:06:53PM +0530, Vivek Kutal wrote:
> On Sun, 2007-04-15 at 14:29 +0200, Thomas Christensen wrote:
> I Dont know if there is a direct api for this....
> but you can get it using the following logic (very long search :)).
> 
> get the page frame no by --> kernel address >> PAGE_SHIFT 
> get the struct page using   -> mem_map + page frame no
> 
> struct page->mapping->i_mmap will give you a linked list of
> vm_area_struct
> 
> now for each vma
> 
> ->mm->pdg will give you the pgd base
> 
> now for each pte entry in the page table
> 
> if (pte >> page_shift == kernel_address >> page_shift) {
> get virtual address for that particular pgd and pte entry(address
> translation logic).
> }
> 
> 
> can someone please verify this ?
> 
> 
> OR 
> a simpler solution would be to maintain the list of user address of that
> page when you call vm_insert_page :).

This may be the best way :)

> 
> 
> 
> ps: there are macros for some of the above steps. 

Thanks for the info, it has given me good insight into the gory details
of the kernel.

		Thomas

--
To unsubscribe from this list: send an email with
"unsubscribe kernelnewbies" to ecartis@xxxxxxxxxxxx
Please read the FAQ at http://kernelnewbies.org/FAQ


[Index of Archives]     [Newbies FAQ]     [Linux Kernel Mentors]     [Linux Kernel Development]     [IETF Annouce]     [Git]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux SCSI]     [Linux ACPI]
  Powered by Linux