Not that I didn't read, I had a simple bug in my code :( (checked if the returned pointer is smaller then zero, forgetting that pointers are unsigned).
In any case, I've read the discussion that Muli pointed to. First - it is about 2.6.x kernel and I use 2.4.21.
Any way, most seems similar to the the 2.4.x kernels.
I've fixed the bug, and now I get the mapping with MAP_SHARED working, but still, I have problem accessing the memory (it hangs the card).
I have some questions that might be the problem:
1. I didn't find anything about PageReserved(). Before I call the remap_page_range function, I set:
vma->vm_flags = VM_RESERVED;
is this the same?
2. I've tried to implement the nopage method, but got the exact same results (board hangs).
Do I need to call anything else before I can access the RAM at this address? Do I need to do ioremap (as I do before I can access the CPU's configurations)? and then, pass the resulted address to the remap_page_range function as the address?
3, Is the way I'm trying to work, implementing mmap to give the user's application access to specific range of RAM the right way, or there is a better (or more correct) way to handle this?
Sorry for the basic questions (and for the bug that caused me to sent the last reply).
Thanks, Ilan
on 01/31/05 11:55 Gilad Ben-Yossef said the following:
Ilan Finci wrote:
Thanks all for the help.
I've tried before to replace the MAP_PRIVATE to MAP_SHARED, but then the memory is mapped to 0xffffffff, and accessing the memory address later fails with segmentation fault (since when I add 0x24, it yields a pointer to 0x00000023)
Using the nopage operation, go me to no better results.
Then you haven't boterhed to read the mmap man page:
"RETURN VALUE On success, mmap returns a pointer to the mapped area. On error, MAP_FAILED (-1) is returned, and errno is set appropriately. On suc- cess, munmap returns 0, on failure -1, and errno is set (probably to EINVAL).:
In short the memory is *not* mapoped to 0xfffffff. You are getting an error condition (-1) which you failed to check in your code.
I'm willing to bet that you don't have the pages you're trying to access reserved with PageReserved() as Muli pointed out before.
Gilad
================================================================= To unsubscribe, send mail to [EMAIL PROTECTED] with the word "unsubscribe" in the message body, e.g., run the command echo unsubscribe | mail [EMAIL PROTECTED]
