Linux - KernelThis forum is for all discussion relating to the Linux kernel.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
and an include file #include <linux/wrapper.h> was used.
If I compile the same code for imx6 i am getting <linux/wrapper.h> - no such file error , if I am not including the file - i am getting an error - implicit declaration of remap_page_range()
Please let me know which include i have to use to eliminate the error or is there any better way to mmap some memory between user and kernel space.
I don't think that you can do what you have in mind. You can only communicate with a user process in user space. Kernel space is accessible only to the kernel. User space is accessible to user processes and is referenced through the virtual-memory hardware since all addresses there are virtual.
Even if the kernel reserves a buffer in kernel-space, e.g. as a ring-buffer or for DMA purposes, it must move data to-and-from the user-space of a specified process. It cannot give that process direct access to the buffer in kernel space, AFAIK.
Last edited by sundialsvcs; 12-12-2017 at 08:53 AM.
Do you want to share the memory between multiple processes and the kernel or is it only one process and the kernel? If that's the second case, you can allocate the memory in the user space, pass it to kernel and then use get_user_pages()
Do you want to share the memory between multiple processes and the kernel or is it only one process and the kernel? If that's the second case, you can allocate the memory in the user space, pass it to kernel and then use get_user_pages()
And this is ordinarily what is done: the application program allocates some buffer, either with malloc() or maybe some form of shmget(), then provides that to the kernel. The kernel, always suspiciously verifying that the specified area is legitimate, retrieves the data from this area. (It is important to remember that this can involve virtual-memory paging.)
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.