/[qemu]/qemu/vl.c
ViewVC logotype

Diff of /qemu/vl.c

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

revision 1.147 by bellard, Mon Nov 21 23:25:50 2005 UTC revision 1.148 by bellard, Wed Nov 23 21:01:03 2005 UTC
# Line 3682  void main_loop_wait(int timeout) Line 3682  void main_loop_wait(int timeout)
3682    
3683  static CPUState *cur_cpu;  static CPUState *cur_cpu;
3684    
 static CPUState *find_next_cpu(void)  
 {  
     CPUState *env;  
     env = cur_cpu;  
     for(;;) {  
         /* get next cpu */  
         env = env->next_cpu;  
         if (!env)  
             env = first_cpu;  
         if (!env->cpu_halted)  
             break;  
         /* all CPUs are halted ? */  
         if (env == cur_cpu)  
             return NULL;  
     }  
     cur_cpu = env;  
     return env;  
 }  
   
3685  int main_loop(void)  int main_loop(void)
3686  {  {
3687      int ret, timeout;      int ret, timeout;
# Line 3709  int main_loop(void) Line 3690  int main_loop(void)
3690      cur_cpu = first_cpu;      cur_cpu = first_cpu;
3691      for(;;) {      for(;;) {
3692          if (vm_running) {          if (vm_running) {
3693              /* find next cpu to run */  
3694              /* XXX: handle HLT correctly */              env = cur_cpu;
3695              env = find_next_cpu();              for(;;) {
3696              if (!env)                  /* get next cpu */
3697                  ret = EXCP_HLT;                  env = env->next_cpu;
3698              else                  if (!env)
3699                        env = first_cpu;
3700                  ret = cpu_exec(env);                  ret = cpu_exec(env);
3701                    if (ret != EXCP_HALTED)
3702                        break;
3703                    /* all CPUs are halted ? */
3704                    if (env == cur_cpu) {
3705                        ret = EXCP_HLT;
3706                        break;
3707                    }
3708                }
3709                cur_cpu = env;
3710    
3711              if (shutdown_requested) {              if (shutdown_requested) {
3712                  ret = EXCP_INTERRUPT;                  ret = EXCP_INTERRUPT;
3713                  break;                  break;

Legend:
Removed from v.1.147  
changed lines
  Added in v.1.148

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26