Re: implementing mmap

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, Sep 22, 2009 at 9:19 PM, Andrea Gasparini <gaspa@xxxxxxxxxxx> wrote:
>> You may want to take a look at this page,
>>
>> http://www.scs.ch/~frey/linux/memorymap.html
>>
>> This also contains a sample source code, here,
>> http://www.scs.ch/~frey/linux/mmap.example.tar
>> I tried this code on ARM architecture on a swapless board which works
>> fine.
>>
>> If you could share exact code, that would be easy to debug the problem
>> you are facing.
>
> Oh, solved!! \o/
> Don't know why, but it didn't take correctly PROT_NONE flag on (userspace)
> mmap.
>

sorry, did not read this till now.....great that u have solved it.
but looking at your program, (read my previous email too), there are
still a few bugs:

a.   check this out:

http://www.linuxjournal.com/article/1287

"As we have to allocate the DMA-able buffer by kmalloc(), we have to
free it by kfree(). Linux won't allows us to do so when automatically
unmapping the user reference, but without the user reference, we don't
need the buffer any more. Therefore, we implemented a skel_malloc()
which actually allocates the driver buffer and remaps it to the user
space as well, and skel_free() which release that space and unmaps it
(after checking if a DMA-transfer is running)."

same logic as yours here.....so u have to unmap the pages before
freeing the pages.

-- 
Regards,
Peter Teoh

--
To unsubscribe from this list: send an email with
"unsubscribe kernelnewbies" to ecartis@xxxxxxxxxxxx
Please read the FAQ at http://kernelnewbies.org/FAQ


[Index of Archives]     [Newbies FAQ]     [Linux Kernel Mentors]     [Linux Kernel Development]     [IETF Annouce]     [Git]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux SCSI]     [Linux ACPI]
  Powered by Linux