X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=mm%2Fvmalloc.c;h=a4c7c0a17e96173e130edfdf34a3a4d21c288ca2;hb=9bf4aaab3e101692164d49b7ca357651eb691cb6;hp=16e6f88c23ab5af3c89179ffa468def4f2be8c3a;hpb=db216c3d5e4c040e557a50f8f5d35d5c415e8c1c;p=linux-2.6.git diff --git a/mm/vmalloc.c b/mm/vmalloc.c index 16e6f88c2..a4c7c0a17 100644 --- a/mm/vmalloc.c +++ b/mm/vmalloc.c @@ -17,7 +17,6 @@ #include #include -#include #include @@ -200,7 +199,7 @@ struct vm_struct *__get_vm_area(unsigned long size, unsigned long flags, } write_lock(&vmlist_lock); - for (p = &vmlist; (tmp = *p) ;p = &tmp->next) { + for (p = &vmlist; (tmp = *p) != NULL ;p = &tmp->next) { if ((unsigned long)tmp->addr < addr) continue; if ((size + addr) < addr) @@ -261,7 +260,7 @@ struct vm_struct *remove_vm_area(void *addr) struct vm_struct **p, *tmp; write_lock(&vmlist_lock); - for (p = &vmlist ; (tmp = *p) ;p = &tmp->next) { + for (p = &vmlist ; (tmp = *p) != NULL ;p = &tmp->next) { if (tmp->addr == addr) goto found; } @@ -455,6 +454,28 @@ void *vmalloc(unsigned long size) EXPORT_SYMBOL(vmalloc); +/** + * vmalloc_exec - allocate virtually contiguous, executable memory + * + * @size: allocation size + * + * Kernel-internal function to allocate enough pages to cover @size + * the page level allocator and map them into contiguous and + * executable kernel virtual space. + * + * For tight cotrol over page level allocator and protection flags + * use __vmalloc() instead. + */ + +#ifndef PAGE_KERNEL_EXEC +# define PAGE_KERNEL_EXEC PAGE_KERNEL +#endif + +void *vmalloc_exec(unsigned long size) +{ + return __vmalloc(size, GFP_KERNEL | __GFP_HIGHMEM, PAGE_KERNEL_EXEC); +} + /** * vmalloc_32 - allocate virtually contiguous memory (32bit addressable) *