/[gxemul]/trunk/src/file.c
This is repository of my old source code which isn't updated any more. Go to git.rot13.org for current projects!
ViewVC logotype

Diff of /trunk/src/file.c

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 29 by dpavlin, Mon Oct 8 16:20:26 2007 UTC revision 30 by dpavlin, Mon Oct 8 16:20:40 2007 UTC
# Line 25  Line 25 
25   *  SUCH DAMAGE.   *  SUCH DAMAGE.
26   *   *
27   *   *
28   *  $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 $
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:
# Line 1163  static void file_load_raw(struct machine Line 1163  static void file_load_raw(struct machine
1163          char *filename, uint64_t *entrypointp)          char *filename, uint64_t *entrypointp)
1164  {  {
1165          FILE *f;          FILE *f;
1166          int len;          int len, sign3264;
1167          unsigned char buf[16384];          unsigned char buf[16384];
1168          uint64_t entry, loadaddr, vaddr, skip = 0;          uint64_t entry, loadaddr, vaddr, skip = 0;
1169          char *p, *p2;          char *p, *p2;
1170    
1171            /*  Special case for 32-bit MIPS:  */
1172            sign3264 = 0;
1173            if (m->arch == ARCH_MIPS && m->cpus[0]->is_32bit)
1174                    sign3264 = 1;
1175    
1176          p = strchr(filename, ':');          p = strchr(filename, ':');
1177          if (p == NULL) {          if (p == NULL) {
1178                  fprintf(stderr, "\n");                  fprintf(stderr, "\n");
# Line 1191  static void file_load_raw(struct machine Line 1196  static void file_load_raw(struct machine
1196          } else          } else
1197                  p = p2;                  p = p2;
1198    
1199            if (sign3264) {
1200                    loadaddr = (int64_t)(int32_t)loadaddr;
1201                    entry = (int64_t)(int32_t)entry;
1202                    vaddr = (int64_t)(int32_t)vaddr;
1203                    skip = (int64_t)(int32_t)skip;
1204            }
1205    
1206          f = fopen(strrchr(filename, ':')+1, "r");          f = fopen(strrchr(filename, ':')+1, "r");
1207          if (f == NULL) {          if (f == NULL) {
1208                  perror(p);                  perror(p);
# Line 1483  static void file_load_elf(struct machine Line 1495  static void file_load_elf(struct machine
1495                  debug("%08"PRIx32"\n", (uint32_t) eentry);                  debug("%08"PRIx32"\n", (uint32_t) eentry);
1496    
1497          /*          /*
1498           *  SH64: 32-bit instruction encoding?  TODO           *  SH64: 32-bit instruction encoding?
1499           */           */
1500          if (arch == ARCH_SH && (eentry & 1)) {          if (arch == ARCH_SH && (eentry & 1)) {
1501                  debug("SH64: 32-bit instruction encoding\n");                  debug("SH64: 32-bit instruction encoding\n");
1502                  m->cpus[0]->cd.sh.compact = 0;                  m->cpus[0]->cd.sh.compact = 0;
1503                  m->cpus[0]->cd.sh.bits = 64;                  m->cpus[0]->cd.sh.cpu_type.bits = 64;
1504          }          }
1505    
1506          /*  Read the program headers:  */          /*  Read the program headers:  */

Legend:
Removed from v.29  
changed lines
  Added in v.30

  ViewVC Help
Powered by ViewVC 1.1.26