--- trunk/src/file.c 2007/10/08 16:20:32 29 +++ trunk/src/file.c 2007/10/08 16:20:40 30 @@ -25,7 +25,7 @@ * SUCH DAMAGE. * * - * $Id: file.c,v 1.132 2006/07/09 05:51:28 debug Exp $ + * $Id: file.c,v 1.134 2006/08/12 11:43:12 debug Exp $ * * This file contains functions which load executable images into (emulated) * memory. File formats recognized so far are: @@ -1163,11 +1163,16 @@ char *filename, uint64_t *entrypointp) { FILE *f; - int len; + int len, sign3264; unsigned char buf[16384]; uint64_t entry, loadaddr, vaddr, skip = 0; char *p, *p2; + /* Special case for 32-bit MIPS: */ + sign3264 = 0; + if (m->arch == ARCH_MIPS && m->cpus[0]->is_32bit) + sign3264 = 1; + p = strchr(filename, ':'); if (p == NULL) { fprintf(stderr, "\n"); @@ -1191,6 +1196,13 @@ } else p = p2; + if (sign3264) { + loadaddr = (int64_t)(int32_t)loadaddr; + entry = (int64_t)(int32_t)entry; + vaddr = (int64_t)(int32_t)vaddr; + skip = (int64_t)(int32_t)skip; + } + f = fopen(strrchr(filename, ':')+1, "r"); if (f == NULL) { perror(p); @@ -1483,12 +1495,12 @@ debug("%08"PRIx32"\n", (uint32_t) eentry); /* - * SH64: 32-bit instruction encoding? TODO + * SH64: 32-bit instruction encoding? */ if (arch == ARCH_SH && (eentry & 1)) { debug("SH64: 32-bit instruction encoding\n"); m->cpus[0]->cd.sh.compact = 0; - m->cpus[0]->cd.sh.bits = 64; + m->cpus[0]->cd.sh.cpu_type.bits = 64; } /* Read the program headers: */