25 |
* SUCH DAMAGE. |
* SUCH DAMAGE. |
26 |
* |
* |
27 |
* |
* |
28 |
* $Id: file.c,v 1.116 2005/09/30 14:07:45 debug Exp $ |
* $Id: file.c,v 1.119 2005/11/19 21:00:59 debug Exp $ |
29 |
* |
* |
30 |
* This file contains functions which load executable images into (emulated) |
* This file contains functions which load executable images into (emulated) |
31 |
* memory. File formats recognized so far are: |
* memory. File formats recognized so far are: |
1392 |
} |
} |
1393 |
break; |
break; |
1394 |
case ARCH_MIPS: |
case ARCH_MIPS: |
1395 |
|
case ARCH_NEWMIPS: |
1396 |
switch (emachine) { |
switch (emachine) { |
1397 |
case EM_MIPS: |
case EM_MIPS: |
1398 |
case EM_MIPS_RS3_LE: |
case EM_MIPS_RS3_LE: |
1463 |
* TODO: Find out what e_flag actually contains. |
* TODO: Find out what e_flag actually contains. |
1464 |
* TODO 2: This only sets mips16 for cpu 0. Yuck. Fix this! |
* TODO 2: This only sets mips16 for cpu 0. Yuck. Fix this! |
1465 |
*/ |
*/ |
1466 |
if (arch == ARCH_MIPS && ((eflags >> 24) & 0xff) == 0x24) { |
if ((arch == ARCH_MIPS || arch == ARCH_NEWMIPS) |
1467 |
|
&& ((eflags >> 24) & 0xff) == 0x24) { |
1468 |
debug("MIPS16 encoding (e_flags = 0x%08x)\n", eflags); |
debug("MIPS16 encoding (e_flags = 0x%08x)\n", eflags); |
1469 |
#ifdef ENABLE_MIPS16 |
#ifdef ENABLE_MIPS16 |
1470 |
m->cpus[0]->cd.mips.mips16 = 1; |
m->cpus[0]->cd.mips.mips16 = 1; |
1473 |
"(or use the --mips16 configure option)\n"); |
"(or use the --mips16 configure option)\n"); |
1474 |
exit(1); |
exit(1); |
1475 |
#endif |
#endif |
1476 |
} else if (arch == ARCH_MIPS && (eentry & 0x3)) { |
} else if ((arch == ARCH_MIPS || arch == ARCH_NEWMIPS) |
1477 |
|
&& (eentry & 0x3)) { |
1478 |
debug("MIPS16 encoding (eentry not 32-bit aligned)\n"); |
debug("MIPS16 encoding (eentry not 32-bit aligned)\n"); |
1479 |
#ifdef ENABLE_MIPS16 |
#ifdef ENABLE_MIPS16 |
1480 |
m->cpus[0]->cd.mips.mips16 = 1; |
m->cpus[0]->cd.mips.mips16 = 1; |
1530 |
unencode(p_align, &phdr32.p_align, Elf32_Word); |
unencode(p_align, &phdr32.p_align, Elf32_Word); |
1531 |
} |
} |
1532 |
|
|
1533 |
|
/* |
1534 |
|
* Hack for loading Linux/PPC kernels, linked to high |
1535 |
|
* addresses, at low addresses. |
1536 |
|
*/ |
1537 |
|
if (arch == ARCH_PPC) { |
1538 |
|
if (elf64) { |
1539 |
|
p_vaddr &= 0x0fffffffffffffffULL; |
1540 |
|
p_paddr &= 0x0fffffffffffffffULL; |
1541 |
|
} else { |
1542 |
|
p_vaddr &= 0x0fffffff; |
1543 |
|
p_paddr &= 0x0fffffff; |
1544 |
|
} |
1545 |
|
} |
1546 |
|
|
1547 |
if (p_memsz != 0 && (p_type == PT_LOAD || |
if (p_memsz != 0 && (p_type == PT_LOAD || |
1548 |
(p_type & PF_MASKPROC) == PT_MIPS_REGINFO)) { |
(p_type & PF_MASKPROC) == PT_MIPS_REGINFO)) { |
1549 |
debug("chunk %i (", i); |
debug("chunk %i (", i); |
1784 |
} else { |
} else { |
1785 |
sym32 = symbols_sym32[i]; |
sym32 = symbols_sym32[i]; |
1786 |
unencode(st_name, &sym32.st_name, Elf32_Word); |
unencode(st_name, &sym32.st_name, Elf32_Word); |
1787 |
unencode(st_info, &sym64.st_info, Elf_Byte); |
unencode(st_info, &sym32.st_info, Elf_Byte); |
1788 |
unencode(addr, &sym32.st_value, Elf32_Word); |
unencode(addr, &sym32.st_value, Elf32_Word); |
1789 |
unencode(size, &sym32.st_size, Elf32_Word); |
unencode(size, &sym32.st_size, Elf32_Word); |
1790 |
} |
} |