Skip to contentSkip to conversation

mapping physical memory

DISCUSSION Dan Maas 2 participants 2 messages Jan 26, 2001 1 message not in the archive

lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): [email protected]

Dan Maas

author
#1 lore raw
Quoted 3 lines

I need to be able to obtain and pin approximately 8 MB of contiguous physical memory in user space. How would I go about doing that under Linux if it is at all possible?

The only way to allocate that much *physically* contiguous memory is by writing a driver that grabs it at boot-time (I think the "bootmem" API is used for this). This is an extreme measure and should rarely be necessary, except in special cases such as primitive PCI cards that lack support for scatter/gather DMA.

You can easily implement a mmap() interface to give user-space programs access to the memory; there are plenty of examples of how to do this in various character device drivers.
(well OK, if all you need is a one-off hack, you can use the method developed by the Utah GLX people -- tell the kernel that you have 8MB *less* RAM than is actually present using a "mem=" directive at boot, then grab that last piece of memory by mmap'ing /dev/mem -- see
http://utah-glx.sourceforge.net/memory-usage.html)

Dan

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [email protected]
Please read the FAQ at http://www.tux.org/lkml/

#2 lore raw
In reply to a message not in the archive
Quoted 9 lines · Dan Maas
Quoted 3 lines

I need to be able to obtain and pin approximately 8 MB of contiguous physical memory in user space. How would I go about doing that under Linux if it is at all possible?

The only way to allocate that much *physically* contiguous memory is by writing a driver that grabs it at boot-time (I think the "bootmem" API is used for this). This is an extreme measure and should rarely be necessary, except in special cases such as primitive PCI cards that lack support for scatter/gather DMA.

Or is you want to reuse that memory between apps, use the bigphysarea patch. Yes, its available for 2.4.0 now :)

Met vriendelijke groet,
Pauline Middelink

Signature · 6 lines
GPG Key fingerprint = 2D5B 87A7 DDA6 0378 5DEA  BD3B 9A50 B416 E2D0 C3C2
For more details look at my website http://www.polyware.nl/~middelink
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [email protected]
Please read the FAQ at http://www.tux.org/lkml/