/[gxemul]/trunk/src/emul.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/emul.c

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

revision 6 by dpavlin, Mon Oct 8 16:18:11 2007 UTC revision 20 by dpavlin, Mon Oct 8 16:19:23 2007 UTC
# Line 25  Line 25 
25   *  SUCH DAMAGE.   *  SUCH DAMAGE.
26   *   *
27   *   *
28   *  $Id: emul.c,v 1.203 2005/06/03 07:39:27 debug Exp $   *  $Id: emul.c,v 1.238 2005/11/19 18:53:06 debug Exp $
29   *   *
30   *  Emulation startup and misc. routines.   *  Emulation startup and misc. routines.
31   */   */
# Line 46  Line 46 
46  #include "debugger.h"  #include "debugger.h"
47  #include "device.h"  #include "device.h"
48  #include "diskimage.h"  #include "diskimage.h"
49    #include "exec_elf.h"
50  #include "machine.h"  #include "machine.h"
51  #include "memory.h"  #include "memory.h"
52  #include "mips_cpu_types.h"  #include "mips_cpu_types.h"
# Line 111  static void add_dump_points(struct machi Line 112  static void add_dump_points(struct machi
112                   *  were automatically converted into the correct address.                   *  were automatically converted into the correct address.
113                   */                   */
114    
115                  if ((dp >> 32) == 0 && ((dp >> 31) & 1))                  if (m->arch == ARCH_MIPS) {
116                          dp |= 0xffffffff00000000ULL;                          if ((dp >> 32) == 0 && ((dp >> 31) & 1))
117                                    dp |= 0xffffffff00000000ULL;
118                    }
119    
120                  m->breakpoint_addr[i] = dp;                  m->breakpoint_addr[i] = dp;
121    
122                  debug("breakpoint %i: 0x%016llx", i, (long long)dp);                  debug("breakpoint %i: 0x%llx", i, (long long)dp);
123                  if (string_flag)                  if (string_flag)
124                          debug(" (%s)", m->breakpoint_string[i]);                          debug(" (%s)", m->breakpoint_string[i]);
125                  debug("\n");                  debug("\n");
# Line 434  ret: Line 438  ret:
438    
439    
440  /*  /*
441     *  apple_load_bootblock():
442     *
443     *  Try to load a kernel from a disk image with an Apple Partition Table.
444     *
445     *  TODO: This function uses too many magic offsets and so on; it should be
446     *  cleaned up some day. See http://www.awprofessional.com/articles/
447     *      article.asp?p=376123&seqNum=3&rl=1  for some info on the Apple
448     *  partition format.
449     *
450     *  Returns 1 on success, 0 on failure.
451     */
452    static int apple_load_bootblock(struct machine *m, struct cpu *cpu,
453            int disk_id, int disk_type, int *n_loadp, char ***load_namesp)
454    {
455            unsigned char buf[0x8000];
456            int res, partnr, n_partitions = 0, n_hfs_partitions = 0;
457            uint64_t hfs_start, hfs_length;
458    
459            res = diskimage_access(m, disk_id, disk_type, 0, 0x0, buf, sizeof(buf));
460            if (!res) {
461                    fatal("apple_load_bootblock: couldn't read the disk "
462                        "image. Aborting.\n");
463                    return 0;
464            }
465    
466            partnr = 0;
467            do {
468                    int start, length;
469                    int ofs = 0x200 * (partnr + 1);
470                    if (partnr == 0)
471                            n_partitions = buf[ofs + 7];
472                    start = (buf[ofs + 8] << 24) + (buf[ofs + 9] << 16) +
473                        (buf[ofs + 10] << 8) + buf[ofs + 11];
474                    length = (buf[ofs + 12] << 24) + (buf[ofs + 13] << 16) +
475                        (buf[ofs + 14] << 8) + buf[ofs + 15];
476    
477                    debug("partition %i: '%s', type '%s', start %i, length %i\n",
478                        partnr, buf + ofs + 0x10, buf + ofs + 0x30,
479                        start, length);
480    
481                    if (strcmp((char *)buf + ofs + 0x30, "Apple_HFS") == 0) {
482                            n_hfs_partitions ++;
483                            hfs_start = 512 * start;
484                            hfs_length = 512 * length;
485                    }
486    
487                    /*  Any more partitions?  */
488                    partnr ++;
489            } while (partnr < n_partitions);
490    
491            if (n_hfs_partitions == 0) {
492                    fatal("Error: No HFS partition found! TODO\n");
493                    return 0;
494            }
495            if (n_hfs_partitions >= 2) {
496                    fatal("Error: Too many HFS partitions found! TODO\n");
497                    return 0;
498            }
499    
500            return 0;
501    }
502    
503    
504    /*
505   *  load_bootblock():   *  load_bootblock():
506   *   *
507   *  For some emulation modes, it is possible to boot from a harddisk image by   *  For some emulation modes, it is possible to boot from a harddisk image by
# Line 585  static int load_bootblock(struct machine Line 653  static int load_bootblock(struct machine
653    
654          /*          /*
655           *  Try reading a kernel manually from the disk. The code here           *  Try reading a kernel manually from the disk. The code here
656           *  does not rely on machine-dependant boot blocks etc.           *  does not rely on machine-dependent boot blocks etc.
657           */           */
658          /*  ISO9660: (0x800 bytes at 0x8000)  */          /*  ISO9660: (0x800 bytes at 0x8000)  */
659          bootblock_buf = malloc(0x800);          bootblock_buf = malloc(0x800);
# Line 622  static int load_bootblock(struct machine Line 690  static int load_bootblock(struct machine
690                              n_loadp, load_namesp);                              n_loadp, load_namesp);
691          }          }
692    
693            if (retval != 0)
694                    goto ret_ok;
695    
696            /*  Apple parition table:  */
697            res = diskimage_access(m, boot_disk_id, boot_disk_type,
698                0, 0x0, bootblock_buf, 0x800);
699            if (!res) {
700                    fatal("Couldn't read the disk image. Aborting.\n");
701                    return 0;
702            }
703            if (bootblock_buf[0x000] == 'E' && bootblock_buf[0x001] == 'R' &&
704                bootblock_buf[0x200] == 'P' && bootblock_buf[0x201] == 'M') {
705                    /*  We can't load a kernel if the name
706                        isn't specified.  */
707                    if (cpu->machine->boot_kernel_filename == NULL ||
708                        cpu->machine->boot_kernel_filename[0] == '\0')
709                            fatal("\nApple partition table, but no kernel "
710                                "specified? (Use the -j option.)\n");
711                    else
712                            retval = apple_load_bootblock(m, cpu, boot_disk_id,
713                                boot_disk_type, n_loadp, load_namesp);
714            }
715    
716    ret_ok:
717          free(bootblock_buf);          free(bootblock_buf);
718          return retval;          return retval;
719  }  }
# Line 645  struct emul *emul_new(char *name) Line 737  struct emul *emul_new(char *name)
737    
738          /*  Sane default values:  */          /*  Sane default values:  */
739          e->n_machines = 0;          e->n_machines = 0;
740            e->next_serial_nr = 1;
741    
742          if (name != NULL) {          if (name != NULL) {
743                  e->name = strdup(name);                  e->name = strdup(name);
# Line 707  static void add_arc_components(struct ma Line 800  static void add_arc_components(struct ma
800    
801          len += 1048576 * m->memory_offset_in_mb;          len += 1048576 * m->memory_offset_in_mb;
802    
803          /*  NOTE/TODO: magic 12MB end of load program area  */          /*
804             *  NOTE/TODO: magic 12MB end of load program area
805             *
806             *  Hm. This breaks the old FreeBSD/MIPS snapshots...
807             */
808    #if 0
809          arcbios_add_memory_descriptor(cpu,          arcbios_add_memory_descriptor(cpu,
810              0x60000 + m->memory_offset_in_mb * 1048576,              0x60000 + m->memory_offset_in_mb * 1048576,
811              start-0x60000 - m->memory_offset_in_mb * 1048576,              start-0x60000 - m->memory_offset_in_mb * 1048576,
812              ARCBIOS_MEM_FreeMemory);              ARCBIOS_MEM_FreeMemory);
813    #endif
814          arcbios_add_memory_descriptor(cpu,          arcbios_add_memory_descriptor(cpu,
815              start, len, ARCBIOS_MEM_LoadedProgram);              start, len, ARCBIOS_MEM_LoadedProgram);
816    
# Line 832  void emul_machine_setup(struct machine * Line 931  void emul_machine_setup(struct machine *
931    
932          m->cpu_family = cpu_family_ptr_by_number(m->arch);          m->cpu_family = cpu_family_ptr_by_number(m->arch);
933    
934            if (m->arch == ARCH_ALPHA)
935                    m->arch_pagesize = 8192;
936    
937            if (m->arch != ARCH_MIPS)
938                    m->bintrans_enable = 0;
939    
940          machine_memsize_fix(m);          machine_memsize_fix(m);
941    
942          /*          /*
# Line 852  void emul_machine_setup(struct machine * Line 957  void emul_machine_setup(struct machine *
957                  debug(" (offset by %iMB)", m->memory_offset_in_mb);                  debug(" (offset by %iMB)", m->memory_offset_in_mb);
958                  memory_amount += 1048576 * m->memory_offset_in_mb;                  memory_amount += 1048576 * m->memory_offset_in_mb;
959          }          }
960          m->memory = memory_new(memory_amount);          m->memory = memory_new(memory_amount, m->arch);
961          if (m->machine_type != MACHINE_USERLAND)          if (m->machine_type != MACHINE_USERLAND)
962                  debug("\n");                  debug("\n");
963    
# Line 894  void emul_machine_setup(struct machine * Line 999  void emul_machine_setup(struct machine *
999          }          }
1000          debug("\n");          debug("\n");
1001    
1002    #if 0
1003            /*  Special case: The Playstation Portable has an additional CPU:  */
1004            if (m->machine_type == MACHINE_PSP) {
1005                    debug("cpu%i: ", m->ncpus);
1006                    m->cpus[m->ncpus] = cpu_new(m->memory, m,
1007                        0  /*  use 0 here to show info with debug()  */,
1008                        "Allegrex" /*  TODO  */);
1009                    if (m->bintrans_enable)
1010                            bintrans_init_cpu(m->cpus[m->ncpus]);
1011                    debug("\n");
1012                    m->ncpus ++;
1013            }
1014    #endif
1015    
1016          if (m->use_random_bootstrap_cpu)          if (m->use_random_bootstrap_cpu)
1017                  m->bootstrap_cpu = random() % m->ncpus;                  m->bootstrap_cpu = random() % m->ncpus;
1018          else          else
# Line 905  void emul_machine_setup(struct machine * Line 1024  void emul_machine_setup(struct machine *
1024          if (m->userland_emul != NULL) {          if (m->userland_emul != NULL) {
1025                  useremul_name_to_useremul(cpu,                  useremul_name_to_useremul(cpu,
1026                      m->userland_emul, NULL, NULL, NULL);                      m->userland_emul, NULL, NULL, NULL);
1027                  cpu->memory_rw = userland_memory_rw;  
1028                    switch (m->arch) {
1029    #ifdef ENABLE_ALPHA
1030                    case ARCH_ALPHA:
1031                            cpu->memory_rw = alpha_userland_memory_rw;
1032                            break;
1033    #endif
1034                    default:cpu->memory_rw = userland_memory_rw;
1035                    }
1036          }          }
1037    
1038          if (m->use_x11)          if (m->use_x11)
# Line 966  void emul_machine_setup(struct machine * Line 1093  void emul_machine_setup(struct machine *
1093                  }                  }
1094    
1095                  /*                  /*
1096                   *  Another special hack for temporary files; running gunzip                   *  gzipped files are automagically gunzipped:
1097                   *  on them, if they have a gzip header.  TODO: Change this                   *  NOTE/TODO: This isn't secure. system() is used.
                  *  into some kind of generic support for gzipped files!  
1098                   */                   */
1099                  tmp_f = fopen(name_to_load, "r");                  tmp_f = fopen(name_to_load, "r");
1100                  if (tmp_f != NULL) {                  if (tmp_f != NULL) {
# Line 976  void emul_machine_setup(struct machine * Line 1102  void emul_machine_setup(struct machine *
1102                          memset(buf, 0, sizeof(buf));                          memset(buf, 0, sizeof(buf));
1103                          fread(buf, 1, sizeof(buf), tmp_f);                          fread(buf, 1, sizeof(buf), tmp_f);
1104                          if (buf[0]==0x1f && buf[1]==0x8b) {                          if (buf[0]==0x1f && buf[1]==0x8b) {
1105                                  char *zz = malloc(strlen(name_to_load)*2 + 100);                                  size_t zzlen = strlen(name_to_load)*2 + 100;
1106                                    char *zz = malloc(zzlen);
1107                                  debug("gunziping %s\n", name_to_load);                                  debug("gunziping %s\n", name_to_load);
1108                                  sprintf(zz, "mv %s %s.gz", name_to_load,                                  /*
1109                                      name_to_load);                                   *  gzip header found.  If this was a file
1110                                  system(zz);                                   *  extracted from, say, a CDROM image, then it
1111                                  sprintf(zz, "gunzip %s.gz", name_to_load);                                   *  already has a temporary name. Otherwise we
1112                                  system(zz);                                   *  have to gunzip into a temporary file.
1113                                     */
1114                                    if (remove_after_load) {
1115                                            snprintf(zz, zzlen, "mv %s %s.gz",
1116                                                name_to_load, name_to_load);
1117                                            system(zz);
1118                                            snprintf(zz, zzlen, "gunzip %s.gz",
1119                                                name_to_load);
1120                                            system(zz);
1121                                    } else {
1122                                            /*  gunzip into new temp file:  */
1123                                            int tmpfile_handle;
1124                                            char *new_temp_name =
1125                                                strdup("/tmp/gxemul.XXXXXXXXXXXX");
1126                                            tmpfile_handle = mkstemp(new_temp_name);
1127                                            close(tmpfile_handle);
1128                                            snprintf(zz, zzlen, "gunzip -c '%s' > "
1129                                                "%s", name_to_load, new_temp_name);
1130                                            system(zz);
1131                                            name_to_load = new_temp_name;
1132                                            remove_after_load = 1;
1133                                    }
1134                                  free(zz);                                  free(zz);
1135                          }                          }
1136                          fclose(tmp_f);                          fclose(tmp_f);
1137                  }                  }
1138    
1139                    /*
1140                     *  Ugly (but usable) hack for Playstation Portable:  If the
1141                     *  filename ends with ".pbp" and the file contains an ELF
1142                     *  header, then extract the ELF file into a temporary file.
1143                     */
1144                    if (strlen(name_to_load) > 4 && strcasecmp(name_to_load +
1145                        strlen(name_to_load) - 4, ".pbp") == 0 &&
1146                        (tmp_f = fopen(name_to_load, "r")) != NULL) {
1147                            off_t filesize, j, found=0;
1148                            unsigned char *buf;
1149                            fseek(tmp_f, 0, SEEK_END);
1150                            filesize = ftello(tmp_f);
1151                            fseek(tmp_f, 0, SEEK_SET);
1152                            buf = malloc(filesize);
1153                            if (buf == NULL) {
1154                                    fprintf(stderr, "out of memory while trying"
1155                                        " to read %s\n", name_to_load);
1156                                    exit(1);
1157                            }
1158                            fread(buf, 1, filesize, tmp_f);
1159                            fclose(tmp_f);
1160                            /*  Search for the ELF header, from offset 1 (!):  */
1161                            for (j=1; j<filesize - 4; j++)
1162                                    if (memcmp(buf + j, ELFMAG, SELFMAG) == 0) {
1163                                            found = j;
1164                                            break;
1165                                    }
1166                            if (found != 0) {
1167                                    int tmpfile_handle;
1168                                    char *new_temp_name =
1169                                        strdup("/tmp/gxemul.XXXXXXXXXXXX");
1170                                    debug("extracting ELF from %s (offset 0x%x)\n",
1171                                        name_to_load, (int)found);
1172                                    tmpfile_handle = mkstemp(new_temp_name);
1173                                    write(tmpfile_handle, buf + found,
1174                                        filesize - found);
1175                                    close(tmpfile_handle);
1176                                    name_to_load = new_temp_name;
1177                                    remove_after_load = 1;
1178                            }
1179                    }
1180    
1181                  /*  Special things required _before_ loading the file:  */                  /*  Special things required _before_ loading the file:  */
1182                  switch (m->arch) {                  switch (m->arch) {
1183                  case ARCH_X86:                  case ARCH_X86:
# Line 1021  void emul_machine_setup(struct machine * Line 1211  void emul_machine_setup(struct machine *
1211                  cpu->pc = entrypoint;                  cpu->pc = entrypoint;
1212    
1213                  switch (m->arch) {                  switch (m->arch) {
1214    
1215                    case ARCH_ALPHA:
1216                            /*  For position-independent code:  */
1217                            cpu->cd.alpha.r[ALPHA_T12] = cpu->pc;
1218                            break;
1219    
1220                    case ARCH_ARM:
1221                            if (cpu->pc & 3) {
1222                                    fatal("ARM: lowest bits of pc set: TODO\n");
1223                                    exit(1);
1224                            }
1225                            cpu->pc &= 0xfffffffc;
1226                            break;
1227    
1228                    case ARCH_AVR:
1229                            cpu->pc &= 0xfffff;
1230                            if (cpu->pc & 1) {
1231                                    fatal("AVR: lowest bit of pc set: TODO\n");
1232                                    exit(1);
1233                            }
1234                            break;
1235    
1236                    case ARCH_HPPA:
1237                            break;
1238    
1239                    case ARCH_I960:
1240                            break;
1241    
1242                    case ARCH_IA64:
1243                            break;
1244    
1245                    case ARCH_M68K:
1246                            break;
1247    
1248                  case ARCH_MIPS:                  case ARCH_MIPS:
1249                          if ((cpu->pc >> 32) == 0                          if ((cpu->pc >> 32) == 0 && (cpu->pc & 0x80000000ULL))
                             && (cpu->pc & 0x80000000ULL))  
1250                                  cpu->pc |= 0xffffffff00000000ULL;                                  cpu->pc |= 0xffffffff00000000ULL;
1251    
1252                          cpu->cd.mips.gpr[MIPS_GPR_GP] = gp;                          cpu->cd.mips.gpr[MIPS_GPR_GP] = gp;
# Line 1039  void emul_machine_setup(struct machine * Line 1262  void emul_machine_setup(struct machine *
1262                              spec/x458.html for more info.  */                              spec/x458.html for more info.  */
1263                          cpu->cd.ppc.gpr[2] = toc;                          cpu->cd.ppc.gpr[2] = toc;
1264                          /*  TODO  */                          /*  TODO  */
1265                            if (cpu->cd.ppc.bits == 32)
1266                                    cpu->pc &= 0xffffffffULL;
1267                          break;                          break;
1268    
1269                  case ARCH_ALPHA:                  case ARCH_SH:
1270                  case ARCH_HPPA:                          if (cpu->cd.sh.bits == 32)
1271                  case ARCH_SPARC:                                  cpu->pc &= 0xffffffffULL;
1272                  case ARCH_URISC:                          cpu->pc &= ~1;
1273                          break;                          break;
1274    
1275                  case ARCH_ARM:                  case ARCH_SPARC:
                         cpu->pc &= 0xffffffff;  
1276                          break;                          break;
1277    
1278                  case ARCH_X86:                  case ARCH_X86:
# Line 1120  void emul_machine_setup(struct machine * Line 1344  void emul_machine_setup(struct machine *
1344          if (m->machine_type == MACHINE_DEC &&          if (m->machine_type == MACHINE_DEC &&
1345              cpu->cd.mips.cpu_type.mmu_model == MMU3K)              cpu->cd.mips.cpu_type.mmu_model == MMU3K)
1346                  add_symbol_name(&m->symbol_context,                  add_symbol_name(&m->symbol_context,
1347                      0x9fff0000, 0x10000, "r2k3k_cache", 0);                      0x9fff0000, 0x10000, "r2k3k_cache", 0, 0);
1348    
1349          symbol_recalc_sizes(&m->symbol_context);          symbol_recalc_sizes(&m->symbol_context);
1350    
# Line 1133  void emul_machine_setup(struct machine * Line 1357  void emul_machine_setup(struct machine *
1357              m->machine_type == MACHINE_SGI) && m->prom_emulation)              m->machine_type == MACHINE_SGI) && m->prom_emulation)
1358                  add_arc_components(m);                  add_arc_components(m);
1359    
1360    
1361    #if 0
1362    if (m->machine_type == MACHINE_IQ80321) {
1363            store_32bit_word(cpu, 0xc0200000, 0);
1364            store_32bit_word(cpu, 0xc0200004, 0xd0000000);
1365    }
1366    #endif
1367    
1368    
1369          debug("starting cpu%i at ", m->bootstrap_cpu);          debug("starting cpu%i at ", m->bootstrap_cpu);
1370          switch (m->arch) {          switch (m->arch) {
1371    
1372            case ARCH_ARM:
1373                    /*  ARM cpus aren't 64-bit:  */
1374                    debug("0x%08x", (int)entrypoint);
1375                    break;
1376    
1377            case ARCH_AVR:
1378                    /*  Atmel AVR uses a 16-bit or 22-bit program counter:  */
1379                    debug("0x%04x", (int)entrypoint);
1380                    break;
1381    
1382          case ARCH_MIPS:          case ARCH_MIPS:
1383                  if (cpu->cd.mips.cpu_type.isa_level < 3 ||                  if (cpu->is_32bit) {
                     cpu->cd.mips.cpu_type.isa_level == 32) {  
1384                          debug("0x%08x", (int)m->cpus[                          debug("0x%08x", (int)m->cpus[
1385                              m->bootstrap_cpu]->pc);                              m->bootstrap_cpu]->pc);
1386                          if (cpu->cd.mips.gpr[MIPS_GPR_GP] != 0)                          if (cpu->cd.mips.gpr[MIPS_GPR_GP] != 0)
# Line 1152  void emul_machine_setup(struct machine * Line 1395  void emul_machine_setup(struct machine *
1395                                      cpu->cd.mips.gpr[MIPS_GPR_GP]);                                      cpu->cd.mips.gpr[MIPS_GPR_GP]);
1396                  }                  }
1397                  break;                  break;
1398    
1399          case ARCH_PPC:          case ARCH_PPC:
1400                  if (cpu->cd.ppc.bits == 32)                  if (cpu->cd.ppc.bits == 32)
1401                          debug("0x%08x", (int)entrypoint);                          debug("0x%08x", (int)entrypoint);
1402                  else                  else
1403                          debug("0x%016llx", (long long)entrypoint);                          debug("0x%016llx", (long long)entrypoint);
1404                  break;                  break;
         case ARCH_ARM:  
                 /*  ARM cpus aren't 64-bit:  */  
                 debug("0x%08x", (int)entrypoint);  
                 break;  
         case ARCH_URISC:  
                 {  
                         char tmps[100];  
                         unsigned char buf[sizeof(uint64_t)];  
   
                         cpu->memory_rw(cpu, m->memory, 0, buf, sizeof(buf),  
                             MEM_READ, CACHE_NONE | NO_EXCEPTIONS);  
   
                         entrypoint = 0;  
                         for (i=0; i<cpu->cd.urisc.wordlen/8; i++) {  
                                 entrypoint <<= 8;  
                                 if (cpu->byte_order == EMUL_BIG_ENDIAN)  
                                         entrypoint += buf[i];  
                                 else  
                                         entrypoint += buf[cpu->  
                                             cd.urisc.wordlen/8 - 1 - i];  
                         }  
1405    
                         sprintf(tmps, "0x%%0%illx", cpu->cd.urisc.wordlen / 4);  
                         debug(tmps, (long long)entrypoint);  
                         cpu->pc = entrypoint;  
                 }  
                 break;  
1406          case ARCH_X86:          case ARCH_X86:
1407                  debug("0x%04x:0x%llx", cpu->cd.x86.s[X86_S_CS],                  debug("0x%04x:0x%llx", cpu->cd.x86.s[X86_S_CS],
1408                      (long long)cpu->pc);                      (long long)cpu->pc);
1409                  break;                  break;
1410    
1411          default:          default:
1412                  debug("0x%016llx", (long long)cpu->pc);                  debug("0x%016llx", (long long)cpu->pc);
1413          }          }
# Line 1248  void emul_simple_init(struct emul *emul) Line 1467  void emul_simple_init(struct emul *emul)
1467                  debug("Simple setup...\n");                  debug("Simple setup...\n");
1468                  debug_indentation(iadd);                  debug_indentation(iadd);
1469    
1470                  /*  Create a network:  */                  /*  Create a simple network:  */
1471                  emul->net = net_init(emul, NET_INIT_FLAG_GATEWAY,                  emul->net = net_init(emul, NET_INIT_FLAG_GATEWAY,
1472                      "10.0.0.0", 8);                      "10.0.0.0", 8, NULL, 0, 0);
1473          } else {          } else {
1474                  /*  Userland pseudo-machine:  */                  /*  Userland pseudo-machine:  */
1475                  debug("Syscall emulation (userland-only) setup...\n");                  debug("Syscall emulation (userland-only) setup...\n");
# Line 1357  void emul_run(struct emul **emuls, int n Line 1576  void emul_run(struct emul **emuls, int n
1576                  if (e == NULL)                  if (e == NULL)
1577                          continue;                          continue;
1578                  for (j=0; j<e->n_machines; j++)                  for (j=0; j<e->n_machines; j++)
1579                          cpu_run_init(e, e->machines[j]);                          cpu_run_init(e->machines[j]);
1580          }          }
1581    
1582            /*  TODO: Generalize:  */
1583            if (emuls[0]->machines[0]->show_trace_tree)
1584                    cpu_functioncall_trace(emuls[0]->machines[0]->cpus[0],
1585                        emuls[0]->machines[0]->cpus[0]->pc);
1586    
1587          /*          /*
1588           *  MAIN LOOP:           *  MAIN LOOP:
1589           *           *
# Line 1392  void emul_run(struct emul **emuls, int n Line 1616  void emul_run(struct emul **emuls, int n
1616                  if (e == NULL)                  if (e == NULL)
1617                          continue;                          continue;
1618                  for (j=0; j<e->n_machines; j++)                  for (j=0; j<e->n_machines; j++)
1619                          cpu_run_deinit(e, e->machines[j]);                          cpu_run_deinit(e->machines[j]);
1620          }          }
1621    
1622          /*  force_debugger_at_exit flag set? Then enter the debugger:  */          /*  force_debugger_at_exit flag set? Then enter the debugger:  */

Legend:
Removed from v.6  
changed lines
  Added in v.20

  ViewVC Help
Powered by ViewVC 1.1.26