If I use only 4K (Page Size) of memory, then it does not happen. Is there
any restriction or any other way to access them?
struct page *
sample_vma_nopage(struct vm_area_struct *vma,unsigned long address, int
write)
{
unsigned long offset;
unsigned long physaddr;
struct page *page = NOPAGE_SIGBUS;
/* Compute the offset */
offset = (address - vma->vm_start) + VMA_OFFSET(vma);
/* Get the page in the 2MB buffer where the offset begins */
physaddr = MyBuffer +offset;
page = virt_to_page(__va(physaddr));
/* Increment the count */
get_page(page);
return page;
}
struct
vm_operations_struct sample_vm_ops =
{
open : sample_vma_open,
close : sample_vma_close,
nopage : sample_vma_nopage,
};
int
videocap_mmap(struct file *filp, struct vm_area_struct *vma)
{
/* Check if the offsets are aligned */
if (VMA_OFFSET(vma) & (PAGE_SIZE-1))
{
TRACE_ERROR("mmap() received unaligned offsets. Cannot map \n");
return -ENXIO;
}
vma->vm_flags |= VM_RESERVED;
vma->vm_private_data = NULL;
vma->vm_ops = &sample_vm_ops;
sample_vma_open(vma);
return 0;
}
Any help will be appreciated
Regards
Samvinesh Christopher
P.S: Iam not in the mailing list. So please CC to me @ vineshc@ami.com
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/