Driver porting: supporting mmap()
Driver porting: supporting mmap()
Posted Feb 21, 2005 1:38 UTC (Mon) by fleetinglife (guest, #27641)In reply to: Driver porting: supporting mmap() by fleetinglife
Parent article: Driver porting: supporting mmap()
I test this on another machine and it succeeded. It seems the 2.6.0 kernrl didn't work normally on the original machine.
But I encounter another question now.
I reserve a 4M memory at boot time. In my driver I support mmap method by calling remap_page_range() function with (TOTAL_MEMORY_SIZE - 4M) as the physical memory start address parameter.
In the driver I access the memory block with the pointer returned by ioremap(TOTAL_MEMORY_SIZE - 4M, 4M). It seems work. In App I write some data into the pointer returned by mmap, and dump the memory block in the driver, I find the output isn't the same as I wrote at App side. What's wrong with the driver?
BTW, my driver supports read/write methods, too. In them I use copy_to_user/copy_from_user. After write in App, the driver dumps the memory block, the output is correct.
How can I support mmap correctly?
Any help will be appreciated.
