On Aug 11, 2008, at 8:17 AM, Marco Trillo wrote:
I have a doubt regarding dbdma.c dbdma_alloc(). It uses malloc(9) to
allocate the buffer for the DMA command descriptors:
122: dbdma_command_t *
123: dbdma_alloc(size)
124: int size;
125: {
126: u_int buf;
127:
128: buf = (u_int)malloc(size + 0x0f, M_DEVBUF, M_WAITOK);
129: buf = (buf + 0x0f) & ~0x0f;
130:
131: return (dbdma_command_t *)buf;
132: }
Since these descriptors are directly accessed by hardware, wouldn't
this cause problems if the buffer crosses a page boundary and so
it's
not contiguous in physical memory? Or does this never happen?
On macppc that's safe ( kernel virtual addresses are identical to
physical
addresses ) but on most other platforms it would likely blow up in
your
face.