lkml.org 
[lkml]   [1996]   [Jul]   [16]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
SubjectMapping kernel memory into user space
From
[I'm forwarding this for a friend, who doesn't regularly read the
kernel mailing list. I'll forward any responses to him.]

Hi,

I am writing a device driver for a PCI video capture board that writes image
data directly into the memory of the computer. As it is impossible to obtain
large contiguos memory areas in kernel space, I use blocks of 4k and program
the framegrabber's processor to write to them. To obtain fast acces to the
image data, I want to use memory mapped acces. However, I cannot figure out
how to map these 4k blocks to a contiguos area in user space memory. For
allocating the blocks I use

get_free_page();

The driver works fine when using my read(), which copies the data to user
memory via memcpy_to_fs(). In the drivers mmap() function, I tried to
subsequently map the blocks to user space via remap_page_range(). This does
not work at all, not even for the first page.

Q1: How can I map non-contiguos memory pages in kernel space to a
contiguos area in user space?

Q2: Is there a way to use shared memory, so I could use XShmPutImage()
to write to a window?

Q3: Which flags for get_free_page() insure that the pages won't be
swapped out?


Thanks in advance for your help, Hubert.


\
 
 \ /
  Last update: 2005-03-22 13:38    [W:0.058 / U:1.384 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site