Messages in this thread | | | From | "Petr Vandrovec" <> | Date | Fri, 13 Oct 2000 12:41:28 MET-1 | Subject | Re: mapping user space buffer to kernel address space |
| |
On 13 Oct 00 at 15:31, mdaljeet@in.ibm.com wrote:
> I have a user buffer and i want to map it to kernel address space > can anyone tell how to do this like in AIX we have xmattach
Look at mm/memory.c:map_user_kiobuf. It is used by drivers/char/raw.c, or by drivers/media/video/bttv-driver.c, for example. It is 2.4 solution.
For 2.2 solution, you have to (1) pagein page to memory (getuser(c, (char*)addr)), (2) walk pagetables (yourself, as p[gm]d_offset and pte_offset are 2.3 things), (3) increment page reference count (get_page(mem_map + pagenr)) I believe that it is implemented by 2.2 drivers/char/bttv.c, and by vmware's vmmon module. Petr Vandrovec vandrove@vc.cvut.cz
P.S.: Last week I wrote that incrementing page->count can cause troubles under 2.4 kernels. I found that you do not have to increment page count, just shared mappings are not correctly truncated at ftruncate at all... So you can use 2.2 solution in 2.4 too. But kiobuf is not i386 specific, so it is preferred solution.
- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org Please read the FAQ at http://www.tux.org/lkml/
| |