source: rtems/cpukit/score/src/threadstartmultitasking.c @ da42259

4.104.115
Last change on this file since da42259 was aae7f1a1, checked in by Ralf Corsepius <ralf.corsepius@…>, on 12/22/08 at 05:52:32

Eliminate TRUE/FALSE.

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