Skip to contentSkip to conversation

inverse mmap() available?

DISCUSSION Norbert Roos 5 participants 5 messages Sep 28, 2001 – Oct 1, 2001

lore
Share & tools
lore
#0 lore raw

Hello!

Is there a way to map user space memory into kernel address space, e.g. that i don't have to call get_user(var,...) but simply use var = *user_space_ptr?

What i intend to do (as the next step) is to DMA-transfer data directly between a PCI device and user space memory. The buffer in user space should be allocated with malloc(), so allocating a buffer in kernel and mmap()-ping it to user space is not the solution..

I guess this has been asked before, any links to further information would be great.

Thanks
Norbert

#1 lore raw

Norbert Roos <[email protected]> was pleased to say:

Quoted 7 lines

Hello!

Is there a way to map user space memory into kernel address space, e.g. that i don't have to call get_user(var,...) but simply use var = *user_space_ptr?

Quoted 7 lines

What i intend to do (as the next step) is to DMA-transfer data directly between a PCI device and user space memory. The buffer in user space should be allocated with malloc(), so allocating a buffer in kernel and mmap()-ping it to user space is not the solution..

I guess this has been asked before, any links to further information would be great.

Look at the KIOBUF stuff in <linux/iobuf.h> for how to do this.

---------------------------------------------+-----------------------------

Tommy Reynolds                               | mailto:	<[email protected]>
Red Hat, Inc., Embedded Development Services | Phone:  +1.256.704.9286
307 Wynn Drive NW, Huntsville, AL 35805 USA  | FAX:    +1.236.837.3839
Senior Software Developer                    | Mobile: +1.919.641.2923
#2 lore raw
In reply to Norbert Roos
Quoted 6 lines · In article <[email protected]> you wrote:

Hello!

Is there a way to map user space memory into kernel address space, e.g. that i don't have to call get_user(var,...) but simply use var = *user_space_ptr?

Quoted 7 lines

What i intend to do (as the next step) is to DMA-transfer data directly between a PCI device and user space memory. The buffer in user space should be allocated with malloc(), so allocating a buffer in kernel and mmap()-ping it to user space is not the solution..

I guess this has been asked before, any links to further information would be great.

map_user_kiobuf is what you want :) Some more explanation at:

ftp://ftp.openlinux.org/pub/people/hch/kio/kiobuf.txt

#3 lore raw

putting a user program to sleep till interrupted

hi,
I wanted to know how a user program/process can be put to sleep by using the functions given in the kernel. I will be calling the function not from user space but from kernel space, i.e. from inside the kernel. I also want to be able to start it again whenever required. I went thru sched.c but couldn't figure out how to make my own wait list.
Thanx in advance.
Anil

__________________________________________________
Do You Yahoo!?
Listen to your Yahoo! Mail messages from any phone.
http://phone.yahoo.com

#4 lore raw

Re: putting a user program to sleep till interrupted

Hello,

A good explanation is found in:
http://www.linuxdoc.org/LDP/lki/lki-2.html#ss2.5

and also in Chapter 5, 'Linux Device Drivers' from Alessandro Rubini & Jonathan Corbet (you find an electronic version of the book in http://www.oreilly.com/catalog/linuxdrive2/)

regards
Martin

Quoted 16 lines · Anil Kumar

hi,
I wanted to know how a user program/process can be put to sleep by using the functions given in the kernel. I will be calling the function not from user space but from kernel space, i.e. from inside the kernel. I also want to be able to start it again whenever required. I went thru sched.c but couldn't figure out how to make my own wait list.
Thanx in advance.
Anil

__________________________________________________
Do You Yahoo!?
Listen to your Yahoo! Mail messages from any phone.
http://phone.yahoo.com
-

Quoted 4 lines
Kernelnewbies: Help each other learn about the Linux kernel.
Archive:       http://mail.nl.linux.org/kernelnewbies/
IRC Channel:   irc.openprojects.net / #kernelnewbies
Web Page:      http://www.kernelnewbies.org/

--

Supercomputing System AG          email: [email protected]
Martin Maletinsky                 phone: +41 (0)1 445 16 05
Technoparkstrasse 1               fax:   +41 (0)1 445 16 10

CH-8005 Zurich