Line 110... |
Line 110... |
printf("can't translate\n", laddr);
|
printf("can't translate\n", laddr);
|
exit(1);
|
exit(1);
|
return -1;
|
return -1;
|
}
|
}
|
|
|
void addlabel(char *label, unsigned long freemem,int* breakpoint)
|
|
{
|
|
struct label_entry **tmp;
|
|
struct mem_entry *entry;
|
|
debug("Adding label %s at 0x%x\n", label, translate(freemem,breakpoint));
|
|
if(!verify_memoryarea(freemem) || !cur_area->getentry) return;
|
|
|
|
entry = cur_area->getentry(translate(freemem,breakpoint));
|
|
if(!entry) return;
|
|
|
|
tmp = &(entry->label);
|
|
for (; *tmp; tmp = &((*tmp)->next));
|
|
*tmp = malloc(sizeof(**tmp));
|
|
(*tmp)->name = malloc(strlen(label)+1);
|
|
strcpy((*tmp)->name, label);
|
|
(*tmp)->next = NULL;
|
|
|
|
return;
|
|
}
|
|
|
|
char null_str[1] = "\0";
|
char null_str[1] = "\0";
|
|
|
/* Modified by CZ 26/05/01 */
|
/* Modified by CZ 26/05/01 */
|
/* Replaced several calls to translate(freemem) with vaddr */
|
/* Replaced several calls to translate(freemem) with vaddr */
|
/* Added new mode execution code */
|
/* Added new mode execution code */
|
Line 306... |
Line 286... |
/* If not important or not in text, skip. */
|
/* If not important or not in text, skip. */
|
if (COFF_SHORT_H(coffsymhdr.e_type) & COFF_N_TMASK & COFF_STYP_TEXT) {
|
if (COFF_SHORT_H(coffsymhdr.e_type) & COFF_N_TMASK & COFF_STYP_TEXT) {
|
|
|
if (*((unsigned long *)coffsymhdr.e.e.e_zeroes)) {
|
if (*((unsigned long *)coffsymhdr.e.e.e_zeroes)) {
|
if (strlen(coffsymhdr.e.e_name) && strlen(coffsymhdr.e.e_name) < 9)
|
if (strlen(coffsymhdr.e.e_name) && strlen(coffsymhdr.e.e_name) < 9)
|
addlabel(coffsymhdr.e.e_name, COFF_LONG_H(coffsymhdr.e_value),&breakpoint);
|
add_label(COFF_LONG_H(coffsymhdr.e_value), coffsymhdr.e.e_name);
|
debug("[%i] Symbol: %s,", count++, coffsymhdr.e.e_name);
|
debug("[%i] Symbol: %s,", count++, coffsymhdr.e.e_name);
|
} else {
|
} else {
|
long fpos = ftell (inputfs);
|
long fpos = ftell (inputfs);
|
|
|
if (fseek(inputfs, symptr + nsyms * COFF_SYMESZ + COFF_LONG_H(coffsymhdr.e.e.e_offset), SEEK_SET) == 0) {
|
if (fseek(inputfs, symptr + nsyms * COFF_SYMESZ + COFF_LONG_H(coffsymhdr.e.e.e_offset), SEEK_SET) == 0) {
|
char tmp[33], *s = &tmp[0];
|
char tmp[33], *s = &tmp[0];
|
while (s != &tmp[32])
|
while (s != &tmp[32])
|
if ((*(s++) = fgetc(inputfs)) == 0) break;
|
if ((*(s++) = fgetc(inputfs)) == 0) break;
|
tmp[32] = 0;
|
tmp[32] = 0;
|
addlabel(&tmp[0], COFF_LONG_H(coffsymhdr.e_value),&breakpoint);
|
add_label(COFF_LONG_H(coffsymhdr.e_value), &tmp[0]);
|
debug("[%i] Symbol: %s,", count++, &tmp[0]);
|
debug("[%i] Symbol: %s,", count++, &tmp[0]);
|
}
|
}
|
fseek(inputfs, fpos, SEEK_SET);
|
fseek(inputfs, fpos, SEEK_SET);
|
}
|
}
|
|
|