Changeset b49f4ae in mainline for src/proc/scheduler.c


Ignore:
Timestamp:
2005-09-06T09:56:26Z (19 years ago)
Author:
Ondrej Palkovsky <ondrap@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
50a4e25
Parents:
a5d1331
Message:

Added architecture independent hooks for fpu lazy context switching.
It is enabled by defining FPU_LAZY

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/proc/scheduler.c

    ra5d1331 rb49f4ae  
    6161void before_thread_runs(void)
    6262{
    63         before_thread_runs_arch();
    64         fpu_context_restore(&(THREAD->saved_fpu_context));
    65 }
    66 
     63        before_thread_runs_arch();
     64#ifdef FPU_LAZY
     65        if(THREAD==CPU->fpu_owner)
     66                fpu_enable();
     67        else
     68                fpu_disable();
     69#else
     70        fpu_enable();
     71        if (THREAD->fpu_context_exists)
     72                fpu_context_restore(&(THREAD->saved_fpu_context));
     73        else {
     74                fpu_init();
     75                THREAD->fpu_context_exists=1;
     76        }
     77#endif
     78}
     79
     80#ifdef FPU_LAZY
     81void scheduler_fpu_lazy_request(void)
     82{
     83        fpu_enable();
     84        if (CPU->fpu_owner != NULL) { 
     85                fpu_context_save(&CPU->fpu_owner->saved_fpu_context);
     86                /* don't prevent migration */
     87                CPU->fpu_owner->fpu_context_engaged=0;
     88        }
     89        if (THREAD->fpu_context_exists)
     90                fpu_context_restore(&THREAD->saved_fpu_context);
     91        else {
     92                fpu_init();
     93                THREAD->fpu_context_exists=1;
     94        }
     95        CPU->fpu_owner=THREAD;
     96        THREAD->fpu_context_engaged = 1;
     97}
     98#endif
    6799
    68100/** Initialize scheduler
     
    241273        if (THREAD) {
    242274                spinlock_lock(&THREAD->lock);
     275#ifndef FPU_LAZY
    243276                fpu_context_save(&(THREAD->saved_fpu_context));
     277#endif
    244278                if (!context_save(&THREAD->saved_context)) {
    245279                        /*
Note: See TracChangeset for help on using the changeset viewer.