From: alain v. <av...@ya...> - 2003-05-14 12:15:28
|
Hello guys, well actually I don't know if the problem comes from SH3 or not but I thought it's a good idea to ask you. I got problems while using remap_page_range with mmap/nopage handler. Let me try to describe you what I'm trying to achieve. I got a custom video card which has his video memory paged (need to set video card registers in order to get an area of this memory directly accessible to the SH3 from address 0xa8000000). Since I need to make this memory accessible (in a linear way .. sorry I forgot to tell you that it's a framebuffer driver) from userland, I was trying to achieve that by using nopage handler with remap_page_range function. My nopage function looks like this: struct page* my_nopage(struct vm_area_struct *vma, unsigned long address, int no_share) { pgd_t *pgd; pmd_t *pmd; pte_t *pte; unsigned long phys_add; /* Set register of the video card to make an area of the video memory accessible from the SH3 */ { .... } /* Calculate the physical memory address */ phys_add = {.....} /* FIXME ... is it useful in something ??? */ /* Pages shouldn't be cached */ vma->vm_page_prot = pgprot_noncached(vma->vm_page_prot); remap_page_range(address & PAGE_MASK, phys_add, PAGE_SIZE, vma->vm_page_prot); pgd = pgd_offset(current->mm, address); pmd = pmd_offset(pgd, address); pte = pte_offset(pmd, address); return pte_page(*pte); } The mmap function doesn't do actually to many things except set the nopage handler. Everything is done in the nopage handler. From user space, when I mmap the framebuffer, I can access to the video memory ...... ONCE. I mean, the mmap function will return a pointer, using this pointer I'll be able to read/write into the video memory. For example I can set all bytes of the video memory from 0 the end once (lot of nopage handler will be called) but then if I try to set once again, the nopage handler will never be called again. Well, once again, I don't know if it's a problem due to the SH or just some misunderstanding on the way to use remap_page_range; I was hoping someone could confirm this to me, and hopefully tell me what is wrong. I hope it's not too difficult to understand my saying. Sincerely, Alain Volmat __________________________________ Do you Yahoo!? The New Yahoo! Search - Faster. Easier. Bingo. http://search.yahoo.com |