Mapping kernel memory into user space?

Mapping kernel memory into user space?

Post by Felix Rau » Sat, 02 May 1998 04:00:00



I should map some piece of kernel-memory into user space for a driver.
I know that there is a good driver-book out there which I will
soon buy. But for now, I need a solution before I have the book.

I already have a kernel-module and a device special file /dev/memmap.
A user-space programm can open(2) the /dev/memmap file, do an
ioctl(2) syscall to have the kernel module kmalloc() some kB of
memory.

Now I should (either with another ioctl() or with an mmap() call)
map this allocated piece of memory into user space, so that the
user space programm can read an write to it. Another user space
programm should also be able to read an write to it (as well as the
kernel space driver of course).

How do I map that memory from the kernel module to the user space?

- Felix
--

Homepage: http://nice.ethz.ch/~felix/ (includes PGP public key)

 
 
 

1. Problem mapping PCI memory space to user space

Hi,

I want to map a local address space of my PCI device to user space. The
local adress space is mapped in PCI memory space and its size is 1024
bytes. I have created a devmap entry point in my driver according to
the "Writing Device Drivers" document. The drivers works on a Sparc
platform but when I use it on a x86 platform mmap fails. The global
error returns ENXIO. The devmap_devmem_setup() function in my driver
returns -1. When I change the size of the local address space to 4096
bytes equal to page size, it works. Anyway this is no solution for me,
I want to be able to map local address spaces smaller as the space
size. By the way I round up the len parameter to a multiple of the page
size, so thats not the problem.

What could be the problem? What is the difference with the Sparc
platform? Is it not possible to map a local address space smaller as
the page size?

Someone who can help me?

2. LPRng remove print jobs with printer off

3. Need help in understanding the mapping of user-space send, sendto, sendmsg to kernel-space sendmsg

4. proxy/cache stats

5. mapping user space and kernel space

6. developing PAM authentication modules?

7. How can I map kernel space to user space ??

8. Vendor Recommendations

9. How can I map kernel space to user space..

10. map pci memory to user space for network devices

11. Mapping physical memory in User space?

12. How to map PCI card memory into user space

13. mapping ISA device memory in kernel space