bus_dmamem_alloc confusion

Chuck Tuffli chuck_tuffli at agilent.com
Fri Oct 22 09:01:51 PDT 2004


On Thu, Oct 21, 2004 at 09:50:52PM -0700, Matthew Dillon wrote:
> 
> :Exactly
> :
> :        fdM = open("/dev/mem", O_RDWR);
> :        ... 
> :        virt = mmap(0, mem.length,
> :                        PROT_READ | PROT_WRITE,
> :                        MAP_PRIVATE | MAP_ANON,
> :                        fdM,
> :                        (off_t)mem.baddr);
> :                        
> :where mem.baddr is the physical address passed back by the kernel.
> 
>     MAP_PRIVATE?  If you intend to write to the memory you definitely
>     do not want a private mapping, that will do a copy-on-write for any
>     modifications you make via the map and not actually modify the physical
>     memory you mapped.  Use MAP_SHARED.
> 
>     MAP_ANON?  That's a contradiction in terms.  This isn't anonymous
>     memory.  Don't use MAP_ANON.

You 'da man. That was the problem. I wonder why this worked on
Free/Net? Thanks again!

-- 
Chuck Tuffli
Agilent Technologies





More information about the Kernel mailing list