diff options
Diffstat (limited to 'arch/powerpc/kernel/module_64.c')
| -rw-r--r-- | arch/powerpc/kernel/module_64.c | 49 |
1 files changed, 40 insertions, 9 deletions
diff --git a/arch/powerpc/kernel/module_64.c b/arch/powerpc/kernel/module_64.c index ba34001fca8e..8dd1f0aae5d6 100644 --- a/arch/powerpc/kernel/module_64.c +++ b/arch/powerpc/kernel/module_64.c | |||
| @@ -22,6 +22,9 @@ | |||
| 22 | #include <linux/vmalloc.h> | 22 | #include <linux/vmalloc.h> |
| 23 | #include <asm/module.h> | 23 | #include <asm/module.h> |
| 24 | #include <asm/uaccess.h> | 24 | #include <asm/uaccess.h> |
| 25 | #include <asm/firmware.h> | ||
| 26 | |||
| 27 | #include "setup.h" | ||
| 25 | 28 | ||
| 26 | /* FIXME: We don't do .init separately. To do this, we'd need to have | 29 | /* FIXME: We don't do .init separately. To do this, we'd need to have |
| 27 | a separate r2 value in the init and core section, and stub between | 30 | a separate r2 value in the init and core section, and stub between |
| @@ -400,6 +403,11 @@ int apply_relocate_add(Elf64_Shdr *sechdrs, | |||
| 400 | | (value & 0x03fffffc); | 403 | | (value & 0x03fffffc); |
| 401 | break; | 404 | break; |
| 402 | 405 | ||
| 406 | case R_PPC64_REL64: | ||
| 407 | /* 64 bits relative (used by features fixups) */ | ||
| 408 | *location = value - (unsigned long)location; | ||
| 409 | break; | ||
| 410 | |||
| 403 | default: | 411 | default: |
| 404 | printk("%s: Unknown ADD relocation: %lu\n", | 412 | printk("%s: Unknown ADD relocation: %lu\n", |
| 405 | me->name, | 413 | me->name, |
| @@ -413,23 +421,33 @@ int apply_relocate_add(Elf64_Shdr *sechdrs, | |||
| 413 | 421 | ||
| 414 | LIST_HEAD(module_bug_list); | 422 | LIST_HEAD(module_bug_list); |
| 415 | 423 | ||
| 416 | int module_finalize(const Elf_Ehdr *hdr, | 424 | static const Elf_Shdr *find_section(const Elf_Ehdr *hdr, |
| 417 | const Elf_Shdr *sechdrs, struct module *me) | 425 | const Elf_Shdr *sechdrs, |
| 426 | const char *name) | ||
| 418 | { | 427 | { |
| 419 | char *secstrings; | 428 | char *secstrings; |
| 420 | unsigned int i; | 429 | unsigned int i; |
| 421 | 430 | ||
| 431 | secstrings = (char *)hdr + sechdrs[hdr->e_shstrndx].sh_offset; | ||
| 432 | for (i = 1; i < hdr->e_shnum; i++) | ||
| 433 | if (strcmp(secstrings+sechdrs[i].sh_name, name) == 0) | ||
| 434 | return &sechdrs[i]; | ||
| 435 | return NULL; | ||
| 436 | } | ||
| 437 | |||
| 438 | int module_finalize(const Elf_Ehdr *hdr, | ||
| 439 | const Elf_Shdr *sechdrs, struct module *me) | ||
| 440 | { | ||
| 441 | const Elf_Shdr *sect; | ||
| 442 | |||
| 422 | me->arch.bug_table = NULL; | 443 | me->arch.bug_table = NULL; |
| 423 | me->arch.num_bugs = 0; | 444 | me->arch.num_bugs = 0; |
| 424 | 445 | ||
| 425 | /* Find the __bug_table section, if present */ | 446 | /* Find the __bug_table section, if present */ |
| 426 | secstrings = (char *)hdr + sechdrs[hdr->e_shstrndx].sh_offset; | 447 | sect = find_section(hdr, sechdrs, "__bug_table"); |
| 427 | for (i = 1; i < hdr->e_shnum; i++) { | 448 | if (sect != NULL) { |
| 428 | if (strcmp(secstrings+sechdrs[i].sh_name, "__bug_table")) | 449 | me->arch.bug_table = (void *) sect->sh_addr; |
| 429 | continue; | 450 | me->arch.num_bugs = sect->sh_size / sizeof(struct bug_entry); |
| 430 | me->arch.bug_table = (void *) sechdrs[i].sh_addr; | ||
| 431 | me->arch.num_bugs = sechdrs[i].sh_size / sizeof(struct bug_entry); | ||
| 432 | break; | ||
| 433 | } | 451 | } |
| 434 | 452 | ||
| 435 | /* | 453 | /* |
| @@ -439,6 +457,19 @@ int module_finalize(const Elf_Ehdr *hdr, | |||
| 439 | */ | 457 | */ |
| 440 | list_add(&me->arch.bug_list, &module_bug_list); | 458 | list_add(&me->arch.bug_list, &module_bug_list); |
| 441 | 459 | ||
| 460 | /* Apply feature fixups */ | ||
| 461 | sect = find_section(hdr, sechdrs, "__ftr_fixup"); | ||
| 462 | if (sect != NULL) | ||
| 463 | do_feature_fixups(cur_cpu_spec->cpu_features, | ||
| 464 | (void *)sect->sh_addr, | ||
| 465 | (void *)sect->sh_addr + sect->sh_size); | ||
| 466 | |||
| 467 | sect = find_section(hdr, sechdrs, "__fw_ftr_fixup"); | ||
| 468 | if (sect != NULL) | ||
| 469 | do_feature_fixups(powerpc_firmware_features, | ||
| 470 | (void *)sect->sh_addr, | ||
| 471 | (void *)sect->sh_addr + sect->sh_size); | ||
| 472 | |||
| 442 | return 0; | 473 | return 0; |
| 443 | } | 474 | } |
| 444 | 475 | ||
