Re: Allocating Page Aligned Memory in User Space

From: Catalin Marinas (c_marinas_at__remove_.yahoo.com)
Date: 08/26/03


Date: Tue, 26 Aug 2003 12:54:35 +0100

Thomas Richter wrote:
>>I have a program that I'm writing to interface with a driver that
>>controls an IO board. In order to take the data from the driver and
>>DMA it to another IO device (IDE drive) I need to have the data DMA
>>page aligned. So, I'm pretty sure it can be a 32-bit address, but the
>>data needs to be on a 64k boundary along with the PRD (Physical Region
>>Descriptor) entries which will hold pointers to these data chunks.
>
>
>>Does anyone know how to allocate memory like this without having to
>>write a (kernel level) driver?
>
>
> Simple. Allocate 64K more memory as required,
> then align the returned memory address "upwards" to the next 64K boundary.

For DMA, the memory needs to be physically contiguous, user-space malloc
can't guarantee this.

Catalin



Relevant Pages