675 |
pthread_t timer_irq_thread; |
pthread_t timer_irq_thread; |
676 |
insn_block_t *block; |
insn_block_t *block; |
677 |
m_uint32_t phys_page; |
m_uint32_t phys_page; |
|
int idle_count = 0; |
|
678 |
int timer_irq_check = 0; |
int timer_irq_check = 0; |
679 |
|
|
680 |
if (pthread_create(&timer_irq_thread,NULL, |
if (pthread_create(&timer_irq_thread,NULL, |
681 |
(void *)mips64_timer_irq_run,cpu)) |
(void *)mips64_timer_irq_run,cpu)) |
682 |
{ |
{ |
683 |
fprintf(stderr,"VM '%s': unable to create Timer IRQ thread for CPU%u.\n", |
fprintf(stderr, |
684 |
|
"VM '%s': unable to create Timer IRQ thread for CPU%u.\n", |
685 |
cpu->vm->name,cpu->id); |
cpu->vm->name,cpu->id); |
686 |
cpu_stop(cpu); |
cpu_stop(cpu); |
687 |
return NULL; |
return NULL; |
688 |
} |
} |
689 |
|
|
690 |
cpu->cpu_thread_running = TRUE; |
cpu->cpu_thread_running = TRUE; |
691 |
|
|
692 |
start_cpu: |
start_cpu: |
693 |
|
cpu->idle_count = 0; |
694 |
|
|
695 |
for(;;) { |
for(;;) { |
696 |
if (unlikely(cpu->state != MIPS_CPU_RUNNING)) |
if (unlikely(cpu->state != MIPS_CPU_RUNNING)) |
697 |
break; |
break; |
698 |
|
|
699 |
/* Handle virtual idle loop */ |
/* Handle virtual idle loop */ |
700 |
if (unlikely(cpu->pc == cpu->idle_pc)) { |
if (unlikely(cpu->pc == cpu->idle_pc)) { |
701 |
if (++idle_count == cpu->idle_max) { |
if (++cpu->idle_count == cpu->idle_max) { |
702 |
mips64_idle_loop(cpu); |
mips64_idle_loop(cpu); |
703 |
idle_count = 0; |
cpu->idle_count = 0; |
704 |
} |
} |
705 |
} |
} |
706 |
|
|