bus_dmamem_alloc confusion
Matthew Dillon
dillon at apollo.backplane.com
Fri Oct 22 10:54:58 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
It shouldn't have worked on FreeBSD either but it is probably just sloppy
flags handling on the other OSs.
-Matt
Matthew Dillon
<dillon at xxxxxxxxxxxxx>
More information about the Kernel
mailing list