diff options
author | Jonathan Herman <hermanjl@cs.unc.edu> | 2013-01-17 16:15:55 -0500 |
---|---|---|
committer | Jonathan Herman <hermanjl@cs.unc.edu> | 2013-01-17 16:15:55 -0500 |
commit | 8dea78da5cee153b8af9c07a2745f6c55057fe12 (patch) | |
tree | a8f4d49d63b1ecc92f2fddceba0655b2472c5bd9 /arch/tile/kernel/module.c | |
parent | 406089d01562f1e2bf9f089fd7637009ebaad589 (diff) |
Patched in Tegra support.
Diffstat (limited to 'arch/tile/kernel/module.c')
-rw-r--r-- | arch/tile/kernel/module.c | 28 |
1 files changed, 14 insertions, 14 deletions
diff --git a/arch/tile/kernel/module.c b/arch/tile/kernel/module.c index 4918d91bc3a..28fa6ece9d3 100644 --- a/arch/tile/kernel/module.c +++ b/arch/tile/kernel/module.c | |||
@@ -20,9 +20,19 @@ | |||
20 | #include <linux/fs.h> | 20 | #include <linux/fs.h> |
21 | #include <linux/string.h> | 21 | #include <linux/string.h> |
22 | #include <linux/kernel.h> | 22 | #include <linux/kernel.h> |
23 | #include <asm/opcode-tile.h> | ||
23 | #include <asm/pgtable.h> | 24 | #include <asm/pgtable.h> |
24 | #include <asm/homecache.h> | 25 | #include <asm/homecache.h> |
25 | #include <arch/opcode.h> | 26 | |
27 | #ifdef __tilegx__ | ||
28 | # define Elf_Rela Elf64_Rela | ||
29 | # define ELF_R_SYM ELF64_R_SYM | ||
30 | # define ELF_R_TYPE ELF64_R_TYPE | ||
31 | #else | ||
32 | # define Elf_Rela Elf32_Rela | ||
33 | # define ELF_R_SYM ELF32_R_SYM | ||
34 | # define ELF_R_TYPE ELF32_R_TYPE | ||
35 | #endif | ||
26 | 36 | ||
27 | #ifdef MODULE_DEBUG | 37 | #ifdef MODULE_DEBUG |
28 | #define DEBUGP printk | 38 | #define DEBUGP printk |
@@ -42,6 +52,8 @@ void *module_alloc(unsigned long size) | |||
42 | int i = 0; | 52 | int i = 0; |
43 | int npages; | 53 | int npages; |
44 | 54 | ||
55 | if (size == 0) | ||
56 | return NULL; | ||
45 | npages = (size + PAGE_SIZE - 1) / PAGE_SIZE; | 57 | npages = (size + PAGE_SIZE - 1) / PAGE_SIZE; |
46 | pages = kmalloc(npages * sizeof(struct page *), GFP_KERNEL); | 58 | pages = kmalloc(npages * sizeof(struct page *), GFP_KERNEL); |
47 | if (pages == NULL) | 59 | if (pages == NULL) |
@@ -55,8 +67,6 @@ void *module_alloc(unsigned long size) | |||
55 | area = __get_vm_area(size, VM_ALLOC, MEM_MODULE_START, MEM_MODULE_END); | 67 | area = __get_vm_area(size, VM_ALLOC, MEM_MODULE_START, MEM_MODULE_END); |
56 | if (!area) | 68 | if (!area) |
57 | goto error; | 69 | goto error; |
58 | area->nr_pages = npages; | ||
59 | area->pages = pages; | ||
60 | 70 | ||
61 | if (map_vm_area(area, prot_rwx, &pages)) { | 71 | if (map_vm_area(area, prot_rwx, &pages)) { |
62 | vunmap(area->addr); | 72 | vunmap(area->addr); |
@@ -147,17 +157,7 @@ int apply_relocate_add(Elf_Shdr *sechdrs, | |||
147 | 157 | ||
148 | switch (ELF_R_TYPE(rel[i].r_info)) { | 158 | switch (ELF_R_TYPE(rel[i].r_info)) { |
149 | 159 | ||
150 | #ifdef __LITTLE_ENDIAN | 160 | #define MUNGE(func) (*location = ((*location & ~func(-1)) | func(value))) |
151 | # define MUNGE(func) \ | ||
152 | (*location = ((*location & ~func(-1)) | func(value))) | ||
153 | #else | ||
154 | /* | ||
155 | * Instructions are always little-endian, so when we read them as data, | ||
156 | * we have to swap them around before and after modifying them. | ||
157 | */ | ||
158 | # define MUNGE(func) \ | ||
159 | (*location = swab64((swab64(*location) & ~func(-1)) | func(value))) | ||
160 | #endif | ||
161 | 161 | ||
162 | #ifndef __tilegx__ | 162 | #ifndef __tilegx__ |
163 | case R_TILE_32: | 163 | case R_TILE_32: |