20 #include <linux/string.h>
22 #include <linux/elf.h>
23 #include <linux/slab.h>
38 const struct spu *aSpu,
int *grd_val)
51 if (vma < map->vma || vma >= map->
vma + map->
size)
96 unsigned long __spu_elf_start)
98 static const unsigned char expected[
EI_PAD] = {
111 void __user *spu_elf_start = (
void __user *)__spu_elf_start;
113 unsigned int overlay_tbl_offset = -1;
123 unsigned int ovly_table_sym = 0;
124 unsigned int ovly_buf_table_sym = 0;
125 unsigned int ovly_table_end_sym = 0;
126 unsigned int ovly_buf_table_end_sym = 0;
128 unsigned int n_ovlys;
137 "%s, line %d: Unexpected e_ident parsing SPU ELF\n",
143 "%s, line %d: Unexpected e_machine parsing SPU ELF\n",
149 "%s, line %d: Unexpected e_type parsing SPU ELF\n",
153 phdr_start = spu_elf_start + ehdr.
e_phoff;
154 shdr_start = spu_elf_start + ehdr.
e_shoff;
157 for (i = 0; i < ehdr.
e_phnum; i++) {
172 pr_debug(
"SPU_PROF: Created non-overlay maps\n");
174 for (i = 0; i < ehdr.
e_shnum; i++) {
191 for (j = 0; j < shdr.
sh_size /
sizeof (sym); j++) {
204 if (
memcmp(name,
"_ovly_table", 12) == 0)
206 if (
memcmp(name,
"_ovly_buf_table", 16) == 0)
208 if (
memcmp(name,
"_ovly_table_end", 16) == 0)
210 if (
memcmp(name,
"_ovly_buf_table_end", 20) == 0)
211 ovly_buf_table_end_sym = sym.
st_value;
216 if (ovly_table_sym == 0 || ovly_buf_table_sym == 0
217 || ovly_table_end_sym == 0 || ovly_buf_table_end_sym == 0) {
218 pr_debug(
"SPU_PROF: No overlay table found\n");
221 pr_debug(
"SPU_PROF: Overlay table found\n");
233 if (overlay_tbl_offset > 0x10000000) {
235 "%s, line %d: Error finding SPU overlay table\n",
239 ovly_table = spu_elf_start + overlay_tbl_offset;
241 n_ovlys = (ovly_table_end_sym -
242 ovly_table_sym) /
sizeof (ovly);
245 for (i = 0; i < n_ovlys; i++) {
273 ovly_buf_table_sym + (ovly.
buf-1) * 4, i+1);