diff options
Diffstat (limited to 'arch/mips/kernel/vpe.c')
-rw-r--r-- | arch/mips/kernel/vpe.c | 98 |
1 files changed, 49 insertions, 49 deletions
diff --git a/arch/mips/kernel/vpe.c b/arch/mips/kernel/vpe.c index 147cec19621d..32fc5d4a22e5 100644 --- a/arch/mips/kernel/vpe.c +++ b/arch/mips/kernel/vpe.c | |||
@@ -254,7 +254,7 @@ static void __maybe_unused dump_mtregs(void) | |||
254 | val & MVPCONF0_PTC, (val & MVPCONF0_M) >> MVPCONF0_M_SHIFT); | 254 | val & MVPCONF0_PTC, (val & MVPCONF0_M) >> MVPCONF0_M_SHIFT); |
255 | } | 255 | } |
256 | 256 | ||
257 | /* Find some VPE program space */ | 257 | /* Find some VPE program space */ |
258 | static void *alloc_progmem(unsigned long len) | 258 | static void *alloc_progmem(unsigned long len) |
259 | { | 259 | { |
260 | void *addr; | 260 | void *addr; |
@@ -292,7 +292,7 @@ static long get_offset(unsigned long *size, Elf_Shdr * sechdr) | |||
292 | } | 292 | } |
293 | 293 | ||
294 | /* Lay out the SHF_ALLOC sections in a way not dissimilar to how ld | 294 | /* Lay out the SHF_ALLOC sections in a way not dissimilar to how ld |
295 | might -- code, read-only data, read-write data, small data. Tally | 295 | might -- code, read-only data, read-write data, small data. Tally |
296 | sizes, and place the offsets into sh_entsize fields: high bit means it | 296 | sizes, and place the offsets into sh_entsize fields: high bit means it |
297 | belongs in init. */ | 297 | belongs in init. */ |
298 | static void layout_sections(struct module *mod, const Elf_Ehdr * hdr, | 298 | static void layout_sections(struct module *mod, const Elf_Ehdr * hdr, |
@@ -386,7 +386,7 @@ static int apply_r_mips_pc16(struct module *me, uint32_t *location, | |||
386 | 386 | ||
387 | if( (rel > 32768) || (rel < -32768) ) { | 387 | if( (rel > 32768) || (rel < -32768) ) { |
388 | printk(KERN_DEBUG "VPE loader: " | 388 | printk(KERN_DEBUG "VPE loader: " |
389 | "apply_r_mips_pc16: relative address out of range 0x%x\n", rel); | 389 | "apply_r_mips_pc16: relative address out of range 0x%x\n", rel); |
390 | return -ENOEXEC; | 390 | return -ENOEXEC; |
391 | } | 391 | } |
392 | 392 | ||
@@ -458,7 +458,7 @@ static int apply_r_mips_lo16(struct module *me, uint32_t *location, | |||
458 | Elf32_Addr val, vallo; | 458 | Elf32_Addr val, vallo; |
459 | struct mips_hi16 *l, *next; | 459 | struct mips_hi16 *l, *next; |
460 | 460 | ||
461 | /* Sign extend the addend we extract from the lo insn. */ | 461 | /* Sign extend the addend we extract from the lo insn. */ |
462 | vallo = ((insnlo & 0xffff) ^ 0x8000) - 0x8000; | 462 | vallo = ((insnlo & 0xffff) ^ 0x8000) - 0x8000; |
463 | 463 | ||
464 | if (mips_hi16_list != NULL) { | 464 | if (mips_hi16_list != NULL) { |
@@ -470,7 +470,7 @@ static int apply_r_mips_lo16(struct module *me, uint32_t *location, | |||
470 | /* | 470 | /* |
471 | * The value for the HI16 had best be the same. | 471 | * The value for the HI16 had best be the same. |
472 | */ | 472 | */ |
473 | if (v != l->value) { | 473 | if (v != l->value) { |
474 | printk(KERN_DEBUG "VPE loader: " | 474 | printk(KERN_DEBUG "VPE loader: " |
475 | "apply_r_mips_lo16/hi16: \t" | 475 | "apply_r_mips_lo16/hi16: \t" |
476 | "inconsistent value information\n"); | 476 | "inconsistent value information\n"); |
@@ -505,7 +505,7 @@ static int apply_r_mips_lo16(struct module *me, uint32_t *location, | |||
505 | } | 505 | } |
506 | 506 | ||
507 | /* | 507 | /* |
508 | * Ok, we're done with the HI16 relocs. Now deal with the LO16. | 508 | * Ok, we're done with the HI16 relocs. Now deal with the LO16. |
509 | */ | 509 | */ |
510 | val = v + vallo; | 510 | val = v + vallo; |
511 | insnlo = (insnlo & ~0xffff) | (val & 0xffff); | 511 | insnlo = (insnlo & ~0xffff) | (val & 0xffff); |
@@ -579,7 +579,7 @@ static int apply_relocations(Elf32_Shdr *sechdrs, | |||
579 | res = reloc_handlers[ELF32_R_TYPE(r_info)](me, location, v); | 579 | res = reloc_handlers[ELF32_R_TYPE(r_info)](me, location, v); |
580 | if( res ) { | 580 | if( res ) { |
581 | char *r = rstrs[ELF32_R_TYPE(r_info)]; | 581 | char *r = rstrs[ELF32_R_TYPE(r_info)]; |
582 | printk(KERN_WARNING "VPE loader: .text+0x%x " | 582 | printk(KERN_WARNING "VPE loader: .text+0x%x " |
583 | "relocation type %s for symbol \"%s\" failed\n", | 583 | "relocation type %s for symbol \"%s\" failed\n", |
584 | rel[i].r_offset, r ? r : "UNKNOWN", | 584 | rel[i].r_offset, r ? r : "UNKNOWN", |
585 | strtab + sym->st_name); | 585 | strtab + sym->st_name); |
@@ -772,7 +772,7 @@ static int vpe_run(struct vpe * v) | |||
772 | 772 | ||
773 | /* Set up the XTC bit in vpeconf0 to point at our tc */ | 773 | /* Set up the XTC bit in vpeconf0 to point at our tc */ |
774 | write_vpe_c0_vpeconf0( (read_vpe_c0_vpeconf0() & ~(VPECONF0_XTC)) | 774 | write_vpe_c0_vpeconf0( (read_vpe_c0_vpeconf0() & ~(VPECONF0_XTC)) |
775 | | (t->index << VPECONF0_XTC_SHIFT)); | 775 | | (t->index << VPECONF0_XTC_SHIFT)); |
776 | 776 | ||
777 | back_to_back_c0_hazard(); | 777 | back_to_back_c0_hazard(); |
778 | 778 | ||
@@ -926,34 +926,34 @@ static int vpe_elfload(struct vpe * v) | |||
926 | secstrings + sechdrs[i].sh_name, sechdrs[i].sh_addr); | 926 | secstrings + sechdrs[i].sh_name, sechdrs[i].sh_addr); |
927 | } | 927 | } |
928 | 928 | ||
929 | /* Fix up syms, so that st_value is a pointer to location. */ | 929 | /* Fix up syms, so that st_value is a pointer to location. */ |
930 | simplify_symbols(sechdrs, symindex, strtab, secstrings, | 930 | simplify_symbols(sechdrs, symindex, strtab, secstrings, |
931 | hdr->e_shnum, &mod); | 931 | hdr->e_shnum, &mod); |
932 | 932 | ||
933 | /* Now do relocations. */ | 933 | /* Now do relocations. */ |
934 | for (i = 1; i < hdr->e_shnum; i++) { | 934 | for (i = 1; i < hdr->e_shnum; i++) { |
935 | const char *strtab = (char *)sechdrs[strindex].sh_addr; | 935 | const char *strtab = (char *)sechdrs[strindex].sh_addr; |
936 | unsigned int info = sechdrs[i].sh_info; | 936 | unsigned int info = sechdrs[i].sh_info; |
937 | 937 | ||
938 | /* Not a valid relocation section? */ | 938 | /* Not a valid relocation section? */ |
939 | if (info >= hdr->e_shnum) | 939 | if (info >= hdr->e_shnum) |
940 | continue; | 940 | continue; |
941 | 941 | ||
942 | /* Don't bother with non-allocated sections */ | 942 | /* Don't bother with non-allocated sections */ |
943 | if (!(sechdrs[info].sh_flags & SHF_ALLOC)) | 943 | if (!(sechdrs[info].sh_flags & SHF_ALLOC)) |
944 | continue; | 944 | continue; |
945 | 945 | ||
946 | if (sechdrs[i].sh_type == SHT_REL) | 946 | if (sechdrs[i].sh_type == SHT_REL) |
947 | err = apply_relocations(sechdrs, strtab, symindex, i, | 947 | err = apply_relocations(sechdrs, strtab, symindex, i, |
948 | &mod); | 948 | &mod); |
949 | else if (sechdrs[i].sh_type == SHT_RELA) | 949 | else if (sechdrs[i].sh_type == SHT_RELA) |
950 | err = apply_relocate_add(sechdrs, strtab, symindex, i, | 950 | err = apply_relocate_add(sechdrs, strtab, symindex, i, |
951 | &mod); | 951 | &mod); |
952 | if (err < 0) | 952 | if (err < 0) |
953 | return err; | 953 | return err; |
954 | 954 | ||
955 | } | 955 | } |
956 | } else { | 956 | } else { |
957 | struct elf_phdr *phdr = (struct elf_phdr *) ((char *)hdr + hdr->e_phoff); | 957 | struct elf_phdr *phdr = (struct elf_phdr *) ((char *)hdr + hdr->e_phoff); |
958 | 958 | ||
959 | for (i = 0; i < hdr->e_phnum; i++) { | 959 | for (i = 0; i < hdr->e_phnum; i++) { |
@@ -968,16 +968,16 @@ static int vpe_elfload(struct vpe * v) | |||
968 | } | 968 | } |
969 | 969 | ||
970 | for (i = 0; i < hdr->e_shnum; i++) { | 970 | for (i = 0; i < hdr->e_shnum; i++) { |
971 | /* Internal symbols and strings. */ | 971 | /* Internal symbols and strings. */ |
972 | if (sechdrs[i].sh_type == SHT_SYMTAB) { | 972 | if (sechdrs[i].sh_type == SHT_SYMTAB) { |
973 | symindex = i; | 973 | symindex = i; |
974 | strindex = sechdrs[i].sh_link; | 974 | strindex = sechdrs[i].sh_link; |
975 | strtab = (char *)hdr + sechdrs[strindex].sh_offset; | 975 | strtab = (char *)hdr + sechdrs[strindex].sh_offset; |
976 | 976 | ||
977 | /* mark the symtab's address for when we try to find the | 977 | /* mark the symtab's address for when we try to find the |
978 | magic symbols */ | 978 | magic symbols */ |
979 | sechdrs[i].sh_addr = (size_t) hdr + sechdrs[i].sh_offset; | 979 | sechdrs[i].sh_addr = (size_t) hdr + sechdrs[i].sh_offset; |
980 | } | 980 | } |
981 | } | 981 | } |
982 | } | 982 | } |
983 | 983 | ||
@@ -1049,7 +1049,7 @@ static int getcwd(char *buff, int size) | |||
1049 | return ret; | 1049 | return ret; |
1050 | } | 1050 | } |
1051 | 1051 | ||
1052 | /* checks VPE is unused and gets ready to load program */ | 1052 | /* checks VPE is unused and gets ready to load program */ |
1053 | static int vpe_open(struct inode *inode, struct file *filp) | 1053 | static int vpe_open(struct inode *inode, struct file *filp) |
1054 | { | 1054 | { |
1055 | enum vpe_state state; | 1055 | enum vpe_state state; |
@@ -1121,11 +1121,11 @@ static int vpe_release(struct inode *inode, struct file *filp) | |||
1121 | if (vpe_elfload(v) >= 0) { | 1121 | if (vpe_elfload(v) >= 0) { |
1122 | vpe_run(v); | 1122 | vpe_run(v); |
1123 | } else { | 1123 | } else { |
1124 | printk(KERN_WARNING "VPE loader: ELF load failed.\n"); | 1124 | printk(KERN_WARNING "VPE loader: ELF load failed.\n"); |
1125 | ret = -ENOEXEC; | 1125 | ret = -ENOEXEC; |
1126 | } | 1126 | } |
1127 | } else { | 1127 | } else { |
1128 | printk(KERN_WARNING "VPE loader: only elf files are supported\n"); | 1128 | printk(KERN_WARNING "VPE loader: only elf files are supported\n"); |
1129 | ret = -ENOEXEC; | 1129 | ret = -ENOEXEC; |
1130 | } | 1130 | } |
1131 | 1131 | ||