Changeset ad7a6c9 in mainline for kernel/generic/src/proc/scheduler.c


Ignore:
Timestamp:
2011-03-30T13:10:24Z (14 years ago)
Author:
Vojtech Horky <vojtechhorky@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
4ae90f9
Parents:
6e50466 (diff), d6b81941 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent.
Message:

Merge mainline changes

File:
1 edited

Legend:

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

    r6e50466 rad7a6c9  
    6262#include <print.h>
    6363#include <debug.h>
    64 
    65 static void before_task_runs(void);
    66 static void before_thread_runs(void);
    67 static void after_thread_ran(void);
     64#include <stacktrace.h>
     65
    6866static void scheduler_separated_stack(void);
    6967
     
    7169
    7270/** Carry out actions before new task runs. */
    73 void before_task_runs(void)
     71static void before_task_runs(void)
    7472{
    7573        before_task_runs_arch();
     
    8078 * Perform actions that need to be
    8179 * taken before the newly selected
    82  * tread is passed control.
     80 * thread is passed control.
    8381 *
    8482 * THREAD->lock is locked on entry
    8583 *
    8684 */
    87 void before_thread_runs(void)
     85static void before_thread_runs(void)
    8886{
    8987        before_thread_runs_arch();
     88       
    9089#ifdef CONFIG_FPU_LAZY
    91         if(THREAD == CPU->fpu_owner)
     90        if (THREAD == CPU->fpu_owner)
    9291                fpu_enable();
    9392        else
     
    102101        }
    103102#endif
     103       
     104#ifdef CONFIG_UDEBUG
     105        if (THREAD->btrace) {
     106                istate_t *istate = THREAD->udebug.uspace_state;
     107                if (istate != NULL) {
     108                        printf("Thread %" PRIu64 " stack trace:\n", THREAD->tid);
     109                        stack_trace_istate(istate);
     110                }
     111               
     112                THREAD->btrace = false;
     113        }
     114#endif
    104115}
    105116
     
    113124 *
    114125 */
    115 void after_thread_ran(void)
     126static void after_thread_ran(void)
    116127{
    117128        after_thread_ran_arch();
     
    391402         * possible destruction should thread_destroy() be called on this or any
    392403         * other processor while the scheduler is still using them.
    393          *
    394404         */
    395405        if (old_task)
     
    417427                                 * The thread structure is kept allocated until
    418428                                 * somebody calls thread_detach() on it.
    419                                  *
    420429                                 */
    421430                                if (!irq_spinlock_trylock(&THREAD->join_wq.lock)) {
    422431                                        /*
    423432                                         * Avoid deadlock.
    424                                          *
    425433                                         */
    426434                                        irq_spinlock_unlock(&THREAD->lock, false);
     
    443451                        /*
    444452                         * Prefer the thread after it's woken up.
    445                          *
    446453                         */
    447454                        THREAD->priority = -1;
     
    451458                         * waitq_sleep(). Address of wq->lock is kept in
    452459                         * THREAD->sleep_queue.
    453                          *
    454460                         */
    455461                        irq_spinlock_unlock(&THREAD->sleep_queue->lock, false);
     
    461467                        /*
    462468                         * Entering state is unexpected.
    463                          *
    464469                         */
    465470                        panic("tid%" PRIu64 ": unexpected state %s.",
     
    480485       
    481486        /*
    482          * If both the old and the new task are the same, lots of work is
    483          * avoided.
    484          *
     487         * If both the old and the new task are the same,
     488         * lots of work is avoided.
    485489         */
    486490        if (TASK != THREAD->task) {
     
    488492               
    489493                /*
    490                  * Note that it is possible for two tasks to share one address
    491                  * space.
    492                  (
     494                 * Note that it is possible for two tasks
     495                 * to share one address space.
    493496                 */
    494497                if (old_as != new_as) {
     
    496499                         * Both tasks and address spaces are different.
    497500                         * Replace the old one with the new one.
    498                          *
    499501                         */
    500502                        as_switch(old_as, new_as);
     
    527529         * necessary, is to be mapped in before_thread_runs(). This
    528530         * function must be executed before the switch to the new stack.
    529          *
    530531         */
    531532        before_thread_runs();
     
    534535         * Copy the knowledge of CPU, TASK, THREAD and preemption counter to
    535536         * thread's stack.
    536          *
    537537         */
    538538        the_copy(THE, (the_t *) THREAD->kstack);
     
    658658                                /*
    659659                                 * Ready thread on local CPU
    660                                  *
    661660                                 */
    662661                               
Note: See TracChangeset for help on using the changeset viewer.