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: Matthew Dillon <dillon@xxxxxxxxxxxxxxxxxxxx>
Date: Fri, 22 Oct 2004 10:53:31 -0700 (PDT)

:
: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

    It shouldn't have worked on FreeBSD either but it is probably just sloppy 
    flags handling on the other OSs.

					-Matt
					Matthew Dillon 
					<dillon@xxxxxxxxxxxxx>



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