DragonFly BSD
DragonFly kernel List (threaded) for 2004-10
[Date Prev][Date Next]  [Thread Prev][Thread Next]  [Date Index][Thread Index]

Re: bus_dmamem_alloc confusion


From: Chuck Tuffli <chuck_tuffli@xxxxxxxxxxx>
Date: Fri, 22 Oct 2004 09:00:45 -0700

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



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