diff options
author | Dmitry Torokhov <dmitry.torokhov@gmail.com> | 2009-08-28 01:00:20 -0400 |
---|---|---|
committer | Dmitry Torokhov <dmitry.torokhov@gmail.com> | 2009-08-28 01:00:20 -0400 |
commit | 4b61bb575b1fb42ab1df228ae7812e5135f656da (patch) | |
tree | 03456466e6f678456ea462a7da4b352d1aa03aa3 /arch/mips/kernel/vpe.c | |
parent | 805423e84e900e56c834aadee61a020b0d5092c3 (diff) | |
parent | 326ba5010a5429a5a528b268b36a5900d4ab0eba (diff) |
Merge commit 'v2.6.31-rc8' into next
Diffstat (limited to 'arch/mips/kernel/vpe.c')
-rw-r--r-- | arch/mips/kernel/vpe.c | 49 |
1 files changed, 23 insertions, 26 deletions
diff --git a/arch/mips/kernel/vpe.c b/arch/mips/kernel/vpe.c index 07b9ec2c6e3d..9a1ab7e87fd4 100644 --- a/arch/mips/kernel/vpe.c +++ b/arch/mips/kernel/vpe.c | |||
@@ -73,7 +73,7 @@ static int major; | |||
73 | static const int minor = 1; /* fixed for now */ | 73 | static const int minor = 1; /* fixed for now */ |
74 | 74 | ||
75 | #ifdef CONFIG_MIPS_APSP_KSPD | 75 | #ifdef CONFIG_MIPS_APSP_KSPD |
76 | static struct kspd_notifications kspd_events; | 76 | static struct kspd_notifications kspd_events; |
77 | static int kspd_events_reqd = 0; | 77 | static int kspd_events_reqd = 0; |
78 | #endif | 78 | #endif |
79 | 79 | ||
@@ -155,10 +155,9 @@ struct { | |||
155 | }; | 155 | }; |
156 | 156 | ||
157 | static void release_progmem(void *ptr); | 157 | static void release_progmem(void *ptr); |
158 | extern void save_gp_address(unsigned int secbase, unsigned int rel); | ||
159 | 158 | ||
160 | /* get the vpe associated with this minor */ | 159 | /* get the vpe associated with this minor */ |
161 | struct vpe *get_vpe(int minor) | 160 | static struct vpe *get_vpe(int minor) |
162 | { | 161 | { |
163 | struct vpe *v; | 162 | struct vpe *v; |
164 | 163 | ||
@@ -174,7 +173,7 @@ struct vpe *get_vpe(int minor) | |||
174 | } | 173 | } |
175 | 174 | ||
176 | /* get the vpe associated with this minor */ | 175 | /* get the vpe associated with this minor */ |
177 | struct tc *get_tc(int index) | 176 | static struct tc *get_tc(int index) |
178 | { | 177 | { |
179 | struct tc *t; | 178 | struct tc *t; |
180 | 179 | ||
@@ -186,20 +185,8 @@ struct tc *get_tc(int index) | |||
186 | return NULL; | 185 | return NULL; |
187 | } | 186 | } |
188 | 187 | ||
189 | struct tc *get_tc_unused(void) | ||
190 | { | ||
191 | struct tc *t; | ||
192 | |||
193 | list_for_each_entry(t, &vpecontrol.tc_list, list) { | ||
194 | if (t->state == TC_STATE_UNUSED) | ||
195 | return t; | ||
196 | } | ||
197 | |||
198 | return NULL; | ||
199 | } | ||
200 | |||
201 | /* allocate a vpe and associate it with this minor (or index) */ | 188 | /* allocate a vpe and associate it with this minor (or index) */ |
202 | struct vpe *alloc_vpe(int minor) | 189 | static struct vpe *alloc_vpe(int minor) |
203 | { | 190 | { |
204 | struct vpe *v; | 191 | struct vpe *v; |
205 | 192 | ||
@@ -216,7 +203,7 @@ struct vpe *alloc_vpe(int minor) | |||
216 | } | 203 | } |
217 | 204 | ||
218 | /* allocate a tc. At startup only tc0 is running, all other can be halted. */ | 205 | /* allocate a tc. At startup only tc0 is running, all other can be halted. */ |
219 | struct tc *alloc_tc(int index) | 206 | static struct tc *alloc_tc(int index) |
220 | { | 207 | { |
221 | struct tc *tc; | 208 | struct tc *tc; |
222 | 209 | ||
@@ -232,7 +219,7 @@ out: | |||
232 | } | 219 | } |
233 | 220 | ||
234 | /* clean up and free everything */ | 221 | /* clean up and free everything */ |
235 | void release_vpe(struct vpe *v) | 222 | static void release_vpe(struct vpe *v) |
236 | { | 223 | { |
237 | list_del(&v->list); | 224 | list_del(&v->list); |
238 | if (v->load_addr) | 225 | if (v->load_addr) |
@@ -240,7 +227,7 @@ void release_vpe(struct vpe *v) | |||
240 | kfree(v); | 227 | kfree(v); |
241 | } | 228 | } |
242 | 229 | ||
243 | void dump_mtregs(void) | 230 | static void dump_mtregs(void) |
244 | { | 231 | { |
245 | unsigned long val; | 232 | unsigned long val; |
246 | 233 | ||
@@ -327,7 +314,8 @@ static void layout_sections(struct module *mod, const Elf_Ehdr * hdr, | |||
327 | || (s->sh_flags & masks[m][1]) | 314 | || (s->sh_flags & masks[m][1]) |
328 | || s->sh_entsize != ~0UL) | 315 | || s->sh_entsize != ~0UL) |
329 | continue; | 316 | continue; |
330 | s->sh_entsize = get_offset(&mod->core_size, s); | 317 | s->sh_entsize = |
318 | get_offset((unsigned long *)&mod->core_size, s); | ||
331 | } | 319 | } |
332 | 320 | ||
333 | if (m == 0) | 321 | if (m == 0) |
@@ -461,16 +449,15 @@ static int apply_r_mips_lo16(struct module *me, uint32_t *location, | |||
461 | { | 449 | { |
462 | unsigned long insnlo = *location; | 450 | unsigned long insnlo = *location; |
463 | Elf32_Addr val, vallo; | 451 | Elf32_Addr val, vallo; |
452 | struct mips_hi16 *l, *next; | ||
464 | 453 | ||
465 | /* Sign extend the addend we extract from the lo insn. */ | 454 | /* Sign extend the addend we extract from the lo insn. */ |
466 | vallo = ((insnlo & 0xffff) ^ 0x8000) - 0x8000; | 455 | vallo = ((insnlo & 0xffff) ^ 0x8000) - 0x8000; |
467 | 456 | ||
468 | if (mips_hi16_list != NULL) { | 457 | if (mips_hi16_list != NULL) { |
469 | struct mips_hi16 *l; | ||
470 | 458 | ||
471 | l = mips_hi16_list; | 459 | l = mips_hi16_list; |
472 | while (l != NULL) { | 460 | while (l != NULL) { |
473 | struct mips_hi16 *next; | ||
474 | unsigned long insn; | 461 | unsigned long insn; |
475 | 462 | ||
476 | /* | 463 | /* |
@@ -480,7 +467,7 @@ static int apply_r_mips_lo16(struct module *me, uint32_t *location, | |||
480 | printk(KERN_DEBUG "VPE loader: " | 467 | printk(KERN_DEBUG "VPE loader: " |
481 | "apply_r_mips_lo16/hi16: \t" | 468 | "apply_r_mips_lo16/hi16: \t" |
482 | "inconsistent value information\n"); | 469 | "inconsistent value information\n"); |
483 | return -ENOEXEC; | 470 | goto out_free; |
484 | } | 471 | } |
485 | 472 | ||
486 | /* | 473 | /* |
@@ -518,6 +505,16 @@ static int apply_r_mips_lo16(struct module *me, uint32_t *location, | |||
518 | *location = insnlo; | 505 | *location = insnlo; |
519 | 506 | ||
520 | return 0; | 507 | return 0; |
508 | |||
509 | out_free: | ||
510 | while (l != NULL) { | ||
511 | next = l->next; | ||
512 | kfree(l); | ||
513 | l = next; | ||
514 | } | ||
515 | mips_hi16_list = NULL; | ||
516 | |||
517 | return -ENOEXEC; | ||
521 | } | 518 | } |
522 | 519 | ||
523 | static int (*reloc_handlers[]) (struct module *me, uint32_t *location, | 520 | static int (*reloc_handlers[]) (struct module *me, uint32_t *location, |
@@ -541,7 +538,7 @@ static char *rstrs[] = { | |||
541 | [R_MIPS_PC16] = "MIPS_PC16" | 538 | [R_MIPS_PC16] = "MIPS_PC16" |
542 | }; | 539 | }; |
543 | 540 | ||
544 | int apply_relocations(Elf32_Shdr *sechdrs, | 541 | static int apply_relocations(Elf32_Shdr *sechdrs, |
545 | const char *strtab, | 542 | const char *strtab, |
546 | unsigned int symindex, | 543 | unsigned int symindex, |
547 | unsigned int relsec, | 544 | unsigned int relsec, |
@@ -586,7 +583,7 @@ int apply_relocations(Elf32_Shdr *sechdrs, | |||
586 | return 0; | 583 | return 0; |
587 | } | 584 | } |
588 | 585 | ||
589 | void save_gp_address(unsigned int secbase, unsigned int rel) | 586 | static inline void save_gp_address(unsigned int secbase, unsigned int rel) |
590 | { | 587 | { |
591 | gp_addr = secbase + rel; | 588 | gp_addr = secbase + rel; |
592 | gp_offs = gp_addr - (secbase & 0xffff0000); | 589 | gp_offs = gp_addr - (secbase & 0xffff0000); |