Now my app tries to read the shared memory and gets a bus error. This is on
a MIPS (4k, I believe) embedded box. Is there something else I still need to
do? Is there alignment restrictions - I need to overlay a C structure on
this? Any suggestions? Thanx in advance.
RM
> Now my app tries to read the shared memory and gets a bus error.
Can mmap be done from user space ? Seems not very logical to me.
Regarding you already wrote a device driver, why don't you provide the
mapping function for the application, there, too, using some kind of
handle you give the applications to identify pages, hiding the hardware
addresses from user space (where they shouldn't be seen IMHO). This will
improve the portability of your solution, too.
-Michael
Why are you using get_free_pages directly? There are other APIs in the
kernel which you can use to do the same thing without as much hassle (th
e pci_pool* api, and the consistent_alloc function come immediately to
mind). You may want to look into those, before you go figuring out why
using __get_free_pages isn't working properly.
Also, if your only purpose is to share memory between a driver and your
application, you may want to re-consider your contiguous page
requirement. If you don't really need contiguous pages, you can just as
easily use kmalloc in your driver, and memory map the range by calling
mmap using a file descriptor open on /dev/kmem rather than /dev/mem
HTH
Neil