Ticket #15215: idle_pcs.diff

File idle_pcs.diff, 17.5 KB (added by xunil@…, 17 years ago)

Replacement for original idle_pcs.diff file, accounts for file name changes, among other things

  • dynamips-0.2.8-RC2

    diff -Naur dynamips-0.2.8-RC2.orig/cpu.h dynamips-0.2.8-RC2/cpu.h
    old new  
    9999   void (*mmu_raw_dump)(cpu_gen_t *cpu);
    100100   void (*add_breakpoint)(cpu_gen_t *cpu,m_uint64_t addr);
    101101   void (*remove_breakpoint)(cpu_gen_t *cpu,m_uint64_t addr);
    102    void (*set_idle_pc)(cpu_gen_t *cpu,m_uint64_t addr);
     102   void (*set_idle_pc)(cpu_gen_t *cpu,char* addr);
    103103   void (*get_idling_pc)(cpu_gen_t *cpu);   
    104104   void (*mts_rebuild)(cpu_gen_t *cpu);
    105105   void (*mts_show_stats)(cpu_gen_t *cpu);
  • dynamips-0.2.8-RC2

    diff -Naur dynamips-0.2.8-RC2.orig/dev_c2600.c dynamips-0.2.8-RC2/dev_c2600.c
    old new  
    714714
    715715   /* Copy some parameters from VM to CPU (idle PC, ...) */
    716716   cpu->idle_pc = vm->idle_pc;
     717   cpu->num_idle_pc = vm->num_idle_pc;
    717718
    718719   if (vm->timer_irq_check_itv)
    719720      cpu->timer_irq_check_itv = vm->timer_irq_check_itv;
     
    847848          vm->name,cpu->ia,vm->jit_use ? "en":"dis");
    848849
    849850   vm_log(vm,"C2600_BOOT",
    850           "starting instance (CPU0 PC=0x%8.8x,idle_pc=0x%8.8x,JIT %s)\n",
    851           cpu->ia,cpu->idle_pc,vm->jit_use ? "on":"off");
     851          "starting instance (CPU0 PC=0x%8.8x,JIT %s)\n",
     852          cpu->ia,vm->jit_use ? "on":"off");
    852853
    853854   /* Start main CPU */
    854855   if (vm->ghost_status != VM_GHOST_RAM_GENERATE) {
  • dynamips-0.2.8-RC2

    diff -Naur dynamips-0.2.8-RC2.orig/dev_c2691.c dynamips-0.2.8-RC2/dev_c2691.c
    old new  
    494494
    495495   /* Copy some parameters from VM to CPU (idle PC, ...) */
    496496   cpu->idle_pc = vm->idle_pc;
     497   cpu->num_idle_pc = vm->num_idle_pc;
    497498
    498499   if (vm->timer_irq_check_itv)
    499500      cpu->timer_irq_check_itv = vm->timer_irq_check_itv;
     
    594595          vm->name,cpu->pc,vm->jit_use ? "en":"dis");
    595596
    596597   vm_log(vm,"C2691_BOOT",
    597           "starting instance (CPU0 PC=0x%llx,idle_pc=0x%llx,JIT %s)\n",
    598           cpu->pc,cpu->idle_pc,vm->jit_use ? "on":"off");
     598          "starting instance (CPU0 PC=0x%llx,JIT %s)\n",
     599          cpu->pc,vm->jit_use ? "on":"off");
    599600
    600601   /* Start main CPU */
    601602   if (vm->ghost_status != VM_GHOST_RAM_GENERATE) {
  • dynamips-0.2.8-RC2

    diff -Naur dynamips-0.2.8-RC2.orig/dev_c3600.c dynamips-0.2.8-RC2/dev_c3600.c
    old new  
    648648
    649649   /* Copy some parameters from VM to CPU (idle PC, ...) */
    650650   cpu->idle_pc = vm->idle_pc;
     651   cpu->num_idle_pc = vm->num_idle_pc;
    651652
    652653   if (vm->timer_irq_check_itv)
    653654      cpu->timer_irq_check_itv = vm->timer_irq_check_itv;
     
    756757          vm->name,cpu->pc,vm->jit_use ? "en":"dis");
    757758
    758759   vm_log(vm,"C3600_BOOT",
    759           "starting instance (CPU0 PC=0x%llx,idle_pc=0x%llx,JIT %s)\n",
    760           cpu->pc,cpu->idle_pc,vm->jit_use ? "on":"off");
     760          "starting instance (CPU0 PC=0x%llx,JIT %s)\n",
     761          cpu->pc,vm->jit_use ? "on":"off");
    761762
    762763   /* Start main CPU */
    763764   if (vm->ghost_status != VM_GHOST_RAM_GENERATE) {
  • dynamips-0.2.8-RC2

    diff -Naur dynamips-0.2.8-RC2.orig/dev_c3725.c dynamips-0.2.8-RC2/dev_c3725.c
    old new  
    508508
    509509   /* Copy some parameters from VM to CPU (idle PC, ...) */
    510510   cpu->idle_pc = vm->idle_pc;
     511   cpu->num_idle_pc = vm->num_idle_pc;
    511512
    512513   if (vm->timer_irq_check_itv)
    513514      cpu->timer_irq_check_itv = vm->timer_irq_check_itv;
     
    608609          vm->name,cpu->pc,vm->jit_use ? "en":"dis");
    609610
    610611   vm_log(vm,"C3725_BOOT",
    611           "starting instance (CPU0 PC=0x%llx,idle_pc=0x%llx,JIT %s)\n",
    612           cpu->pc,cpu->idle_pc,vm->jit_use ? "on":"off");
     612          "starting instance (CPU0 PC=0x%llx,JIT %s)\n",
     613          cpu->pc,vm->jit_use ? "on":"off");
    613614
    614615   /* Start main CPU */
    615616   if (vm->ghost_status != VM_GHOST_RAM_GENERATE) {
  • dynamips-0.2.8-RC2

    diff -Naur dynamips-0.2.8-RC2.orig/dev_c3745.c dynamips-0.2.8-RC2/dev_c3745.c
    old new  
    547547
    548548   /* Copy some parameters from VM to CPU (idle PC, ...) */
    549549   cpu->idle_pc = vm->idle_pc;
     550   cpu->num_idle_pc = vm->num_idle_pc;
    550551
    551552   if (vm->timer_irq_check_itv)
    552553      cpu->timer_irq_check_itv = vm->timer_irq_check_itv;
     
    647648          vm->name,cpu->pc,vm->jit_use ? "en":"dis");
    648649
    649650   vm_log(vm,"C3745_BOOT",
    650           "starting instance (CPU0 PC=0x%llx,idle_pc=0x%llx,JIT %s)\n",
    651           cpu->pc,cpu->idle_pc,vm->jit_use ? "on":"off");
     651          "starting instance (CPU0 PC=0x%llx,JIT %s)\n",
     652          cpu->pc,vm->jit_use ? "on":"off");
    652653
    653654   /* Start main CPU */
    654655   if (vm->ghost_status != VM_GHOST_RAM_GENERATE) {
  • dynamips-0.2.8-RC2

    diff -Naur dynamips-0.2.8-RC2.orig/dev_c6msfc1.c dynamips-0.2.8-RC2/dev_c6msfc1.c
    old new  
    577577
    578578   /* Copy some parameters from VM to CPU0 (idle PC, ...) */
    579579   cpu0->idle_pc = vm->idle_pc;
    580 
     580   cpu0->num_idle_pc = vm->num_idle_pc;
     581   
    581582   if (vm->timer_irq_check_itv)
    582583      cpu0->timer_irq_check_itv = vm->timer_irq_check_itv;
    583584
  • dynamips-0.2.8-RC2

    diff -Naur dynamips-0.2.8-RC2.orig/dev_c7200.c dynamips-0.2.8-RC2/dev_c7200.c
    old new  
    15361536
    15371537   /* Copy some parameters from VM to CPU0 (idle PC, ...) */
    15381538   cpu0->idle_pc = vm->idle_pc;
     1539   cpu0->num_idle_pc = vm->num_idle_pc;
     1540   cpu0->num_idle_pc = vm->num_idle_pc;
    15391541
    15401542   if (vm->timer_irq_check_itv)
    15411543      cpu0->timer_irq_check_itv = vm->timer_irq_check_itv;
     
    16601662          vm->name,cpu->pc,vm->jit_use ? "en":"dis");
    16611663
    16621664   vm_log(vm,"C7200_BOOT",
    1663           "starting instance (CPU0 PC=0x%llx,idle_pc=0x%llx,JIT %s)\n",
    1664           cpu->pc,cpu->idle_pc,vm->jit_use ? "on":"off");
     1665          "starting instance (CPU0 PC=0x%llx,JIT %s)\n",
     1666          cpu->pc,vm->jit_use ? "on":"off");
    16651667   
    16661668   /* Start main CPU */
    16671669   if (vm->ghost_status != VM_GHOST_RAM_GENERATE) {
     
    17101712          vm->name,cpu->ia,vm->jit_use ? "en":"dis");
    17111713
    17121714   vm_log(vm,"C7200P_BOOT",
    1713           "starting instance (CPU0 IA=0x%8.8x,idle_pc=0x%8.8x,JIT %s)\n",
    1714           cpu->ia,cpu->idle_pc,vm->jit_use ? "on":"off");
     1715          "starting instance (CPU0 IA=0x%8.8x,JIT %s)\n",
     1716          cpu->ia,vm->jit_use ? "on":"off");
    17151717   
    17161718   /* Start main CPU */
    17171719   if (vm->ghost_status != VM_GHOST_RAM_GENERATE) {
  • dynamips-0.2.8-RC2

    diff -Naur dynamips-0.2.8-RC2.orig/dynamips.c dynamips-0.2.8-RC2/dynamips.c
    old new  
    364364   return vm;
    365365}
    366366
     367/* slices the val values into idle_pc values, and set them to the vm */
     368static void set_idle_pc(vm_instance_t *vm, char *val) {
     369    char *tmp_val;
     370    int len = 0;
     371    /* find out how many the string length */
     372    while (val[len] != '\0')
     373        len += 1;
     374    int i = 0;
     375    int num_val = 1;
     376    /* find out how many idle_pc values we have in the string */
     377    while (i < len) {
     378        if (val[i] == ',')
     379            num_val += 1;
     380        i += 1;
     381    }
     382    vm->num_idle_pc = num_val;
     383    vm->idle_pc = (m_uint64_t*)malloc(num_val*sizeof(unsigned long long int));
     384
     385    i = 0;
     386    int current_val_idx = 0;
     387    /* slice the string, and assign each individual idle_pc values */
     388    while (i < len) {
     389        tmp_val = (char *) malloc((len+1)*sizeof(char));
     390        int j = 0;
     391        while ((i < len)&&(val[i] != ',')) {
     392            tmp_val[j] = val[i];
     393            i += 1;
     394            j += 1;
     395        }
     396        tmp_val[j] = '\0';
     397        vm->idle_pc[current_val_idx] = strtoull(tmp_val, NULL, 0);
     398        current_val_idx += 1;
     399        i += 1;
     400        free(tmp_val);
     401    }
     402}
     403
     404
    367405/* Parse the command line */
    368406static int parse_std_cmd_line(int argc,char *argv[])
    369407{
     
    491529
    492530         /* Idle PC */
    493531         case OPT_IDLE_PC:
    494             vm->idle_pc = strtoull(optarg,NULL,0);
    495             printf("Idle PC set to 0x%llx.\n",vm->idle_pc);
     532            set_idle_pc(vm, optarg);
    496533            break;
    497534
    498535         /* Timer IRQ check interval */
  • dynamips-0.2.8-RC2

    diff -Naur dynamips-0.2.8-RC2.orig/hv_vm.c dynamips-0.2.8-RC2/hv_vm.c
    old new  
    304304   if (!(vm = hypervisor_find_object(conn,argv[0],OBJ_TYPE_VM)))
    305305      return(-1);
    306306
    307    vm->idle_pc = strtoull(argv[1],NULL,0);
     307    char *tmp_val;
     308    int len = 0;
     309    /* find out how many the string length */
     310    while (argv[1][len] != '\0')
     311        len += 1;
     312    int i = 0;
     313    int num_val = 1;
     314    /* find out how many idle_pc values we have in the string */
     315    while (i < len) {
     316        if (argv[1][i] == ',')
     317            num_val += 1;
     318        i += 1;
     319    }
     320    vm->num_idle_pc = num_val;
     321    vm->idle_pc = (m_uint64_t*)malloc(num_val*sizeof(unsigned long long int));
     322
     323    i = 0;
     324    int current_val_idx = 0;
     325    while (i < len) {
     326        tmp_val = (char *) malloc((len+1)*sizeof(char));
     327        int j = 0;
     328        while ((i < len)&&(argv[1][i] != ',')) {
     329            tmp_val[j] = argv[1][i];
     330            i += 1;
     331            j += 1;
     332        }
     333        tmp_val[j] = '\0';
     334        vm->idle_pc[current_val_idx] = strtoull(tmp_val, NULL, 0);
     335        current_val_idx += 1;
     336        i += 1;
     337        free(tmp_val);
     338    }
     339
    308340
    309341   vm_release(vm);
    310342   hypervisor_send_reply(conn,HSC_INFO_OK,1,"OK");
     
    324356   if (!(cpu = find_cpu(conn,vm,atoi(argv[1]))))
    325357      return(-1);
    326358
    327    cpu->set_idle_pc(cpu,strtoull(argv[2],NULL,0));
     359   cpu->set_idle_pc(cpu,argv[2]);
    328360
    329361   vm_release(vm);
    330362   hypervisor_send_reply(conn,HSC_INFO_OK,1,"OK");
    331363   return(0);
    332364}
    333365
     366
    334367/* Get the idle PC proposals */
    335368static int cmd_get_idle_pc_prop(hypervisor_conn_t *conn,int argc,char *argv[])
    336369
  • dynamips-0.2.8-RC2

    diff -Naur dynamips-0.2.8-RC2.orig/mips64.c dynamips-0.2.8-RC2/mips64.c
    old new  
    138138}
    139139
    140140/* Set idle PC value */
    141 void mips64_set_idle_pc(cpu_gen_t *cpu,m_uint64_t addr)
     141void mips64_set_idle_pc(cpu_gen_t *cpu,char* addr)
    142142{
    143    CPU_MIPS64(cpu)->idle_pc = addr;
     143    char *tmp_val;
     144    int len = 0;
     145    /* find out how many the string length */
     146    while (addr[len] != '\0')
     147        len += 1;
     148    int i = 0;
     149    int num_val = 1;
     150    /* find out how many idle_pc values we have in the string */
     151    while (i < len) {
     152        if (addr[i] == ',')
     153            num_val += 1;
     154        i += 1;
     155    }
     156    CPU_MIPS64(cpu)->num_idle_pc = num_val;
     157    CPU_MIPS64(cpu)->idle_pc = (m_uint64_t*)malloc(num_val*sizeof(unsigned long long int));
     158
     159    i = 0;
     160    int current_val_idx = 0;
     161    /* slice the string, and assign each individual idle_pc values */
     162    while (i < len) {
     163        tmp_val = (char *) malloc((len+1)*sizeof(char));
     164        int j = 0;
     165        while ((i < len)&&(addr[i] != ',')) {
     166            tmp_val[j] = addr[i];
     167            i += 1;
     168            j += 1;
     169        }
     170        tmp_val[j] = '\0';
     171        CPU_MIPS64(cpu)->idle_pc[current_val_idx] = (m_uint32_t) strtoull(tmp_val, NULL, 0);
     172        current_val_idx += 1;
     173        i += 1;
     174        free(tmp_val);
     175    }
    144176}
    145177
    146178/* Timer IRQ */
  • dynamips-0.2.8-RC2

    diff -Naur dynamips-0.2.8-RC2.orig/mips64.h dynamips-0.2.8-RC2/mips64.h
    old new  
    389389   insn_exec_page_t *exec_page_free_list;
    390390   insn_exec_page_t *exec_page_array;
    391391
    392    /* Idle PC value */
    393    volatile m_uint64_t idle_pc;
     392   /* Idle PC value array */
     393   volatile m_uint64_t* idle_pc;
     394
     395   /* Number of Idle PC value */
     396   volatile int num_idle_pc;
    394397
    395398   /* Timer IRQs */
    396399   volatile u_int timer_irq_pending;
     
    479482void mips64_set_prid(cpu_mips_t *cpu,m_uint32_t prid);
    480483
    481484/* Set idle PC value */
    482 void mips64_set_idle_pc(cpu_gen_t *cpu,m_uint64_t addr);
     485void mips64_set_idle_pc(cpu_gen_t *cpu,char* addr);
    483486
    484487/* Timer IRQ */
    485488void *mips64_timer_irq_run(cpu_mips_t *cpu);
  • dynamips-0.2.8-RC2

    diff -Naur dynamips-0.2.8-RC2.orig/mips64_jit.c dynamips-0.2.8-RC2/mips64_jit.c
    old new  
    750750      cpu->perf_counter++;
    751751#endif
    752752      /* Handle virtual idle loop */
    753       if (unlikely(cpu->pc == cpu->idle_pc)) {
    754          if (++gen->idle_count == gen->idle_max) {
    755             cpu_idle_loop(gen);
    756             gen->idle_count = 0;
    757          }
     753      int i;
     754      for (i = 0; i < cpu->num_idle_pc; i++) {
     755          if (unlikely(cpu->pc == cpu->idle_pc[i])) {
     756             if (++gen->idle_count == gen->idle_max) {
     757                cpu_idle_loop(gen);
     758                gen->idle_count = 0;
     759             }
     760          }
    758761      }
    759762
    760763      /* Handle the virtual CPU clock */
  • dynamips-0.2.8-RC2

    diff -Naur dynamips-0.2.8-RC2.orig/ppc32.c dynamips-0.2.8-RC2/ppc32.c
    old new  
    9595}
    9696
    9797/* Set idle PC value */
    98 void ppc32_set_idle_pc(cpu_gen_t *cpu,m_uint64_t addr)
     98void ppc32_set_idle_pc(cpu_gen_t *cpu, char* addr)
    9999{
    100    CPU_PPC32(cpu)->idle_pc = (m_uint32_t)addr;
     100    char *tmp_val;
     101    int len = 0;
     102    /* find out how many the string length */
     103    while (addr[len] != '\0')
     104        len += 1;
     105    int i = 0;
     106    int num_val = 1;
     107    /* find out how many idle_pc values we have in the string */
     108    while (i < len) {
     109        if (addr[i] == ',')
     110            num_val += 1;
     111        i += 1;
     112    }
     113    CPU_PPC32(cpu)->num_idle_pc = num_val;
     114    CPU_PPC32(cpu)->idle_pc = (m_uint64_t*)malloc(num_val*sizeof(unsigned long long int));
     115
     116    i = 0;
     117    int current_val_idx = 0;
     118    /* slice the string, and assign each individual idle_pc values */
     119    while (i < len) {
     120        tmp_val = (char *) malloc((len+1)*sizeof(char));
     121        int j = 0;
     122        while ((i < len)&&(addr[i] != ',')) {
     123            tmp_val[j] = addr[i];
     124            i += 1;
     125            j += 1;
     126        }
     127        tmp_val[j] = '\0';
     128        CPU_PPC32(cpu)->idle_pc[current_val_idx] = (m_uint32_t) strtoull(tmp_val, NULL, 0);
     129        current_val_idx += 1;
     130        i += 1;
     131        free(tmp_val);
     132    }
    101133}
    102134
    103135/* Timer IRQ */
  • dynamips-0.2.8-RC2

    diff -Naur dynamips-0.2.8-RC2.orig/ppc32.h dynamips-0.2.8-RC2/ppc32.h
    old new  
    344344   insn_exec_page_t *exec_page_free_list;
    345345   insn_exec_page_t *exec_page_array;
    346346
    347    /* Idle PC value */
    348    volatile m_uint32_t idle_pc;
     347   /* Array Idle PC value */
     348   volatile m_uint32_t* idle_pc;
     349
     350   /* Number of idle_pc values */
     351   volatile int num_idle_pc;
    349352
    350353   /* Timer IRQs */
    351354   volatile u_int timer_irq_pending,timer_irq_armed;
     
    500503void ppc32_set_pvr(cpu_ppc_t *cpu,m_uint32_t pvr);
    501504
    502505/* Set idle PC value */
    503 void ppc32_set_idle_pc(cpu_gen_t *cpu,m_uint64_t addr);
     506void ppc32_set_idle_pc(cpu_gen_t *cpu, char* addr);
    504507
    505508/* Timer IRQ */
    506509void *ppc32_timer_irq_run(cpu_ppc_t *cpu);
  • dynamips-0.2.8-RC2

    diff -Naur dynamips-0.2.8-RC2.orig/ppc32_jit.c dynamips-0.2.8-RC2/ppc32_jit.c
    old new  
    12401240      cpu->perf_counter++;
    12411241#endif
    12421242      /* Handle virtual idle loop */
    1243       if (unlikely(cpu->ia == cpu->idle_pc)) {
    1244          if (++gen->idle_count == gen->idle_max) {
    1245             cpu_idle_loop(gen);
    1246             gen->idle_count = 0;
    1247          }
     1243      int i;
     1244      for (i = 0; i < cpu->num_idle_pc; i++) {
     1245          if (unlikely(cpu->ia == cpu->idle_pc[i])) {
     1246             if (++gen->idle_count == gen->idle_max) {
     1247                cpu_idle_loop(gen);
     1248                gen->idle_count = 0;
     1249             }
     1250          }
    12481251      }
    12491252
    12501253      /* Handle the virtual CPU clock */
  • dynamips-0.2.8-RC2

    diff -Naur dynamips-0.2.8-RC2.orig/vm.c dynamips-0.2.8-RC2/vm.c
    old new  
    329329   vm->vtty_aux_type        = VTTY_TYPE_NONE;
    330330   vm->timer_irq_check_itv  = VM_TIMER_IRQ_CHECK_ITV;
    331331   vm->log_file_enabled     = TRUE;
     332   vm->num_idle_pc          = 0;
    332333   vm->rommon_vars.filename = vm_build_filename(vm,"rommon_vars");
    333334
    334335   if (!vm->rommon_vars.filename)
  • dynamips-0.2.8-RC2

    diff -Naur dynamips-0.2.8-RC2.orig/vm.h dynamips-0.2.8-RC2/vm.h
    old new  
    153153   /* Timer IRQ interval check */
    154154   u_int timer_irq_check_itv;
    155155
    156    /* "idling" pointer counter */
    157    m_uint64_t idle_pc;
     156   /* "idling" pointer counter array*/
     157   m_uint64_t* idle_pc;
     158
     159   /* number of idle_pc values */
     160   int num_idle_pc;
    158161
    159162   /* JIT block direct jumps */
    160163   int exec_blk_direct_jump;
     
    181184
    182185   /* VM objects */
    183186   struct vm_obj *vm_object_list;   
     187
    184188};
    185189
    186190/* VM Platform definition */