question on memory mapping one page at a time
Sri Ram Vemulpali
sri.ram.gmu06 at gmail.com
Tue Sep 20 14:23:32 EDT 2011
Hi all,
can anyone please explain the following code, what it is doing. I want
the first few statements of the code, as they are calculating page
frame number. This is little confusing, thanks in advance.
struct page *simple_vma_nopage(struct vm_area_struct *vma,
unsigned long address, int *type)
{
struct page *pageptr;
unsigned long offset = vma->vm_pgoff << PAGE_SHIFT;
unsigned long physaddr = address - vma->vm_start + offset;
unsigned long pageframe = physaddr >> PAGE_SHIFT;
if (!pfn_valid(pageframe))
return NOPAGE_SIGBUS;
pageptr = pfn_to_page(pageframe);
get_page(pageptr);
if (type)
*type = VM_FAULT_MINOR;
return pageptr;
}
--
Regards,
Sri.
More information about the Kernelnewbies
mailing list