diff options
| author | kolya <kolya> | 2008-10-15 05:01:39 +0000 | 
|---|---|---|
| committer | kolya <kolya> | 2008-10-15 05:01:39 +0000 | 
| commit | 228e500a0c2b5a26492c84f73951a46c58c86509 (patch) | |
| tree | 5be5a0fd9c9ad4b60d471e3fb5ff3d187512dc9f | |
| parent | 15ce79de141f66c7dd2f2948ce4584a2d31f7040 (diff) | |
| download | xv6-labs-228e500a0c2b5a26492c84f73951a46c58c86509.tar.gz xv6-labs-228e500a0c2b5a26492c84f73951a46c58c86509.tar.bz2 xv6-labs-228e500a0c2b5a26492c84f73951a46c58c86509.zip | |
save cpus.intena in sched(), so we get the right EFLAGS.IF value once a
timer-preempted kernel thread resumes execution in trap() after yield().
otherwise the kernel could get an arbitrary number of nested timer intrs.
| -rw-r--r-- | proc.c | 6 | 
1 files changed, 5 insertions, 1 deletions
| @@ -207,7 +207,7 @@ scheduler(void)    c = &cpus[cpu()];    for(;;){ -    // Enable interrupts on this processor. +    // Enable interrupts on this processor, in lieu of saving intena.      sti();      // Loop over process table looking for process to run. @@ -240,6 +240,8 @@ scheduler(void)  void  sched(void)  { +  int intena; +    if(read_eflags()&FL_IF)      panic("sched interruptible");    if(cp->state == RUNNING) @@ -249,7 +251,9 @@ sched(void)    if(cpus[cpu()].ncli != 1)      panic("sched locks"); +  intena = cpus[cpu()].intena;    swtch(&cp->context, &cpus[cpu()].context); +  cpus[cpu()].intena = intena;  }  // Give up the CPU for one scheduling round. | 
