Re: How to convert virtual address to physical address and revers e?

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

 



Hi Tsai,
     I am sorry. I didn't know that you were talking about 2.4.x .
What ever I said about rmap (reverse map) is valid only for 2.6.x
Version.

I am not sure about 2.4.x Version. As far as I know the void *virtual
is for HIGMEM support. In 2.4.x I think the only way to find out all
the virtual address mappings for a given physical address is to
traverse the page tables. That was the main reason why the reverse map
feature was introduced in 2.6.

Rgds,
Raj.


On Wed, 30 Mar 2005 18:28:37 +0800, P.F. Tsai <yeltek@xxxxxxxxx> wrote:
> hi Raj,
> 
> as u said, I can have a pfn by
> 
> pfn = pa >> PAGE_SHIFT;
> 
> and then I move a page pointer to the address of corresponding node_mem_map
> by calling pfn_to_page like following:
> 
> page *mypage;
> mypage = pfn_to_page(pfn);
> 
> but I can't access the "virtual" filed, cuz it is defined in inside a
> #if  -  #endit section (in 2.6.7 kernel)
> 
> #if defined(WANT_PAGE_VIRTUAL)
>  void *virtual;   /* Kernel virtual address (NULL if not kmapped, ie.
> highmem) */
> #endif /* WANT_PAGE_VIRTUAL */
> 
> for 2.4.x
> 
>  #if defined(CONFIG_HIGHMEM) || defined(WANT_PAGE_VIRTUAL)
>  void *virtual;
>  #endif /* CONFIG_HIGMEM || WANT_PAGE_VIRTUAL */
> 
> does it mean that the virtual-field is activated (and can be asscessed) if
> and only if the HIGHMEN configured and starts to allocate memory
> dynamically?
> 
> 
> > Again as far as I know, to access the virtual address for a given
> > physical address, you need to access the rmap structure in the struct
> > page. This how you can do it,
> >
> > physical address >> PAGE_SHIFT , this gives you the pfn
> >
> > node_mem_map + pfn gives the struct page pointer value.
> >
> > Acess the rmap structure in the page structure. This is a list of all
> > the virtual addresses where this page is mapped.
> >
> > Please correct me if I am wrong.
> >
> > --------------
> > Raj.
> >
> 
> --
> Kernelnewbies: Help each other learn about the Linux kernel.
> Archive:       http://mail.nl.linux.org/kernelnewbies/
> FAQ:           http://kernelnewbies.org/faq/
> 
>

--
Kernelnewbies: Help each other learn about the Linux kernel.
Archive:       http://mail.nl.linux.org/kernelnewbies/
FAQ:           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