Hi Robert,
However, vmlist is not exported, and I would expect that there is a helper function somewhere for traversing vmlist, but I can't find anything.
Probably you can consider splitting CMEM in a always-bult-in and built-in-or-module part?
For user-to-phys address translation, I use mm/memory.c:follow_page() and the following function. It works for vmalloc-allocated addresses also.
* expensive address translation */ void *my_uvirt_to_phys(void *addr) { unsigned long kva, ret; unsigned long flags; struct page *pg; spin_lock_irqsave(¤t->mm->page_table_lock,flags); pg = follow_page(current->mm, (unsigned long)addr, 1); if (!pg) { spin_unlock_irqrestore(¤t->mm->page_table_lock,flags); return 0; } kva = (unsigned long)page_address(pg); kva |= (unsigned long)addr & (PAGE_SIZE-1); /* restore the offset */ ret = __pa(kva); spin_unlock_irqrestore(¤t->mm->page_table_lock,flags); return (void *)ret; }
Ivan
_______________________________________________ Davinci-linux-open-source mailing list [email protected] http://linux.davincidsp.com/mailman/listinfo/davinci-linux-open-source
