Hi there!
I'm using a driver to share memory between user and kernel that I found at http://www.scs.ch/~frey/linux/memorymap.html
But I have a doubt with some operations done in init_module. Can you help me with them? I can't understand why is used LEN + 2*PAGE_SIZE for doing vmalloc and later, why is done (((unsigned long)vmalloc_ptr + PAGE_SIZE -1) & PAGE_MASK)
/* get a memory area that is only virtual contigous. */
vmalloc_ptr=vmalloc(LEN+2*PAGE_SIZE);
vmalloc_area=(int *)(((unsigned long)vmalloc_ptr + PAGE_SIZE -1) & PAGE_MASK);
there's a comment that says vmalloc_ptr is a pointer not aligned to page and vmalloc_area is aligned to page but I can't understand why is multiplying page size by 2 and adding it to length for doing the vmalloc .
I know that the driver is too much big to understand it in a glance but I think that probably there's somebody else who can help me just having a look at it :-)
Thanks in advance, Cristina.
-- Kernelnewbies: Help each other learn about the Linux kernel. Archive: http://mail.nl.linux.org/kernelnewbies/ FAQ: http://kernelnewbies.org/faq/