Define MODULES_VADDR and MODULES_END as VMALLOC_START and VMALLOC_END for 32-bit and reduce module_alloc() to __vmalloc_node_range(size, 1, MODULES_VADDR, MODULES_END, ...) as with the new defines the allocations becomes identical for both 32 and 64 bits. While on it, drop unused include of <linux/jump_label.h>
Unified · Split
| @@ -432,6 +432,8 @@ static inline int io_remap_pfn_range(struct vm_area_struct *vma, · 431 unmodified lines | |||
| 432 | 432 | ||
| 433 | #define VMALLOC_START _AC(0xfe600000,UL) | 433 | #define VMALLOC_START _AC(0xfe600000,UL) |
| 434 | #define VMALLOC_END _AC(0xffc00000,UL) | 434 | #define VMALLOC_END _AC(0xffc00000,UL) |
| 435 | #define MODULES_VADDR VMALLOC_START | ||
| 436 | #define MODULES_END VMALLOC_END | ||
| 435 | 437 | ||
| 436 | /* We provide our own get_unmapped_area to cope with VA holes for userland */ | 438 | /* We provide our own get_unmapped_area to cope with VA holes for userland */ |
| 437 | #define HAVE_ARCH_UNMAPPED_AREA | 439 | #define HAVE_ARCH_UNMAPPED_AREA |
| @@ -21,35 +21,12 @@ · 20 unmodified lines | |||
| 21 | 21 | ||
| 22 | #include "entry.h" | 22 | #include "entry.h" |
| 23 | 23 | ||
| 24 | #ifdef CONFIG_SPARC64 | 24 | void *module_alloc(unsigned long size) |
| 25 | |||
| 26 | #include <linux/jump_label.h> | ||
| 27 | |||
| 28 | static void *module_map(unsigned long size) | ||
| 29 | { | 25 | { |
| 30 | if (PAGE_ALIGN(size) > MODULES_LEN) | ||
| 31 | return NULL; | ||
| 32 | return __vmalloc_node_range(size, 1, MODULES_VADDR, MODULES_END, | 26 | return __vmalloc_node_range(size, 1, MODULES_VADDR, MODULES_END, |
| 33 | GFP_KERNEL, PAGE_KERNEL, 0, NUMA_NO_NODE, | 27 | GFP_KERNEL, PAGE_KERNEL, 0, NUMA_NO_NODE, |
| 34 | __builtin_return_address(0)); | 28 | __builtin_return_address(0)); |
| 35 | } | 29 | } |
| 36 | #else | ||
| 37 | static void *module_map(unsigned long size) | ||
| 38 | { | ||
| 39 | return vmalloc(size); | ||
| 40 | } | ||
| 41 | #endif /* CONFIG_SPARC64 */ | ||
| 42 | |||
| 43 | void *module_alloc(unsigned long size) | ||
| 44 | { | ||
| 45 | void *ret; | ||
| 46 | |||
| 47 | ret = module_map(size); | ||
| 48 | if (ret) | ||
| 49 | memset(ret, 0, size); | ||
| 50 | |||
| 51 | return ret; | ||
| 52 | } | ||
| 53 | 30 | ||
| 54 | /* Make generic code ignore STT_REGISTER dummy undefined symbols. */ | 31 | /* Make generic code ignore STT_REGISTER dummy undefined symbols. */ |
| 55 | int module_frob_arch_sections(Elf_Ehdr *hdr, | 32 | int module_frob_arch_sections(Elf_Ehdr *hdr, |