Line 58... |
Line 58... |
char *outbuf;
|
char *outbuf;
|
unsigned int outP;
|
unsigned int outP;
|
int interrupt_table_written = 0;
|
int interrupt_table_written = 0;
|
int interrupt_table_zero_written = 0;
|
int interrupt_table_zero_written = 0;
|
|
|
|
|
/* Create buffer to hold interrupt vector memory values
|
/* Create buffer to hold interrupt vector memory values
|
Can't copy these into mem0 locations until ready to pass control
|
Can't copy these into mem0 locations until ready to pass control
|
t new program
|
t new program
|
*/
|
*/
|
elf_mem0_g = malloc(sizeof(mem_buf_t));
|
elf_mem0_g = malloc(sizeof(mem_buf_t));
|
Line 76... |
Line 75... |
if (strncmp((char*)elfHeader->e_ident+1,"ELF",3)) {
|
if (strncmp((char*)elfHeader->e_ident+1,"ELF",3)) {
|
return(1);
|
return(1);
|
}
|
}
|
|
|
if (elfHeader->e_machine != 40) {
|
if (elfHeader->e_machine != 40) {
|
telnet_broadcast ("%s ERROR: ELF file not targetting correct processor type.\r\n",
|
print_serial ("%s:L%d ERROR: ELF file not targetting correct processor type.\r\n",
|
__func__);
|
__FILE__, __LINE__);
|
return(1);
|
return(1);
|
}
|
}
|
|
|
|
|
for (i=0;i<elfHeader->e_shnum;++i) {
|
for (i=0;i<elfHeader->e_shnum;++i) {
|
Line 93... |
Line 92... |
k = j + elfSection->sh_offset;
|
k = j + elfSection->sh_offset;
|
outP = elfSection->sh_addr + j;
|
outP = elfSection->sh_addr + j;
|
|
|
/* debug */
|
/* debug */
|
if (outP >= ADR_EXEC_BASE)
|
if (outP >= ADR_EXEC_BASE)
|
telnet_broadcast("%s ERROR: 1 outP value 0x%08x\r\n",__func__, outP);
|
print_serial("%s:L%d ERROR: 1 outP value 0x%08x\r\n",__FILE__, __LINE__, outP);
|
else if (outP > MEM_BUF_ENTRIES)
|
else if (outP > MEM_BUF_ENTRIES)
|
outbuf[outP] = inbuf[k];
|
outbuf[outP] = inbuf[k];
|
else {
|
else {
|
elf_mem0_g->entry[outP].valid = 1;
|
elf_mem0_g->entry[outP].valid = 1;
|
elf_mem0_g->entry[outP].data = inbuf[k];
|
elf_mem0_g->entry[outP].data = inbuf[k];
|
Line 110... |
Line 109... |
for (j=0; j<elfSection->sh_size; j++) {
|
for (j=0; j<elfSection->sh_size; j++) {
|
outP = j + elfSection->sh_addr;
|
outP = j + elfSection->sh_addr;
|
|
|
/* debug */
|
/* debug */
|
if (outP >= ADR_EXEC_BASE)
|
if (outP >= ADR_EXEC_BASE)
|
telnet_broadcast("%s ERROR: 2 outP value 0x%08x\r\n",__func__, outP);
|
print_serial("%s:L%d ERROR: 2 outP value 0x%08x\r\n",__FILE__, __LINE__, outP);
|
else if (outP > MEM_BUF_ENTRIES)
|
else if (outP > MEM_BUF_ENTRIES)
|
outbuf[outP] = 0;
|
outbuf[outP] = 0;
|
else {
|
else {
|
elf_mem0_g->entry[outP].valid = 1;
|
elf_mem0_g->entry[outP].valid = 1;
|
elf_mem0_g->entry[outP].data = 0;
|
elf_mem0_g->entry[outP].data = 0;
|
Line 122... |
Line 121... |
}
|
}
|
}
|
}
|
}
|
}
|
}
|
}
|
|
|
/*
|
|
if (interrupt_table_written)
|
|
telnet_broadcast ("%s WARNING: Interrupt table writes\r\n",__func__);
|
|
if (interrupt_table_zero_written)
|
|
telnet_broadcast ("%s WARNING: Interrupt table ZERO writes\r\n",__func__);
|
|
*/
|
|
return 0;
|
return 0;
|
}
|
}
|
|
|
|
|
No newline at end of file
|
No newline at end of file
|