nommu.c (d4efd79a81abc7096a418ee3103f261cfb6ab634) | nommu.c (88dca4ca5a93d2c09e5bbc6a62fbfc3af83c4fca) |
---|---|
1// SPDX-License-Identifier: GPL-2.0-only 2/* 3 * linux/mm/nommu.c 4 * 5 * Replacement code for mm functions to support CPU's that don't 6 * have any form of memory management unit (thus no virtual memory). 7 * 8 * See Documentation/nommu-mmap.txt --- 126 unchanged lines hidden (view full) --- 135LIST_HEAD(vmap_area_list); 136 137void vfree(const void *addr) 138{ 139 kfree(addr); 140} 141EXPORT_SYMBOL(vfree); 142 | 1// SPDX-License-Identifier: GPL-2.0-only 2/* 3 * linux/mm/nommu.c 4 * 5 * Replacement code for mm functions to support CPU's that don't 6 * have any form of memory management unit (thus no virtual memory). 7 * 8 * See Documentation/nommu-mmap.txt --- 126 unchanged lines hidden (view full) --- 135LIST_HEAD(vmap_area_list); 136 137void vfree(const void *addr) 138{ 139 kfree(addr); 140} 141EXPORT_SYMBOL(vfree); 142 |
143void *__vmalloc(unsigned long size, gfp_t gfp_mask, pgprot_t prot) | 143void *__vmalloc(unsigned long size, gfp_t gfp_mask) |
144{ 145 /* 146 * You can't specify __GFP_HIGHMEM with kmalloc() since kmalloc() 147 * returns only a logical address. 148 */ 149 return kmalloc(size, (gfp_mask | __GFP_COMP) & ~__GFP_HIGHMEM); 150} 151EXPORT_SYMBOL(__vmalloc); 152 153void *__vmalloc_node_flags(unsigned long size, int node, gfp_t flags) 154{ | 144{ 145 /* 146 * You can't specify __GFP_HIGHMEM with kmalloc() since kmalloc() 147 * returns only a logical address. 148 */ 149 return kmalloc(size, (gfp_mask | __GFP_COMP) & ~__GFP_HIGHMEM); 150} 151EXPORT_SYMBOL(__vmalloc); 152 153void *__vmalloc_node_flags(unsigned long size, int node, gfp_t flags) 154{ |
155 return __vmalloc(size, flags, PAGE_KERNEL); | 155 return __vmalloc(size, flags); |
156} 157 158static void *__vmalloc_user_flags(unsigned long size, gfp_t flags) 159{ 160 void *ret; 161 | 156} 157 158static void *__vmalloc_user_flags(unsigned long size, gfp_t flags) 159{ 160 void *ret; 161 |
162 ret = __vmalloc(size, flags, PAGE_KERNEL); | 162 ret = __vmalloc(size, flags); |
163 if (ret) { 164 struct vm_area_struct *vma; 165 166 down_write(¤t->mm->mmap_sem); 167 vma = find_vma(current->mm, (unsigned long)ret); 168 if (vma) 169 vma->vm_flags |= VM_USERMAP; 170 up_write(¤t->mm->mmap_sem); --- 54 unchanged lines hidden (view full) --- 225 * Allocate enough pages to cover @size from the page level 226 * allocator and map them into contiguous kernel virtual space. 227 * 228 * For tight control over page level allocator and protection flags 229 * use __vmalloc() instead. 230 */ 231void *vmalloc(unsigned long size) 232{ | 163 if (ret) { 164 struct vm_area_struct *vma; 165 166 down_write(¤t->mm->mmap_sem); 167 vma = find_vma(current->mm, (unsigned long)ret); 168 if (vma) 169 vma->vm_flags |= VM_USERMAP; 170 up_write(¤t->mm->mmap_sem); --- 54 unchanged lines hidden (view full) --- 225 * Allocate enough pages to cover @size from the page level 226 * allocator and map them into contiguous kernel virtual space. 227 * 228 * For tight control over page level allocator and protection flags 229 * use __vmalloc() instead. 230 */ 231void *vmalloc(unsigned long size) 232{ |
233 return __vmalloc(size, GFP_KERNEL | __GFP_HIGHMEM, PAGE_KERNEL); | 233 return __vmalloc(size, GFP_KERNEL | __GFP_HIGHMEM); |
234} 235EXPORT_SYMBOL(vmalloc); 236 237/* 238 * vzalloc - allocate virtually contiguous memory with zero fill 239 * 240 * @size: allocation size 241 * 242 * Allocate enough pages to cover @size from the page level 243 * allocator and map them into contiguous kernel virtual space. 244 * The memory allocated is set to zero. 245 * 246 * For tight control over page level allocator and protection flags 247 * use __vmalloc() instead. 248 */ 249void *vzalloc(unsigned long size) 250{ | 234} 235EXPORT_SYMBOL(vmalloc); 236 237/* 238 * vzalloc - allocate virtually contiguous memory with zero fill 239 * 240 * @size: allocation size 241 * 242 * Allocate enough pages to cover @size from the page level 243 * allocator and map them into contiguous kernel virtual space. 244 * The memory allocated is set to zero. 245 * 246 * For tight control over page level allocator and protection flags 247 * use __vmalloc() instead. 248 */ 249void *vzalloc(unsigned long size) 250{ |
251 return __vmalloc(size, GFP_KERNEL | __GFP_HIGHMEM | __GFP_ZERO, 252 PAGE_KERNEL); | 251 return __vmalloc(size, GFP_KERNEL | __GFP_HIGHMEM | __GFP_ZERO); |
253} 254EXPORT_SYMBOL(vzalloc); 255 256/** 257 * vmalloc_node - allocate memory on a specific node 258 * @size: allocation size 259 * @node: numa node 260 * --- 36 unchanged lines hidden (view full) --- 297 * executable kernel virtual space. 298 * 299 * For tight control over page level allocator and protection flags 300 * use __vmalloc() instead. 301 */ 302 303void *vmalloc_exec(unsigned long size) 304{ | 252} 253EXPORT_SYMBOL(vzalloc); 254 255/** 256 * vmalloc_node - allocate memory on a specific node 257 * @size: allocation size 258 * @node: numa node 259 * --- 36 unchanged lines hidden (view full) --- 296 * executable kernel virtual space. 297 * 298 * For tight control over page level allocator and protection flags 299 * use __vmalloc() instead. 300 */ 301 302void *vmalloc_exec(unsigned long size) 303{ |
305 return __vmalloc(size, GFP_KERNEL | __GFP_HIGHMEM, PAGE_KERNEL_EXEC); | 304 return __vmalloc(size, GFP_KERNEL | __GFP_HIGHMEM); |
306} 307 308/** 309 * vmalloc_32 - allocate virtually contiguous memory (32bit addressable) 310 * @size: allocation size 311 * 312 * Allocate enough 32bit PA addressable pages to cover @size from the 313 * page level allocator and map them into contiguous kernel virtual space. 314 */ 315void *vmalloc_32(unsigned long size) 316{ | 305} 306 307/** 308 * vmalloc_32 - allocate virtually contiguous memory (32bit addressable) 309 * @size: allocation size 310 * 311 * Allocate enough 32bit PA addressable pages to cover @size from the 312 * page level allocator and map them into contiguous kernel virtual space. 313 */ 314void *vmalloc_32(unsigned long size) 315{ |
317 return __vmalloc(size, GFP_KERNEL, PAGE_KERNEL); | 316 return __vmalloc(size, GFP_KERNEL); |
318} 319EXPORT_SYMBOL(vmalloc_32); 320 321/** 322 * vmalloc_32_user - allocate zeroed virtually contiguous 32bit memory 323 * @size: allocation size 324 * 325 * The resulting memory area is 32bit addressable and zeroed so it can be --- 1562 unchanged lines hidden --- | 317} 318EXPORT_SYMBOL(vmalloc_32); 319 320/** 321 * vmalloc_32_user - allocate zeroed virtually contiguous 32bit memory 322 * @size: allocation size 323 * 324 * The resulting memory area is 32bit addressable and zeroed so it can be --- 1562 unchanged lines hidden --- |