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