source: rtems/cpukit/score/src/threadstartmultitasking.c @ 05df0a8

4.104.114.84.95
Last change on this file since 05df0a8 was 05df0a8, checked in by Joel Sherrill <joel.sherrill@…>, on 05/17/99 at 20:41:13

Thread Handler split into multiple files. Eventually, as RTEMS is
split into one function per file, this will decrease the size of executables.

  • Property mode set to 100644
File size: 2.5 KB
Line 
1/*
2 *  Thread Handler
3 *
4 *
5 *  COPYRIGHT (c) 1989-1998.
6 *  On-Line Applications Research Corporation (OAR).
7 *  Copyright assigned to U.S. Government, 1994.
8 *
9 *  The license and distribution terms for this file may be
10 *  found in found in the file LICENSE in this distribution or at
11 *  http://www.OARcorp.com/rtems/license.html.
12 *
13 *  $Id$
14 */
15
16#include <rtems/system.h>
17#include <rtems/score/apiext.h>
18#include <rtems/score/context.h>
19#include <rtems/score/interr.h>
20#include <rtems/score/isr.h>
21#include <rtems/score/object.h>
22#include <rtems/score/priority.h>
23#include <rtems/score/states.h>
24#include <rtems/score/sysstate.h>
25#include <rtems/score/thread.h>
26#include <rtems/score/threadq.h>
27#include <rtems/score/userext.h>
28#include <rtems/score/wkspace.h>
29
30/*PAGE
31 *
32 *  _Thread_Start_multitasking
33 *
34 *  This kernel routine readies the requested thread, the thread chain
35 *  is adjusted.  A new heir thread may be selected.
36 *
37 *  Input parameters:
38 *    system_thread - pointer to system initialization thread control block
39 *    idle_thread   - pointer to idle thread control block
40 *
41 *  Output parameters:  NONE
42 *
43 *  NOTE:  This routine uses the "blocking" heir selection mechanism.
44 *         This insures the correct heir after a thread restart.
45 *
46 *  INTERRUPT LATENCY:
47 *    ready chain
48 *    select heir
49 */
50
51void _Thread_Start_multitasking( void )
52{
53  /*
54   *  The system is now multitasking and completely initialized. 
55   *  This system thread now either "goes away" in a single processor
56   *  system or "turns into" the server thread in an MP system.
57   */
58
59  _System_state_Set( SYSTEM_STATE_UP );
60
61  _Context_Switch_necessary = FALSE;
62
63  _Thread_Executing = _Thread_Heir;
64
65   /*
66    * Get the init task(s) running.
67    *
68    * Note: Thread_Dispatch() is normally used to dispatch threads.  As
69    *       part of its work, Thread_Dispatch() restores floating point
70    *       state for the heir task.
71    *
72    *       This code avoids Thread_Dispatch(), and so we have to restore
73    *       (actually initialize) the floating point state "by hand".
74    *
75    *       Ignore the CPU_USE_DEFERRED_FP_SWITCH because we must always
76    *       switch in the first thread if it is FP.
77    */
78 
79
80#if ( CPU_HARDWARE_FP == TRUE ) || ( CPU_SOFTWARE_FP == TRUE )
81   /*
82    *  don't need to worry about saving BSP's floating point state
83    */
84
85   if ( _Thread_Heir->fp_context != NULL )
86     _Context_Restore_fp( &_Thread_Heir->fp_context );
87#endif
88
89  _Context_Switch( &_Thread_BSP_context, &_Thread_Heir->Registers );
90}
Note: See TracBrowser for help on using the repository browser.