diff options
author | Linus Torvalds <torvalds@woody.linux-foundation.org> | 2007-10-11 22:21:23 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@woody.linux-foundation.org> | 2007-10-11 22:21:23 -0400 |
commit | dd6d1844af33acb4edd0a40b1770d091a22c94be (patch) | |
tree | e6bd3549919773a13b770324a4dddb51b194b452 /arch/mips/kernel/vpe.c | |
parent | 19f71153b9be219756c6b2757921433a69b7975c (diff) | |
parent | aaf76a3245c02faba51c96b9a340c14d6bb0dcc0 (diff) |
Merge branch 'upstream' of git://ftp.linux-mips.org/pub/scm/upstream-linus
* 'upstream' of git://ftp.linux-mips.org/pub/scm/upstream-linus: (80 commits)
[MIPS] tlbex.c: Cleanup __init usage.
[MIPS] WRPPMC serial support move to platform device
[MIPS] R1: Fix hazard barriers to make kernels work on R2 also.
[MIPS] VPE: reimplement ELF loader.
[MIPS] cleanup WRPPMC include files
[MIPS] Add BUG_ON assertion for attempt to run kernel on the wrong CPU type.
[MIPS] SMP: Use ISO C struct initializer for local structs.
[MIPS] SMP: Kill useless casts.
[MIPS] Kill num_online_cpus() loops.
[MIPS] SMP: Implement smp_call_function_mask().
[MIPS] Make facility to convert CPU types to strings generally available.
[MIPS] Convert list of CPU types from #define to enum.
[MIPS] Optimize get_unaligned / put_unaligned implementations.
[MIPS] checkfiles: Fix "need space after that ','" errors.
[MIPS] Fix "no space between function name and open parenthesis" warnings.
[MIPS] Allow hardwiring of the CPU type to a single type for optimization.
[MIPS] tlbex: Size optimize code by declaring a few functions inline.
[MIPS] pg-r4k.c: Dump the generated code
[MIPS] Cobalt: Remove cobalt_machine_power_off()
[MIPS] Cobalt: Move reset port definition to arch/mips/cobalt/reset.c
...
Diffstat (limited to 'arch/mips/kernel/vpe.c')
-rw-r--r-- | arch/mips/kernel/vpe.c | 47 |
1 files changed, 12 insertions, 35 deletions
diff --git a/arch/mips/kernel/vpe.c b/arch/mips/kernel/vpe.c index 3c09b9785f4c..61b729fa0548 100644 --- a/arch/mips/kernel/vpe.c +++ b/arch/mips/kernel/vpe.c | |||
@@ -936,8 +936,18 @@ static int vpe_elfload(struct vpe * v) | |||
936 | 936 | ||
937 | } | 937 | } |
938 | } else { | 938 | } else { |
939 | for (i = 0; i < hdr->e_shnum; i++) { | 939 | struct elf_phdr *phdr = (struct elf_phdr *) ((char *)hdr + hdr->e_phoff); |
940 | 940 | ||
941 | for (i = 0; i < hdr->e_phnum; i++) { | ||
942 | if (phdr->p_type != PT_LOAD) | ||
943 | continue; | ||
944 | |||
945 | memcpy((void *)phdr->p_vaddr, (char *)hdr + phdr->p_offset, phdr->p_filesz); | ||
946 | memset((void *)phdr->p_vaddr + phdr->p_filesz, 0, phdr->p_memsz - phdr->p_filesz); | ||
947 | phdr++; | ||
948 | } | ||
949 | |||
950 | for (i = 0; i < hdr->e_shnum; i++) { | ||
941 | /* Internal symbols and strings. */ | 951 | /* Internal symbols and strings. */ |
942 | if (sechdrs[i].sh_type == SHT_SYMTAB) { | 952 | if (sechdrs[i].sh_type == SHT_SYMTAB) { |
943 | symindex = i; | 953 | symindex = i; |
@@ -948,39 +958,6 @@ static int vpe_elfload(struct vpe * v) | |||
948 | magic symbols */ | 958 | magic symbols */ |
949 | sechdrs[i].sh_addr = (size_t) hdr + sechdrs[i].sh_offset; | 959 | sechdrs[i].sh_addr = (size_t) hdr + sechdrs[i].sh_offset; |
950 | } | 960 | } |
951 | |||
952 | /* filter sections we dont want in the final image */ | ||
953 | if (!(sechdrs[i].sh_flags & SHF_ALLOC) || | ||
954 | (sechdrs[i].sh_type == SHT_MIPS_REGINFO)) { | ||
955 | printk( KERN_DEBUG " ignoring section, " | ||
956 | "name %s type %x address 0x%x \n", | ||
957 | secstrings + sechdrs[i].sh_name, | ||
958 | sechdrs[i].sh_type, sechdrs[i].sh_addr); | ||
959 | continue; | ||
960 | } | ||
961 | |||
962 | if (sechdrs[i].sh_addr < (unsigned int)v->load_addr) { | ||
963 | printk( KERN_WARNING "VPE loader: " | ||
964 | "fully linked image has invalid section, " | ||
965 | "name %s type %x address 0x%x, before load " | ||
966 | "address of 0x%x\n", | ||
967 | secstrings + sechdrs[i].sh_name, | ||
968 | sechdrs[i].sh_type, sechdrs[i].sh_addr, | ||
969 | (unsigned int)v->load_addr); | ||
970 | return -ENOEXEC; | ||
971 | } | ||
972 | |||
973 | printk(KERN_DEBUG " copying section sh_name %s, sh_addr 0x%x " | ||
974 | "size 0x%x0 from x%p\n", | ||
975 | secstrings + sechdrs[i].sh_name, sechdrs[i].sh_addr, | ||
976 | sechdrs[i].sh_size, hdr + sechdrs[i].sh_offset); | ||
977 | |||
978 | if (sechdrs[i].sh_type != SHT_NOBITS) | ||
979 | memcpy((void *)sechdrs[i].sh_addr, | ||
980 | (char *)hdr + sechdrs[i].sh_offset, | ||
981 | sechdrs[i].sh_size); | ||
982 | else | ||
983 | memset((void *)sechdrs[i].sh_addr, 0, sechdrs[i].sh_size); | ||
984 | } | 961 | } |
985 | } | 962 | } |
986 | 963 | ||
@@ -1044,7 +1021,7 @@ static int getcwd(char *buff, int size) | |||
1044 | old_fs = get_fs(); | 1021 | old_fs = get_fs(); |
1045 | set_fs(KERNEL_DS); | 1022 | set_fs(KERNEL_DS); |
1046 | 1023 | ||
1047 | ret = sys_getcwd(buff,size); | 1024 | ret = sys_getcwd(buff, size); |
1048 | 1025 | ||
1049 | set_fs(old_fs); | 1026 | set_fs(old_fs); |
1050 | 1027 | ||