Re: Allocating Page Aligned Memory in User Space

From: David Schwartz (davids_at_webmaster.com)
Date: 08/28/03


Date: Wed, 27 Aug 2003 15:22:51 -0700


"Thomas Richter" <thor@cleopatra.math.tu-berlin.de> wrote in message
news:bifh1s$ngu$1@mamenchi.zrz.TU-Berlin.DE...

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

    Follow the driver documentation.

> > Does anyone know how to allocate memory like this without having to
> > write a (kernel level) driver?

    The driver documentation must tell you how to do this. If it doesn't,
the documentation and/or the driver is broken.

> Simple. Allocate 64K more memory as required,
> then align the returned memory address "upwards" to the next 64K boundary.

    No good. Do it the way the driver author intended, follow the reference
code. If the driver is broken, fix it.

    DS



Relevant Pages

  • Re: [9fans] Writing device drivers
    ... Because I have a background with low-level languages like ... understanding the _why_ of using pointers in C has eluded ... I know this bears little relation to a device driver living in ... since you want to write a Plan 9 ...
    (comp.os.plan9)
  • Re: KMDF Interface : is it possible to use a c++ class ?
    ... function pointers you pass in must be static pointers since the caller will ... I'm developing a driver similar to Toaster example using Kernel Mode ... Is it possible to create an interface to export a c++ class instead of c ... functions with WdfDeviceAddQueryInterface? ...
    (microsoft.public.development.device.drivers)
  • Re: Multifunction printers for ubuntu?
    ... any pointers to get this to work? ... I just stick an SD card into the reader slot and it appears on the ... of what it's found (I have a Hauppage TV card in the box as well and Xsane ... I had to manually find the correct driver as for ...
    (Ubuntu)
  • Re: Emulate a virtual COM port
    ... IOCTL it has in there (At passive and dispatch level). ... > I have to emulate a virtual COM port in our existing functional USB ... How do I create a virtual COM port when the driver is loaded and ... > Any pointers to the API to be used or any pointers to the sample code ...
    (microsoft.public.development.device.drivers)
  • Re: A confusion about the stream interface driver
    ... The exact same thread of the application is what runs in the driver the ... system simply changes the process context the thread is running in. ... any pointers embedded in the data those direct pointers refer to are NOT ...
    (microsoft.public.windowsce.embedded)