Changeset c1eaec4 in mainline
- Timestamp:
- 2024-01-19T16:21:20Z (12 months ago)
- Branches:
- master
- Children:
- 6a0e568
- Parents:
- 25939997
- git-author:
- Jiří Zárevúcky <zarevucky.jiri@…> (2023-02-19 10:27:42)
- git-committer:
- Jiří Zárevúcky <zarevucky.jiri@…> (2024-01-19 16:21:20)
- Location:
- kernel/generic
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
kernel/generic/include/cpu.h
r25939997 rc1eaec4 76 76 77 77 context_t scheduler_context; 78 79 state_t exiting_state; 78 80 } cpu_local_t; 79 81 -
kernel/generic/src/proc/scheduler.c
r25939997 rc1eaec4 361 361 /* Save current CPU cycle */ 362 362 THREAD->last_cycle = get_cycle(); 363 364 irq_spinlock_unlock(&THREAD->lock, false); 363 365 } 364 366 … … 440 442 } 441 443 442 /* 443 * Through the 'CURRENT' structure, we keep track of THREAD, TASK, CPU, AS 444 * and preemption counter. At this point CURRENT could be coming either 445 * from THREAD's or CPU's stack. 446 * 447 */ 444 irq_spinlock_unlock(&THREAD->lock, false); 445 446 CPU_LOCAL->exiting_state = new_state; 448 447 449 448 current_copy(CURRENT, (current_t *) CPU_LOCAL->stack); 450 449 context_swap(&THREAD->saved_context, &CPU_LOCAL->scheduler_context); 451 450 452 irq_spinlock_unlock(&THREAD->lock, false); 451 assert(CURRENT->mutex_locks == 0); 452 assert(interrupts_disabled()); 453 453 454 interrupts_restore(ipl); 454 455 } … … 476 477 int rq_index; 477 478 THREAD = find_best_thread(&rq_index); 478 479 479 prepare_to_run_thread(rq_index); 480 480 … … 488 488 context_swap(&CPU_LOCAL->scheduler_context, &THREAD->saved_context); 489 489 490 /* Back from the thread. */ 491 490 /* Back from another thread. */ 492 491 assert(CPU != NULL); 493 492 assert(THREAD != NULL); 494 assert( irq_spinlock_locked(&THREAD->lock));493 assert(CURRENT->mutex_locks == 0); 495 494 assert(interrupts_disabled()); 496 495 497 state_t state = THREAD->state; 498 irq_spinlock_unlock(&THREAD->lock, false); 499 500 cleanup_after_thread(THREAD, state); 496 cleanup_after_thread(THREAD, CPU_LOCAL->exiting_state); 501 497 502 498 /* -
kernel/generic/src/proc/thread.c
r25939997 rc1eaec4 122 122 123 123 /* This is where each thread wakes up after its creation */ 124 irq_spinlock_unlock(&THREAD->lock, false);125 124 interrupts_enable(); 126 125
Note:
See TracChangeset
for help on using the changeset viewer.