diff -Naur dynamips-0.2.8-RC1/cpu.h dynamips-0.2.8-RC1-YLT/cpu.h --- dynamips-0.2.8-RC1/cpu.h 2007-09-07 04:03:11.000000000 -0400 +++ dynamips-0.2.8-RC1-YLT/cpu.h 2007-09-24 14:18:15.000000000 -0400 @@ -99,7 +99,7 @@ void (*mmu_raw_dump)(cpu_gen_t *cpu); void (*add_breakpoint)(cpu_gen_t *cpu,m_uint64_t addr); void (*remove_breakpoint)(cpu_gen_t *cpu,m_uint64_t addr); - void (*set_idle_pc)(cpu_gen_t *cpu,m_uint64_t addr); + void (*set_idle_pc)(cpu_gen_t *cpu,char* addr); void (*get_idling_pc)(cpu_gen_t *cpu); void (*mts_rebuild)(cpu_gen_t *cpu); void (*mts_show_stats)(cpu_gen_t *cpu); diff -Naur dynamips-0.2.8-RC1/dev_c2600.c dynamips-0.2.8-RC1-YLT/dev_c2600.c --- dynamips-0.2.8-RC1/dev_c2600.c 2007-09-07 04:03:11.000000000 -0400 +++ dynamips-0.2.8-RC1-YLT/dev_c2600.c 2007-09-24 14:18:15.000000000 -0400 @@ -714,6 +714,7 @@ /* Copy some parameters from VM to CPU (idle PC, ...) */ cpu->idle_pc = vm->idle_pc; + cpu->num_idle_pc = vm->num_idle_pc; if (vm->timer_irq_check_itv) cpu->timer_irq_check_itv = vm->timer_irq_check_itv; @@ -847,8 +848,8 @@ vm->name,cpu->ia,vm->jit_use ? "en":"dis"); vm_log(vm,"C2600_BOOT", - "starting instance (CPU0 PC=0x%8.8x,idle_pc=0x%8.8x,JIT %s)\n", - cpu->ia,cpu->idle_pc,vm->jit_use ? "on":"off"); + "starting instance (CPU0 PC=0x%8.8x,JIT %s)\n", + cpu->ia,vm->jit_use ? "on":"off"); /* Start main CPU */ if (vm->ghost_status != VM_GHOST_RAM_GENERATE) { diff -Naur dynamips-0.2.8-RC1/dev_c2691.c dynamips-0.2.8-RC1-YLT/dev_c2691.c --- dynamips-0.2.8-RC1/dev_c2691.c 2007-09-07 04:03:11.000000000 -0400 +++ dynamips-0.2.8-RC1-YLT/dev_c2691.c 2007-09-24 14:18:15.000000000 -0400 @@ -494,6 +494,7 @@ /* Copy some parameters from VM to CPU (idle PC, ...) */ cpu->idle_pc = vm->idle_pc; + cpu->num_idle_pc = vm->num_idle_pc; if (vm->timer_irq_check_itv) cpu->timer_irq_check_itv = vm->timer_irq_check_itv; @@ -594,8 +595,8 @@ vm->name,cpu->pc,vm->jit_use ? "en":"dis"); vm_log(vm,"C2691_BOOT", - "starting instance (CPU0 PC=0x%llx,idle_pc=0x%llx,JIT %s)\n", - cpu->pc,cpu->idle_pc,vm->jit_use ? "on":"off"); + "starting instance (CPU0 PC=0x%llx,JIT %s)\n", + cpu->pc,vm->jit_use ? "on":"off"); /* Start main CPU */ if (vm->ghost_status != VM_GHOST_RAM_GENERATE) { diff -Naur dynamips-0.2.8-RC1/dev_c3600.c dynamips-0.2.8-RC1-YLT/dev_c3600.c --- dynamips-0.2.8-RC1/dev_c3600.c 2007-09-07 04:03:11.000000000 -0400 +++ dynamips-0.2.8-RC1-YLT/dev_c3600.c 2007-09-24 14:18:15.000000000 -0400 @@ -648,6 +648,7 @@ /* Copy some parameters from VM to CPU (idle PC, ...) */ cpu->idle_pc = vm->idle_pc; + cpu->num_idle_pc = vm->num_idle_pc; if (vm->timer_irq_check_itv) cpu->timer_irq_check_itv = vm->timer_irq_check_itv; @@ -756,8 +757,8 @@ vm->name,cpu->pc,vm->jit_use ? "en":"dis"); vm_log(vm,"C3600_BOOT", - "starting instance (CPU0 PC=0x%llx,idle_pc=0x%llx,JIT %s)\n", - cpu->pc,cpu->idle_pc,vm->jit_use ? "on":"off"); + "starting instance (CPU0 PC=0x%llx,JIT %s)\n", + cpu->pc,vm->jit_use ? "on":"off"); /* Start main CPU */ if (vm->ghost_status != VM_GHOST_RAM_GENERATE) { diff -Naur dynamips-0.2.8-RC1/dev_c3725.c dynamips-0.2.8-RC1-YLT/dev_c3725.c --- dynamips-0.2.8-RC1/dev_c3725.c 2007-09-07 04:03:11.000000000 -0400 +++ dynamips-0.2.8-RC1-YLT/dev_c3725.c 2007-09-24 14:18:15.000000000 -0400 @@ -508,6 +508,7 @@ /* Copy some parameters from VM to CPU (idle PC, ...) */ cpu->idle_pc = vm->idle_pc; + cpu->num_idle_pc = vm->num_idle_pc; if (vm->timer_irq_check_itv) cpu->timer_irq_check_itv = vm->timer_irq_check_itv; @@ -608,8 +609,8 @@ vm->name,cpu->pc,vm->jit_use ? "en":"dis"); vm_log(vm,"C3725_BOOT", - "starting instance (CPU0 PC=0x%llx,idle_pc=0x%llx,JIT %s)\n", - cpu->pc,cpu->idle_pc,vm->jit_use ? "on":"off"); + "starting instance (CPU0 PC=0x%llx,JIT %s)\n", + cpu->pc,vm->jit_use ? "on":"off"); /* Start main CPU */ if (vm->ghost_status != VM_GHOST_RAM_GENERATE) { diff -Naur dynamips-0.2.8-RC1/dev_c3745.c dynamips-0.2.8-RC1-YLT/dev_c3745.c --- dynamips-0.2.8-RC1/dev_c3745.c 2007-09-07 04:03:11.000000000 -0400 +++ dynamips-0.2.8-RC1-YLT/dev_c3745.c 2007-09-24 14:18:15.000000000 -0400 @@ -547,6 +547,7 @@ /* Copy some parameters from VM to CPU (idle PC, ...) */ cpu->idle_pc = vm->idle_pc; + cpu->num_idle_pc = vm->num_idle_pc; if (vm->timer_irq_check_itv) cpu->timer_irq_check_itv = vm->timer_irq_check_itv; @@ -647,8 +648,8 @@ vm->name,cpu->pc,vm->jit_use ? "en":"dis"); vm_log(vm,"C3745_BOOT", - "starting instance (CPU0 PC=0x%llx,idle_pc=0x%llx,JIT %s)\n", - cpu->pc,cpu->idle_pc,vm->jit_use ? "on":"off"); + "starting instance (CPU0 PC=0x%llx,JIT %s)\n", + cpu->pc,vm->jit_use ? "on":"off"); /* Start main CPU */ if (vm->ghost_status != VM_GHOST_RAM_GENERATE) { diff -Naur dynamips-0.2.8-RC1/dev_c6msfc1.c dynamips-0.2.8-RC1-YLT/dev_c6msfc1.c --- dynamips-0.2.8-RC1/dev_c6msfc1.c 2007-09-07 04:03:11.000000000 -0400 +++ dynamips-0.2.8-RC1-YLT/dev_c6msfc1.c 2007-09-24 14:15:46.000000000 -0400 @@ -576,7 +576,7 @@ cpu0->irq_idle_preempt[C6MSFC1_GT64K_IRQ] = TRUE; /* Copy some parameters from VM to CPU0 (idle PC, ...) */ - cpu0->idle_pc = vm->idle_pc; + cpu0->num_idle_pc = vm->num_idle_pc; if (vm->timer_irq_check_itv) cpu0->timer_irq_check_itv = vm->timer_irq_check_itv; @@ -689,8 +689,8 @@ vm->name,cpu->pc,vm->jit_use ? "en":"dis"); vm_log(vm,"C6MSFC1_BOOT", - "starting instance (CPU0 PC=0x%llx,idle_pc=0x%llx,JIT %s)\n", - cpu->pc,cpu->idle_pc,vm->jit_use ? "on":"off"); + "starting instance (CPU0 PC=0x%llx,JIT %s)\n", + cpu->pc,vm->jit_use ? "on":"off"); /* Start main CPU */ if (vm->ghost_status != VM_GHOST_RAM_GENERATE) { diff -Naur dynamips-0.2.8-RC1/dev_c7200.c dynamips-0.2.8-RC1-YLT/dev_c7200.c --- dynamips-0.2.8-RC1/dev_c7200.c 2007-09-07 04:03:11.000000000 -0400 +++ dynamips-0.2.8-RC1-YLT/dev_c7200.c 2007-09-24 16:47:50.000000000 -0400 @@ -1405,6 +1405,7 @@ /* Copy some parameters from VM to CPU0 (idle PC, ...) */ cpu0->idle_pc = vm->idle_pc; + cpu0->num_idle_pc = vm->num_idle_pc; if (vm->timer_irq_check_itv) cpu0->timer_irq_check_itv = vm->timer_irq_check_itv; @@ -1527,6 +1528,7 @@ /* Copy some parameters from VM to CPU0 (idle PC, ...) */ cpu0->idle_pc = vm->idle_pc; + cpu0->num_idle_pc = vm->num_idle_pc; if (vm->timer_irq_check_itv) cpu0->timer_irq_check_itv = vm->timer_irq_check_itv; @@ -1649,8 +1651,8 @@ vm->name,cpu->pc,vm->jit_use ? "en":"dis"); vm_log(vm,"C7200_BOOT", - "starting instance (CPU0 PC=0x%llx,idle_pc=0x%llx,JIT %s)\n", - cpu->pc,cpu->idle_pc,vm->jit_use ? "on":"off"); + "starting instance (CPU0 PC=0x%llx,JIT %s)\n", + cpu->pc,vm->jit_use ? "on":"off"); /* Start main CPU */ if (vm->ghost_status != VM_GHOST_RAM_GENERATE) { @@ -1699,8 +1701,8 @@ vm->name,cpu->ia,vm->jit_use ? "en":"dis"); vm_log(vm,"C7200P_BOOT", - "starting instance (CPU0 IA=0x%8.8x,idle_pc=0x%8.8x,JIT %s)\n", - cpu->ia,cpu->idle_pc,vm->jit_use ? "on":"off"); + "starting instance (CPU0 IA=0x%8.8x,JIT %s)\n", + cpu->ia,vm->jit_use ? "on":"off"); /* Start main CPU */ if (vm->ghost_status != VM_GHOST_RAM_GENERATE) { diff -Naur dynamips-0.2.8-RC1/dynamips.c dynamips-0.2.8-RC1-YLT/dynamips.c --- dynamips-0.2.8-RC1/dynamips.c 2007-09-07 04:03:11.000000000 -0400 +++ dynamips-0.2.8-RC1-YLT/dynamips.c 2007-09-24 14:18:15.000000000 -0400 @@ -364,6 +364,44 @@ return vm; } +/* slices the val values into idle_pc values, and set them to the vm */ +static void set_idle_pc(vm_instance_t *vm, char *val) { + char *tmp_val; + int len = 0; + /* find out how many the string length */ + while (val[len] != '\0') + len += 1; + int i = 0; + int num_val = 1; + /* find out how many idle_pc values we have in the string */ + while (i < len) { + if (val[i] == ',') + num_val += 1; + i += 1; + } + vm->num_idle_pc = num_val; + vm->idle_pc = (m_uint64_t*)malloc(num_val*sizeof(unsigned long long int)); + + i = 0; + int current_val_idx = 0; + /* slice the string, and assign each individual idle_pc values */ + while (i < len) { + tmp_val = (char *) malloc((len+1)*sizeof(char)); + int j = 0; + while ((i < len)&&(val[i] != ',')) { + tmp_val[j] = val[i]; + i += 1; + j += 1; + } + tmp_val[j] = '\0'; + vm->idle_pc[current_val_idx] = strtoull(tmp_val, NULL, 0); + current_val_idx += 1; + i += 1; + free(tmp_val); + } +} + + /* Parse the command line */ static int parse_std_cmd_line(int argc,char *argv[]) { @@ -491,8 +529,7 @@ /* Idle PC */ case OPT_IDLE_PC: - vm->idle_pc = strtoull(optarg,NULL,0); - printf("Idle PC set to 0x%llx.\n",vm->idle_pc); + set_idle_pc(vm, optarg); break; /* Timer IRQ check interval */ diff -Naur dynamips-0.2.8-RC1/hv_vm.c dynamips-0.2.8-RC1-YLT/hv_vm.c --- dynamips-0.2.8-RC1/hv_vm.c 2007-09-07 04:03:11.000000000 -0400 +++ dynamips-0.2.8-RC1-YLT/hv_vm.c 2007-09-24 14:18:15.000000000 -0400 @@ -304,7 +304,39 @@ if (!(vm = hypervisor_find_object(conn,argv[0],OBJ_TYPE_VM))) return(-1); - vm->idle_pc = strtoull(argv[1],NULL,0); + char *tmp_val; + int len = 0; + /* find out how many the string length */ + while (argv[1][len] != '\0') + len += 1; + int i = 0; + int num_val = 1; + /* find out how many idle_pc values we have in the string */ + while (i < len) { + if (argv[1][i] == ',') + num_val += 1; + i += 1; + } + vm->num_idle_pc = num_val; + vm->idle_pc = (m_uint64_t*)malloc(num_val*sizeof(unsigned long long int)); + + i = 0; + int current_val_idx = 0; + while (i < len) { + tmp_val = (char *) malloc((len+1)*sizeof(char)); + int j = 0; + while ((i < len)&&(argv[1][i] != ',')) { + tmp_val[j] = argv[1][i]; + i += 1; + j += 1; + } + tmp_val[j] = '\0'; + vm->idle_pc[current_val_idx] = strtoull(tmp_val, NULL, 0); + current_val_idx += 1; + i += 1; + free(tmp_val); + } + vm_release(vm); hypervisor_send_reply(conn,HSC_INFO_OK,1,"OK"); @@ -324,13 +356,14 @@ if (!(cpu = find_cpu(conn,vm,atoi(argv[1])))) return(-1); - cpu->set_idle_pc(cpu,strtoull(argv[2],NULL,0)); + cpu->set_idle_pc(cpu,argv[2]); vm_release(vm); hypervisor_send_reply(conn,HSC_INFO_OK,1,"OK"); return(0); } + /* Get the idle PC proposals */ static int cmd_get_idle_pc_prop(hypervisor_conn_t *conn,int argc,char *argv[]) { diff -Naur dynamips-0.2.8-RC1/mips64.c dynamips-0.2.8-RC1-YLT/mips64.c --- dynamips-0.2.8-RC1/mips64.c 2007-09-07 04:03:11.000000000 -0400 +++ dynamips-0.2.8-RC1-YLT/mips64.c 2007-09-24 14:18:15.000000000 -0400 @@ -138,9 +138,41 @@ } /* Set idle PC value */ -void mips64_set_idle_pc(cpu_gen_t *cpu,m_uint64_t addr) +void mips64_set_idle_pc(cpu_gen_t *cpu,char* addr) { - CPU_MIPS64(cpu)->idle_pc = addr; + char *tmp_val; + int len = 0; + /* find out how many the string length */ + while (addr[len] != '\0') + len += 1; + int i = 0; + int num_val = 1; + /* find out how many idle_pc values we have in the string */ + while (i < len) { + if (addr[i] == ',') + num_val += 1; + i += 1; + } + CPU_MIPS64(cpu)->num_idle_pc = num_val; + CPU_MIPS64(cpu)->idle_pc = (m_uint64_t*)malloc(num_val*sizeof(unsigned long long int)); + + i = 0; + int current_val_idx = 0; + /* slice the string, and assign each individual idle_pc values */ + while (i < len) { + tmp_val = (char *) malloc((len+1)*sizeof(char)); + int j = 0; + while ((i < len)&&(addr[i] != ',')) { + tmp_val[j] = addr[i]; + i += 1; + j += 1; + } + tmp_val[j] = '\0'; + CPU_MIPS64(cpu)->idle_pc[current_val_idx] = (m_uint32_t) strtoull(tmp_val, NULL, 0); + current_val_idx += 1; + i += 1; + free(tmp_val); + } } /* Timer IRQ */ diff -Naur dynamips-0.2.8-RC1/mips64.h dynamips-0.2.8-RC1-YLT/mips64.h --- dynamips-0.2.8-RC1/mips64.h 2007-09-07 04:03:11.000000000 -0400 +++ dynamips-0.2.8-RC1-YLT/mips64.h 2007-09-24 14:18:15.000000000 -0400 @@ -389,8 +389,11 @@ insn_exec_page_t *exec_page_free_list; insn_exec_page_t *exec_page_array; - /* Idle PC value */ - volatile m_uint64_t idle_pc; + /* Idle PC value array */ + volatile m_uint64_t* idle_pc; + + /* Number of Idle PC value */ + volatile int num_idle_pc; /* Timer IRQs */ volatile u_int timer_irq_pending; @@ -479,7 +482,7 @@ void mips64_set_prid(cpu_mips_t *cpu,m_uint32_t prid); /* Set idle PC value */ -void mips64_set_idle_pc(cpu_gen_t *cpu,m_uint64_t addr); +void mips64_set_idle_pc(cpu_gen_t *cpu,char* addr); /* Timer IRQ */ void *mips64_timer_irq_run(cpu_mips_t *cpu); diff -Naur dynamips-0.2.8-RC1/mips64_jit.c dynamips-0.2.8-RC1-YLT/mips64_jit.c --- dynamips-0.2.8-RC1/mips64_jit.c 2007-09-07 04:03:11.000000000 -0400 +++ dynamips-0.2.8-RC1-YLT/mips64_jit.c 2007-09-24 14:18:15.000000000 -0400 @@ -750,11 +750,14 @@ cpu->perf_counter++; #endif /* Handle virtual idle loop */ - if (unlikely(cpu->pc == cpu->idle_pc)) { - if (++gen->idle_count == gen->idle_max) { - cpu_idle_loop(gen); - gen->idle_count = 0; - } + int i; + for (i = 0; i < cpu->num_idle_pc; i++) { + if (unlikely(cpu->pc == cpu->idle_pc[i])) { + if (++gen->idle_count == gen->idle_max) { + cpu_idle_loop(gen); + gen->idle_count = 0; + } + } } /* Handle the virtual CPU clock */ diff -Naur dynamips-0.2.8-RC1/ppc32.c dynamips-0.2.8-RC1-YLT/ppc32.c --- dynamips-0.2.8-RC1/ppc32.c 2007-09-07 04:03:11.000000000 -0400 +++ dynamips-0.2.8-RC1-YLT/ppc32.c 2007-09-24 14:18:15.000000000 -0400 @@ -95,9 +95,41 @@ } /* Set idle PC value */ -void ppc32_set_idle_pc(cpu_gen_t *cpu,m_uint64_t addr) +void ppc32_set_idle_pc(cpu_gen_t *cpu, char* addr) { - CPU_PPC32(cpu)->idle_pc = (m_uint32_t)addr; + char *tmp_val; + int len = 0; + /* find out how many the string length */ + while (addr[len] != '\0') + len += 1; + int i = 0; + int num_val = 1; + /* find out how many idle_pc values we have in the string */ + while (i < len) { + if (addr[i] == ',') + num_val += 1; + i += 1; + } + CPU_PPC32(cpu)->num_idle_pc = num_val; + CPU_PPC32(cpu)->idle_pc = (m_uint64_t*)malloc(num_val*sizeof(unsigned long long int)); + + i = 0; + int current_val_idx = 0; + /* slice the string, and assign each individual idle_pc values */ + while (i < len) { + tmp_val = (char *) malloc((len+1)*sizeof(char)); + int j = 0; + while ((i < len)&&(addr[i] != ',')) { + tmp_val[j] = addr[i]; + i += 1; + j += 1; + } + tmp_val[j] = '\0'; + CPU_PPC32(cpu)->idle_pc[current_val_idx] = (m_uint32_t) strtoull(tmp_val, NULL, 0); + current_val_idx += 1; + i += 1; + free(tmp_val); + } } /* Timer IRQ */ diff -Naur dynamips-0.2.8-RC1/ppc32.h dynamips-0.2.8-RC1-YLT/ppc32.h --- dynamips-0.2.8-RC1/ppc32.h 2007-09-07 04:03:11.000000000 -0400 +++ dynamips-0.2.8-RC1-YLT/ppc32.h 2007-09-24 14:18:15.000000000 -0400 @@ -344,8 +344,11 @@ insn_exec_page_t *exec_page_free_list; insn_exec_page_t *exec_page_array; - /* Idle PC value */ - volatile m_uint32_t idle_pc; + /* Array Idle PC value */ + volatile m_uint32_t* idle_pc; + + /* Number of idle_pc values */ + volatile int num_idle_pc; /* Timer IRQs */ volatile u_int timer_irq_pending,timer_irq_armed; @@ -500,7 +503,7 @@ void ppc32_set_pvr(cpu_ppc_t *cpu,m_uint32_t pvr); /* Set idle PC value */ -void ppc32_set_idle_pc(cpu_gen_t *cpu,m_uint64_t addr); +void ppc32_set_idle_pc(cpu_gen_t *cpu, char* addr); /* Timer IRQ */ void *ppc32_timer_irq_run(cpu_ppc_t *cpu); diff -Naur dynamips-0.2.8-RC1/ppc32_jit.c dynamips-0.2.8-RC1-YLT/ppc32_jit.c --- dynamips-0.2.8-RC1/ppc32_jit.c 2007-09-07 04:03:11.000000000 -0400 +++ dynamips-0.2.8-RC1-YLT/ppc32_jit.c 2007-09-24 14:18:15.000000000 -0400 @@ -1240,11 +1240,14 @@ cpu->perf_counter++; #endif /* Handle virtual idle loop */ - if (unlikely(cpu->ia == cpu->idle_pc)) { - if (++gen->idle_count == gen->idle_max) { - cpu_idle_loop(gen); - gen->idle_count = 0; - } + int i; + for (i = 0; i < cpu->num_idle_pc; i++) { + if (unlikely(cpu->ia == cpu->idle_pc[i])) { + if (++gen->idle_count == gen->idle_max) { + cpu_idle_loop(gen); + gen->idle_count = 0; + } + } } /* Handle the virtual CPU clock */ diff -Naur dynamips-0.2.8-RC1/vm.c dynamips-0.2.8-RC1-YLT/vm.c --- dynamips-0.2.8-RC1/vm.c 2007-09-07 04:03:11.000000000 -0400 +++ dynamips-0.2.8-RC1-YLT/vm.c 2007-09-24 14:17:39.000000000 -0400 @@ -329,6 +329,7 @@ vm->vtty_aux_type = VTTY_TYPE_NONE; vm->timer_irq_check_itv = VM_TIMER_IRQ_CHECK_ITV; vm->log_file_enabled = TRUE; + vm->num_idle_pc = 0; vm->rommon_vars.filename = vm_build_filename(vm,"rommon_vars"); if (!vm->rommon_vars.filename) diff -Naur dynamips-0.2.8-RC1/vm.h dynamips-0.2.8-RC1-YLT/vm.h --- dynamips-0.2.8-RC1/vm.h 2007-09-07 04:03:11.000000000 -0400 +++ dynamips-0.2.8-RC1-YLT/vm.h 2007-09-24 14:18:15.000000000 -0400 @@ -153,8 +153,11 @@ /* Timer IRQ interval check */ u_int timer_irq_check_itv; - /* "idling" pointer counter */ - m_uint64_t idle_pc; + /* "idling" pointer counter array*/ + m_uint64_t* idle_pc; + + /* number of idle_pc values */ + int num_idle_pc; /* JIT block direct jumps */ int exec_blk_direct_jump; @@ -181,6 +184,7 @@ /* VM objects */ struct vm_obj *vm_object_list; + }; /* VM Platform definition */