diff options
-rw-r--r-- | c/src/exec/score/src/thread.c | 26 | ||||
-rw-r--r-- | cpukit/score/src/thread.c | 26 |
2 files changed, 50 insertions, 2 deletions
diff --git a/c/src/exec/score/src/thread.c b/c/src/exec/score/src/thread.c index 679c168e39..9060185348 100644 --- a/c/src/exec/score/src/thread.c +++ b/c/src/exec/score/src/thread.c @@ -197,7 +197,31 @@ void _Thread_Start_multitasking( void ) _Thread_Executing = _Thread_Heir; - _Context_Switch( &_Thread_BSP_context, &_Thread_Executing->Registers ); + /* + * Get the init task(s) running. + * + * Note: Thread_Dispatch() is normally used to dispatch threads. As + * part of its work, Thread_Dispatch() restores floating point + * state for the heir task. + * + * This code avoids Thread_Dispatch(), and so we have to restore + * (actually initialize) the floating point state "by hand". + * + * Ignore the CPU_USE_DEFERRED_FP_SWITCH because we must always + * switch in the first thread if it is FP. + */ + + +#if ( CPU_HARDWARE_FP == TRUE ) + /* + * don't need to worry about saving BSP's floating point state + */ + + if ( _Thread_Heir->fp_context != NULL ) + _Context_Restore_fp( &_Thread_Heir->fp_context ); +#endif + + _Context_Switch( &_Thread_BSP_context, &_Thread_Heir->Registers ); } /*PAGE diff --git a/cpukit/score/src/thread.c b/cpukit/score/src/thread.c index 679c168e39..9060185348 100644 --- a/cpukit/score/src/thread.c +++ b/cpukit/score/src/thread.c @@ -197,7 +197,31 @@ void _Thread_Start_multitasking( void ) _Thread_Executing = _Thread_Heir; - _Context_Switch( &_Thread_BSP_context, &_Thread_Executing->Registers ); + /* + * Get the init task(s) running. + * + * Note: Thread_Dispatch() is normally used to dispatch threads. As + * part of its work, Thread_Dispatch() restores floating point + * state for the heir task. + * + * This code avoids Thread_Dispatch(), and so we have to restore + * (actually initialize) the floating point state "by hand". + * + * Ignore the CPU_USE_DEFERRED_FP_SWITCH because we must always + * switch in the first thread if it is FP. + */ + + +#if ( CPU_HARDWARE_FP == TRUE ) + /* + * don't need to worry about saving BSP's floating point state + */ + + if ( _Thread_Heir->fp_context != NULL ) + _Context_Restore_fp( &_Thread_Heir->fp_context ); +#endif + + _Context_Switch( &_Thread_BSP_context, &_Thread_Heir->Registers ); } /*PAGE |