42 |
/* Initialize a PowerPC processor */ |
/* Initialize a PowerPC processor */ |
43 |
int ppc32_init(cpu_ppc_t *cpu) |
int ppc32_init(cpu_ppc_t *cpu) |
44 |
{ |
{ |
45 |
|
/* Initialize JIT operations */ |
46 |
|
jit_op_init_cpu(cpu->gen); |
47 |
|
|
48 |
/* Initialize idle timer */ |
/* Initialize idle timer */ |
49 |
cpu->gen->idle_max = 1500; |
cpu->gen->idle_max = 1500; |
50 |
cpu->gen->idle_sleep_time = 30000; |
cpu->gen->idle_sleep_time = 30000; |
53 |
cpu->timer_irq_check_itv = 1000; |
cpu->timer_irq_check_itv = 1000; |
54 |
cpu->timer_irq_freq = 250; |
cpu->timer_irq_freq = 250; |
55 |
|
|
56 |
|
/* Enable/disable direct block jump */ |
57 |
|
cpu->exec_blk_direct_jump = cpu->vm->exec_blk_direct_jump; |
58 |
|
|
59 |
/* Idle loop mutex and condition */ |
/* Idle loop mutex and condition */ |
60 |
pthread_mutex_init(&cpu->gen->idle_mutex,NULL); |
pthread_mutex_init(&cpu->gen->idle_mutex,NULL); |
61 |
pthread_cond_init(&cpu->gen->idle_cond,NULL); |
pthread_cond_init(&cpu->gen->idle_cond,NULL); |
232 |
printf("Restart the emulator with \"--idle-pc=0x%llx\" (for example)\n", |
printf("Restart the emulator with \"--idle-pc=0x%llx\" (for example)\n", |
233 |
cpu->idle_pc_prop[0].pc); |
cpu->idle_pc_prop[0].pc); |
234 |
} else { |
} else { |
235 |
printf("Done. No suggestion for idling PC\n"); |
printf("Done. No suggestion for idling PC, dumping the full table:\n"); |
236 |
|
|
237 |
|
for(i=0;i<IDLE_HASH_SIZE;i++) |
238 |
|
for(p=pc_hash[i];p;p=p->next) { |
239 |
|
printf(" 0x%8.8x (%3u)\n",p->ia,p->count); |
240 |
|
|
241 |
|
if (cpu->idle_pc_prop_count < CPU_IDLE_PC_MAX_RES) { |
242 |
|
res = &cpu->idle_pc_prop[cpu->idle_pc_prop_count++]; |
243 |
|
|
244 |
|
res->pc = p->ia; |
245 |
|
res->count = p->count; |
246 |
|
} |
247 |
|
} |
248 |
|
|
249 |
|
printf("\n"); |
250 |
} |
} |
251 |
|
|
252 |
/* Re-enable IRQ */ |
/* Re-enable IRQ */ |
420 |
printf("\n"); |
printf("\n"); |
421 |
printf(" ia = 0x%8.8x, lr = 0x%8.8x\n", pcpu->ia, pcpu->lr); |
printf(" ia = 0x%8.8x, lr = 0x%8.8x\n", pcpu->ia, pcpu->lr); |
422 |
printf(" cr = 0x%8.8x, msr = 0x%8.8x, xer = 0x%8.8x, dec = 0x%8.8x\n", |
printf(" cr = 0x%8.8x, msr = 0x%8.8x, xer = 0x%8.8x, dec = 0x%8.8x\n", |
423 |
pcpu->cr, pcpu->msr, |
ppc32_get_cr(pcpu), pcpu->msr, |
424 |
pcpu->xer | (pcpu->xer_ca << PPC32_XER_CA_BIT), |
pcpu->xer | (pcpu->xer_ca << PPC32_XER_CA_BIT), |
425 |
pcpu->dec); |
pcpu->dec); |
426 |
|
|
438 |
printf(" Timer IRQ count: %llu, pending: %u, timer drift: %u\n\n", |
printf(" Timer IRQ count: %llu, pending: %u, timer drift: %u\n\n", |
439 |
pcpu->timer_irq_count,pcpu->timer_irq_pending,pcpu->timer_drift); |
pcpu->timer_irq_count,pcpu->timer_irq_pending,pcpu->timer_drift); |
440 |
|
|
441 |
|
printf(" Device access count: %llu\n",cpu->dev_access_counter); |
442 |
|
|
443 |
printf("\n"); |
printf("\n"); |
444 |
} |
} |
445 |
|
|