Re: virtual->physical address translation

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

 



On Sun, Jan 20, 2002 at 05:47:15PM -0800, Carl Spalletta wrote:
> 1)  How do I get a pointer to the struct page related
> to a given userpace address in the current process?
>
If you know the virtual address and the current task structure, you can 
get the pte using
pte_t *pte = get_one_pte(current->mm, virtual_addr) (see mm/mremap.c)

From pte you can get the page using
struct page *page = pte_page(*pte) 

> 2)  If that page is swapped out how do I bring it into
> memory so I can access it?

After finding the corresponding vma using find_vma(current->mm, virtual_addr),
you can load the page in using handle_mm_fault() (routine used page fault 
handler)

> 
>   I am trying to bump the reference count on that page
> so it won't go away in
> do_execve()/load_elf_binary()after the old mm is destroyed.
> 
PS:MM gurus correct if I am wrong.
Regards,
Bharata.
--
Kernelnewbies: Help each other learn about the Linux kernel.
Archive:       http://mail.nl.linux.org/kernelnewbies/
IRC Channel:   irc.openprojects.net / #kernelnewbies
Web Page:      http://www.kernelnewbies.org/


[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