Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • kernel/generic/src/proc/scheduler.c

    rdf58e44 r7e752b2  
    6262#include <print.h>
    6363#include <debug.h>
    64 #include <stacktrace.h>
    65 
     64
     65static void before_task_runs(void);
     66static void before_thread_runs(void);
     67static void after_thread_ran(void);
    6668static void scheduler_separated_stack(void);
    6769
     
    6971
    7072/** Carry out actions before new task runs. */
    71 static void before_task_runs(void)
     73void before_task_runs(void)
    7274{
    7375        before_task_runs_arch();
     
    7880 * Perform actions that need to be
    7981 * taken before the newly selected
    80  * thread is passed control.
     82 * tread is passed control.
    8183 *
    8284 * THREAD->lock is locked on entry
    8385 *
    8486 */
    85 static void before_thread_runs(void)
     87void before_thread_runs(void)
    8688{
    8789        before_thread_runs_arch();
    88        
    8990#ifdef CONFIG_FPU_LAZY
    90         if (THREAD == CPU->fpu_owner)
     91        if(THREAD == CPU->fpu_owner)
    9192                fpu_enable();
    9293        else
     
    101102        }
    102103#endif
    103        
    104         if (THREAD->btrace) {
    105                 istate_t *istate = THREAD->udebug.uspace_state;
    106                 if (istate != NULL) {
    107                         printf("Thread %" PRIu64 " stack trace:\n", THREAD->tid);
    108                         stack_trace_istate(istate);
    109                 }
    110                
    111                 THREAD->btrace = false;
    112         }
    113104}
    114105
     
    122113 *
    123114 */
    124 static void after_thread_ran(void)
     115void after_thread_ran(void)
    125116{
    126117        after_thread_ran_arch();
     
    400391         * possible destruction should thread_destroy() be called on this or any
    401392         * other processor while the scheduler is still using them.
     393         *
    402394         */
    403395        if (old_task)
     
    425417                                 * The thread structure is kept allocated until
    426418                                 * somebody calls thread_detach() on it.
     419                                 *
    427420                                 */
    428421                                if (!irq_spinlock_trylock(&THREAD->join_wq.lock)) {
    429422                                        /*
    430423                                         * Avoid deadlock.
     424                                         *
    431425                                         */
    432426                                        irq_spinlock_unlock(&THREAD->lock, false);
     
    449443                        /*
    450444                         * Prefer the thread after it's woken up.
     445                         *
    451446                         */
    452447                        THREAD->priority = -1;
     
    456451                         * waitq_sleep(). Address of wq->lock is kept in
    457452                         * THREAD->sleep_queue.
     453                         *
    458454                         */
    459455                        irq_spinlock_unlock(&THREAD->sleep_queue->lock, false);
     
    465461                        /*
    466462                         * Entering state is unexpected.
     463                         *
    467464                         */
    468465                        panic("tid%" PRIu64 ": unexpected state %s.",
     
    483480       
    484481        /*
    485          * If both the old and the new task are the same,
    486          * lots of work is avoided.
     482         * If both the old and the new task are the same, lots of work is
     483         * avoided.
     484         *
    487485         */
    488486        if (TASK != THREAD->task) {
     
    490488               
    491489                /*
    492                  * Note that it is possible for two tasks
    493                  * to share one address space.
     490                 * Note that it is possible for two tasks to share one address
     491                 * space.
     492                 (
    494493                 */
    495494                if (old_as != new_as) {
     
    497496                         * Both tasks and address spaces are different.
    498497                         * Replace the old one with the new one.
     498                         *
    499499                         */
    500500                        as_switch(old_as, new_as);
     
    527527         * necessary, is to be mapped in before_thread_runs(). This
    528528         * function must be executed before the switch to the new stack.
     529         *
    529530         */
    530531        before_thread_runs();
     
    533534         * Copy the knowledge of CPU, TASK, THREAD and preemption counter to
    534535         * thread's stack.
     536         *
    535537         */
    536538        the_copy(THE, (the_t *) THREAD->kstack);
     
    656658                                /*
    657659                                 * Ready thread on local CPU
     660                                 *
    658661                                 */
    659662                               
Note: See TracChangeset for help on using the changeset viewer.