25 |
* SUCH DAMAGE. |
* SUCH DAMAGE. |
26 |
* |
* |
27 |
* |
* |
28 |
* $Id: file.c,v 1.85 2005/04/06 21:28:36 debug Exp $ |
* $Id: file.c,v 1.88 2005/04/17 00:15:24 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: |
* memory. File formats recognized so far: |
56 |
|
|
57 |
|
|
58 |
/* ELF machine types as strings: (same as exec_elf.h) */ |
/* ELF machine types as strings: (same as exec_elf.h) */ |
59 |
#define N_ELF_MACHINE_TYPES 54 |
#define N_ELF_MACHINE_TYPES 64 |
60 |
static char *elf_machine_type[N_ELF_MACHINE_TYPES] = { |
static char *elf_machine_type[N_ELF_MACHINE_TYPES] = { |
61 |
"NONE", "M32", "SPARC", "386", /* 0..3 */ |
"NONE", "M32", "SPARC", "386", /* 0..3 */ |
62 |
"68K", "88K", "486", "860", /* 4..7 */ |
"68K", "88K", "486", "860", /* 4..7 */ |
71 |
"ARM", "ALPHA", "SH", "SPARCV9", /* 40..43 */ |
"ARM", "ALPHA", "SH", "SPARCV9", /* 40..43 */ |
72 |
"TRICORE", "ARC", "H8_300", "H8_300H", /* 44..47 */ |
"TRICORE", "ARC", "H8_300", "H8_300H", /* 44..47 */ |
73 |
"H8S", "H8_500", "IA_64", "MIPS_X", /* 48..51 */ |
"H8S", "H8_500", "IA_64", "MIPS_X", /* 48..51 */ |
74 |
"COLDFIRE", "68HC12" /* 52..53 */ |
"COLDFIRE", "68HC12", "unknown54", "unknown55", /* 52..55 */ |
75 |
|
"unknown56", "unknown57", "unknown58", "unknown59", /* 56..59 */ |
76 |
|
"unknown60", "unknown61", "AMD64", "unknown63" /* 60..63 */ |
77 |
}; |
}; |
78 |
|
|
79 |
|
|
1042 |
|
|
1043 |
ok = 0; |
ok = 0; |
1044 |
switch (arch) { |
switch (arch) { |
1045 |
|
case ARCH_ALPHA: |
1046 |
|
switch (emachine) { |
1047 |
|
case EM_ALPHA: |
1048 |
|
case -28634: |
1049 |
|
ok = 1; |
1050 |
|
} |
1051 |
|
break; |
1052 |
|
case ARCH_HPPA: |
1053 |
|
switch (emachine) { |
1054 |
|
case EM_PARISC: |
1055 |
|
ok = 1; |
1056 |
|
} |
1057 |
|
break; |
1058 |
case ARCH_MIPS: |
case ARCH_MIPS: |
1059 |
switch (emachine) { |
switch (emachine) { |
1060 |
case EM_MIPS: |
case EM_MIPS: |
1076 |
ok = 1; |
ok = 1; |
1077 |
} |
} |
1078 |
break; |
break; |
1079 |
case ARCH_HPPA: |
case ARCH_X86: |
1080 |
switch (emachine) { |
switch (emachine) { |
1081 |
case EM_PARISC: |
case EM_386: |
1082 |
|
case EM_486: |
1083 |
ok = 1; |
ok = 1; |
1084 |
} |
break; |
1085 |
break; |
case EM_AMD64: |
1086 |
case ARCH_ALPHA: |
*tocp = 1; |
|
switch (emachine) { |
|
|
case EM_ALPHA: |
|
|
case -28634: |
|
1087 |
ok = 1; |
ok = 1; |
1088 |
|
break; |
1089 |
} |
} |
1090 |
break; |
break; |
1091 |
default: |
default: |
1636 |
exit(1); |
exit(1); |
1637 |
} |
} |
1638 |
|
|
1639 |
|
if (size == 1474560) |
1640 |
|
fprintf(stderr, "Hm... this file is the size of a 1.44 MB " |
1641 |
|
"floppy image. Maybe you forgot the\n-d switch?\n"); |
1642 |
|
|
1643 |
/* |
/* |
1644 |
* Last resort: symbol definitions from nm (or nm -S): |
* Last resort: symbol definitions from nm (or nm -S): |
1645 |
* |
* |