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

5
Last change on this file since fce900b5 was d67c869, checked in by Sebastian Huber <sebastian.huber@…>, on 03/23/16 at 06:43:01

score: Use RTEMS_UNREACHABLE()

The _CPU_Context_switch() in _Thread_Start_multitasking() does in fact
not return.

  • Property mode set to 100644
File size: 1.6 KB
Line 
1/**
2 *  @file
3 *
4 *  @brief Start Thread Multitasking
5 *  @ingroup ScoreThread
6 */
7
8/*
9 *  COPYRIGHT (c) 1989-2006.
10 *  On-Line Applications Research Corporation (OAR).
11 *
12 *  The license and distribution terms for this file may be
13 *  found in the file LICENSE in this distribution or at
14 *  http://www.rtems.org/license/LICENSE.
15 */
16
17#if HAVE_CONFIG_H
18#include "config.h"
19#endif
20
21#include <rtems/score/threadimpl.h>
22#include <rtems/score/assert.h>
23
24void _Thread_Start_multitasking( void )
25{
26  Per_CPU_Control *cpu_self = _Per_CPU_Get();
27  Thread_Control  *heir;
28
29#if defined(RTEMS_SMP)
30  _Per_CPU_State_change( cpu_self, PER_CPU_STATE_UP );
31
32  /*
33   * Threads begin execution in the _Thread_Handler() function.   This
34   * function will set the thread dispatch disable level to zero.
35   */
36  cpu_self->thread_dispatch_disable_level = 1;
37#endif
38
39  heir = _Thread_Get_heir_and_make_it_executing( cpu_self );
40
41  _Profiling_Thread_dispatch_disable( cpu_self, 0 );
42
43#if defined(RTEMS_SMP)
44  _CPU_SMP_Prepare_start_multitasking();
45#endif
46
47#if defined(_CPU_Start_multitasking)
48  _CPU_Start_multitasking( &heir->Registers );
49#elif defined(RTEMS_SMP)
50  {
51    Context_Control trash;
52
53    /*
54     * Mark the trash context as executing to not confuse the
55     * _CPU_Context_switch().  On SMP configurations the context switch
56     * contains a special hand over section to atomically switch from the
57     * executing to the currently selected heir thread.
58     */
59    _CPU_Context_Set_is_executing( &trash, true );
60    _CPU_Context_switch( &trash, &heir->Registers );
61    RTEMS_UNREACHABLE();
62  }
63#else
64  _CPU_Context_Restart_self( &heir->Registers );
65#endif
66}
Note: See TracBrowser for help on using the repository browser.