mmap to kmalloc area - problem with mem_map_reserve
I am new to Linux device drivers. I am using Linux kernel version
I need to allocate some physical memory in the driver
(kmalloc/get_free_pages) and wants to mmap the same to the user
There is some sample and description given at
http://www.scs.ch/~frey/linux/memorymap.html for the same like the
Mapping addresses which are in the kernel virtual mapping into user
space is straight foreward:
· Implement a mmap method for your driver
· set the VM_LOCKED flag on your memory area. This will
prevent the swapper fromm swapping the pages out:
vma->flags |= VM_LOCKED
· Call remap_page_range() to map the physical address of your
buffer to the user space address
vma->flags |= VM_LOCKED;
printk("remap page range failed\n");
But it needs to reserve the page with
/* reserve all pages to make them remapable */
I could not find the header file in my system for mem_map_reserve..
/* this header files wraps some common module-space operations ...
here we use mem_map_reserve() macro */
can anybody suggest how can I get it or any other alternatives with
the new kernel versions.
Thanks in advance.