diff options
author | Paul Mackerras <paulus@samba.org> | 2008-04-14 07:11:02 -0400 |
---|---|---|
committer | Paul Mackerras <paulus@samba.org> | 2008-04-14 07:11:02 -0400 |
commit | ac7c5353b189e10cf5dd27399f64f7b013abffc6 (patch) | |
tree | 8222d92b774c256d6ec4399c716d76b3f05ddc4b /arch/powerpc/oprofile | |
parent | a8f75ea70c58546205fb7673be41455b9da5d9a7 (diff) | |
parent | 120dd64cacd4fb796bca0acba3665553f1d9ecaa (diff) |
Merge branch 'linux-2.6'
Diffstat (limited to 'arch/powerpc/oprofile')
-rw-r--r-- | arch/powerpc/oprofile/cell/vma_map.c | 37 |
1 files changed, 16 insertions, 21 deletions
diff --git a/arch/powerpc/oprofile/cell/vma_map.c b/arch/powerpc/oprofile/cell/vma_map.c index 5cf53681430a..fff66662d021 100644 --- a/arch/powerpc/oprofile/cell/vma_map.c +++ b/arch/powerpc/oprofile/cell/vma_map.c | |||
@@ -92,7 +92,7 @@ vma_map_add(struct vma_to_fileoffset_map *map, unsigned int vma, | |||
92 | * A pointer to the first vma_map in the generated list | 92 | * A pointer to the first vma_map in the generated list |
93 | * of vma_maps is returned. */ | 93 | * of vma_maps is returned. */ |
94 | struct vma_to_fileoffset_map *create_vma_map(const struct spu *aSpu, | 94 | struct vma_to_fileoffset_map *create_vma_map(const struct spu *aSpu, |
95 | unsigned long spu_elf_start) | 95 | unsigned long __spu_elf_start) |
96 | { | 96 | { |
97 | static const unsigned char expected[EI_PAD] = { | 97 | static const unsigned char expected[EI_PAD] = { |
98 | [EI_MAG0] = ELFMAG0, | 98 | [EI_MAG0] = ELFMAG0, |
@@ -107,9 +107,11 @@ struct vma_to_fileoffset_map *create_vma_map(const struct spu *aSpu, | |||
107 | 107 | ||
108 | int grd_val; | 108 | int grd_val; |
109 | struct vma_to_fileoffset_map *map = NULL; | 109 | struct vma_to_fileoffset_map *map = NULL; |
110 | void __user *spu_elf_start = (void __user *)__spu_elf_start; | ||
110 | struct spu_overlay_info ovly; | 111 | struct spu_overlay_info ovly; |
111 | unsigned int overlay_tbl_offset = -1; | 112 | unsigned int overlay_tbl_offset = -1; |
112 | unsigned long phdr_start, shdr_start; | 113 | Elf32_Phdr __user *phdr_start; |
114 | Elf32_Shdr __user *shdr_start; | ||
113 | Elf32_Ehdr ehdr; | 115 | Elf32_Ehdr ehdr; |
114 | Elf32_Phdr phdr; | 116 | Elf32_Phdr phdr; |
115 | Elf32_Shdr shdr, shdr_str; | 117 | Elf32_Shdr shdr, shdr_str; |
@@ -121,12 +123,12 @@ struct vma_to_fileoffset_map *create_vma_map(const struct spu *aSpu, | |||
121 | unsigned int ovly_buf_table_sym = 0; | 123 | unsigned int ovly_buf_table_sym = 0; |
122 | unsigned int ovly_table_end_sym = 0; | 124 | unsigned int ovly_table_end_sym = 0; |
123 | unsigned int ovly_buf_table_end_sym = 0; | 125 | unsigned int ovly_buf_table_end_sym = 0; |
124 | unsigned long ovly_table; | 126 | struct spu_overlay_info __user *ovly_table; |
125 | unsigned int n_ovlys; | 127 | unsigned int n_ovlys; |
126 | 128 | ||
127 | /* Get and validate ELF header. */ | 129 | /* Get and validate ELF header. */ |
128 | 130 | ||
129 | if (copy_from_user(&ehdr, (void *) spu_elf_start, sizeof (ehdr))) | 131 | if (copy_from_user(&ehdr, spu_elf_start, sizeof (ehdr))) |
130 | goto fail; | 132 | goto fail; |
131 | 133 | ||
132 | if (memcmp(ehdr.e_ident, expected, EI_PAD) != 0) { | 134 | if (memcmp(ehdr.e_ident, expected, EI_PAD) != 0) { |
@@ -152,9 +154,7 @@ struct vma_to_fileoffset_map *create_vma_map(const struct spu *aSpu, | |||
152 | 154 | ||
153 | /* Traverse program headers. */ | 155 | /* Traverse program headers. */ |
154 | for (i = 0; i < ehdr.e_phnum; i++) { | 156 | for (i = 0; i < ehdr.e_phnum; i++) { |
155 | if (copy_from_user(&phdr, | 157 | if (copy_from_user(&phdr, phdr_start + i, sizeof(phdr))) |
156 | (void *) (phdr_start + i * sizeof(phdr)), | ||
157 | sizeof(phdr))) | ||
158 | goto fail; | 158 | goto fail; |
159 | 159 | ||
160 | if (phdr.p_type != PT_LOAD) | 160 | if (phdr.p_type != PT_LOAD) |
@@ -171,9 +171,7 @@ struct vma_to_fileoffset_map *create_vma_map(const struct spu *aSpu, | |||
171 | pr_debug("SPU_PROF: Created non-overlay maps\n"); | 171 | pr_debug("SPU_PROF: Created non-overlay maps\n"); |
172 | /* Traverse section table and search for overlay-related symbols. */ | 172 | /* Traverse section table and search for overlay-related symbols. */ |
173 | for (i = 0; i < ehdr.e_shnum; i++) { | 173 | for (i = 0; i < ehdr.e_shnum; i++) { |
174 | if (copy_from_user(&shdr, | 174 | if (copy_from_user(&shdr, shdr_start + i, sizeof(shdr))) |
175 | (void *) (shdr_start + i * sizeof(shdr)), | ||
176 | sizeof(shdr))) | ||
177 | goto fail; | 175 | goto fail; |
178 | 176 | ||
179 | if (shdr.sh_type != SHT_SYMTAB) | 177 | if (shdr.sh_type != SHT_SYMTAB) |
@@ -182,8 +180,7 @@ struct vma_to_fileoffset_map *create_vma_map(const struct spu *aSpu, | |||
182 | continue; | 180 | continue; |
183 | 181 | ||
184 | if (copy_from_user(&shdr_str, | 182 | if (copy_from_user(&shdr_str, |
185 | (void *) (shdr_start + shdr.sh_link * | 183 | shdr_start + shdr.sh_link, |
186 | sizeof(shdr)), | ||
187 | sizeof(shdr))) | 184 | sizeof(shdr))) |
188 | goto fail; | 185 | goto fail; |
189 | 186 | ||
@@ -191,15 +188,15 @@ struct vma_to_fileoffset_map *create_vma_map(const struct spu *aSpu, | |||
191 | goto fail;; | 188 | goto fail;; |
192 | 189 | ||
193 | for (j = 0; j < shdr.sh_size / sizeof (sym); j++) { | 190 | for (j = 0; j < shdr.sh_size / sizeof (sym); j++) { |
194 | if (copy_from_user(&sym, (void *) (spu_elf_start + | 191 | if (copy_from_user(&sym, spu_elf_start + |
195 | shdr.sh_offset + j * | 192 | shdr.sh_offset + |
196 | sizeof (sym)), | 193 | j * sizeof (sym), |
197 | sizeof (sym))) | 194 | sizeof (sym))) |
198 | goto fail; | 195 | goto fail; |
199 | 196 | ||
200 | if (copy_from_user(name, (void *) | 197 | if (copy_from_user(name, |
201 | (spu_elf_start + shdr_str.sh_offset + | 198 | spu_elf_start + shdr_str.sh_offset + |
202 | sym.st_name), | 199 | sym.st_name, |
203 | 20)) | 200 | 20)) |
204 | goto fail; | 201 | goto fail; |
205 | 202 | ||
@@ -245,9 +242,7 @@ struct vma_to_fileoffset_map *create_vma_map(const struct spu *aSpu, | |||
245 | 242 | ||
246 | /* Traverse overlay table. */ | 243 | /* Traverse overlay table. */ |
247 | for (i = 0; i < n_ovlys; i++) { | 244 | for (i = 0; i < n_ovlys; i++) { |
248 | if (copy_from_user(&ovly, (void *) | 245 | if (copy_from_user(&ovly, ovly_table + i, sizeof (ovly))) |
249 | (ovly_table + i * sizeof (ovly)), | ||
250 | sizeof (ovly))) | ||
251 | goto fail; | 246 | goto fail; |
252 | 247 | ||
253 | /* The ovly.vma/size/offset arguments are analogous to the same | 248 | /* The ovly.vma/size/offset arguments are analogous to the same |