Rev 2131 | Rev 2292 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
| Rev 2131 | Rev 2283 | ||
|---|---|---|---|
| Line 59... | Line 59... | ||
| 59 | #include <adt/list.h> |
59 | #include <adt/list.h> |
| 60 | #include <panic.h> |
60 | #include <panic.h> |
| 61 | #include <cpu.h> |
61 | #include <cpu.h> |
| 62 | #include <print.h> |
62 | #include <print.h> |
| 63 | #include <debug.h> |
63 | #include <debug.h> |
| - | 64 | #include <proc/tasklet.h> |
|
| 64 | 65 | ||
| 65 | static void before_task_runs(void); |
66 | static void before_task_runs(void); |
| 66 | static void before_thread_runs(void); |
67 | static void before_thread_runs(void); |
| 67 | static void after_thread_ran(void); |
68 | static void after_thread_ran(void); |
| 68 | static void scheduler_separated_stack(void); |
69 | static void scheduler_separated_stack(void); |
| Line 224... | Line 225... | ||
| 224 | 225 | ||
| 225 | /* |
226 | /* |
| 226 | * Take the first thread from the queue. |
227 | * Take the first thread from the queue. |
| 227 | */ |
228 | */ |
| 228 | t = list_get_instance(r->rq_head.next, thread_t, rq_link); |
229 | t = list_get_instance(r->rq_head.next, thread_t, rq_link); |
| - | 230 | if (verbose) |
|
| - | 231 | printf("cpu%d removing, rq_head %x, t: %x, next: %x, link: %x \n",CPU->id, r->rq_head, t, r->rq_head.next, t->rq_link); |
|
| 229 | list_remove(&t->rq_link); |
232 | list_remove(&t->rq_link); |
| - | 233 | if (verbose) |
|
| - | 234 | printf("cpu%d removed, rq_head %x, t: %x, next: %x, link: %x \n",CPU->id, r->rq_head, t, r->rq_head.next, t->rq_link); |
|
| 230 | 235 | ||
| 231 | spinlock_unlock(&r->lock); |
236 | spinlock_unlock(&r->lock); |
| 232 | 237 | ||
| 233 | spinlock_lock(&t->lock); |
238 | spinlock_lock(&t->lock); |
| 234 | t->cpu = CPU; |
239 | t->cpu = CPU; |
| Line 436... | Line 441... | ||
| 436 | if (THREAD->call_me) { |
441 | if (THREAD->call_me) { |
| 437 | THREAD->call_me(THREAD->call_me_with); |
442 | THREAD->call_me(THREAD->call_me_with); |
| 438 | THREAD->call_me = NULL; |
443 | THREAD->call_me = NULL; |
| 439 | THREAD->call_me_with = NULL; |
444 | THREAD->call_me_with = NULL; |
| 440 | } |
445 | } |
| 441 | 446 | if (verbose) |
|
| - | 447 | printf("cpu%d, Sleeping unlocking \n", CPU->id); |
|
| 442 | spinlock_unlock(&THREAD->lock); |
448 | spinlock_unlock(&THREAD->lock); |
| 443 | 449 | ||
| 444 | break; |
450 | break; |
| 445 | 451 | ||
| 446 | default: |
452 | default: |
| Line 452... | Line 458... | ||
| 452 | break; |
458 | break; |
| 453 | } |
459 | } |
| 454 | 460 | ||
| 455 | THREAD = NULL; |
461 | THREAD = NULL; |
| 456 | } |
462 | } |
| 457 | 463 | if (verbose) |
|
| - | 464 | printf("cpu%d looking for next thread\n", CPU->id); |
|
| 458 | THREAD = find_best_thread(); |
465 | THREAD = find_best_thread(); |
| 459 | 466 | ||
| - | 467 | if (verbose) |
|
| - | 468 | printf("cpu%d t locking THREAD:%x \n", CPU->id, THREAD); |
|
| 460 | spinlock_lock(&THREAD->lock); |
469 | spinlock_lock(&THREAD->lock); |
| 461 | priority = THREAD->priority; |
470 | priority = THREAD->priority; |
| 462 | spinlock_unlock(&THREAD->lock); |
471 | spinlock_unlock(&THREAD->lock); |
| - | 472 | if (verbose) |
|
| - | 473 | printf("cpu%d t unlocked after priority THREAD:%x \n", CPU->id, THREAD); |
|
| 463 | 474 | ||
| 464 | relink_rq(priority); |
475 | relink_rq(priority); |
| 465 | 476 | ||
| 466 | /* |
477 | /* |
| 467 | * If both the old and the new task are the same, lots of work is |
478 | * If both the old and the new task are the same, lots of work is |