Re: Virtual and physical page address

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

 



On Mon, Feb 08, 2016 at 08:57:01AM -0500, Mohammad A Khasawneh wrote:
> Thank you for your answer. Is there a way to get the virtual address by
> traversing the pgd->pte->page hierarchy?

Well, position of pte in the hierarchy defines the virtual address, so yes,
there is way. I'm not sure that a portable across different architetures way
exists though. You can look at this reference:

https://www.kernel.org/doc/gorman/html/understand/understand006.html

> I'm not sure I can use the phys_to_virt() function.

In general you can't.

> 
> Thanks,
> Mohammad
> On Feb 7, 2016 16:43, "Mike Krinkin" <krinkin.m.u@xxxxxxxxx> wrote:
> 
> > On Sun, Feb 07, 2016 at 04:24:08PM -0500, Mohammad A Khasawneh wrote:
> > > Hello everyone,
> > >
> > > I am attempting to dump the page table of a process in terms of virtual
> > > addresses and the corresponding physical addresses. I am looking for
> > > information whether the pointers I am using are correct for this purpose:
> > >
> > > 1. Can I say that pte_page(pte_t) returns the virtual address of the page
> > > that the PTE points at?
> >
> > pte_page returns struct page pointer (virtual address of the struct page,
> > but
> > i suppose it's not the virtual address you need), it has nothing to do
> > with a
> > virtual address the pte corresponds to.
> >
> > >
> > > 2. can I say that page_to_phys(struct page) returns the physical address
> > of
> > > that same entry?
> >
> > page_to_phys returns physical address the struct page corresponds to, so
> > yes.
> >
> > >
> > > Thank you,
> > > Mohammad
> >
> > > _______________________________________________
> > > Kernelnewbies mailing list
> > > Kernelnewbies@xxxxxxxxxxxxxxxxx
> > > http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies
> >
> >

_______________________________________________
Kernelnewbies mailing list
Kernelnewbies@xxxxxxxxxxxxxxxxx
http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies



[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