Andrea Gasparini wrote, Friday, September 23, 2011:
> Hi,
> I'm having some problem understanding how mmap really works, I'm on a
> DM365, with a 2.6.32 kernel.
> 
> I have a (dummy) driver that allocate some memory (4k), and gives it to
> a userspace through mmap() - the usual remap_pfn_range found in every
> example.
> i.e. using this:
>     if (remap_pfn_range(vma, vma->vm_start,
>                     virt_to_phys(buffer) >> PAGE_SHIFT,
>                     vma->vm_end - vma->vm_start,
>                     vma->vm_page_prot)){
>         printk("remap returned something wrong\n");
>         return -EAGAIN;
> 
> The userspace can read the memory correctly, but can't write to it.
> (though it maps with PROT_WRITE)
> As the manpage says: PROT_WRITE - Pages may be written.
> 
> I'm attaching both the driver and the userspace testbed, with the hope
> someone tells me what's wrong with this.

Ok, if opened with O_RDWR (and not read-only) and mapped with MAP_SHARED it 
works ... 

sorry fror the silly question :)
Bye.
-- 
Andrea Gasparini 
---- ImaVis S.r.l. ----
web: www.imavis.com
_______________________________________________
Davinci-linux-open-source mailing list
[email protected]
http://linux.davincidsp.com/mailman/listinfo/davinci-linux-open-source

Reply via email to