On Sun, Dec 26, 2004 at 11:15:04 +0000, Cristina Rivera wrote: > 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 . vmalloc_area does not start at vmalloc_ptr, right? vmalloc_area is supposed to be at least LEN long, right? vmalloc_ptr must therefore be ... ? ------------------------------------------------------------------------------- Jan 'Bulb' Hudec <bulb@xxxxxx>
Attachment:
signature.asc
Description: Digital signature