blob: c84e2b438832dee45b1aa40f16d5198af4d8570b (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
|
/**
* @file
*
* @brief Initializes Enviroment for A Thread
*
* @ingroup ScoreThread
*/
/*
* COPYRIGHT (c) 1989-1999.
* On-Line Applications Research Corporation (OAR).
*
* The license and distribution terms for this file may be
* found in the file LICENSE in this distribution or at
* http://www.rtems.org/license/LICENSE.
*/
#if HAVE_CONFIG_H
#include "config.h"
#endif
#include <rtems/score/threadimpl.h>
void _Thread_Load_environment(
Thread_Control *the_thread
)
{
bool is_fp;
uint32_t isr_level;
#if ( CPU_HARDWARE_FP == TRUE ) || ( CPU_SOFTWARE_FP == TRUE )
if ( the_thread->Start.fp_context ) {
the_thread->fp_context = the_thread->Start.fp_context;
_Context_Initialize_fp( &the_thread->fp_context );
is_fp = true;
} else
#endif
is_fp = false;
the_thread->is_preemptible = the_thread->Start.is_preemptible;
the_thread->budget_algorithm = the_thread->Start.budget_algorithm;
the_thread->budget_callout = the_thread->Start.budget_callout;
#if defined( RTEMS_SMP )
/*
* On SMP we have to start the threads with interrupts disabled, see also
* _Thread_Handler() and _Thread_Dispatch(). In _Thread_Handler() the
* _ISR_Set_level() is used to set the desired interrupt state of the thread.
*/
isr_level = CPU_MODES_INTERRUPT_MASK;
#else
isr_level = the_thread->Start.isr_level;
#endif
_Context_Initialize(
&the_thread->Registers,
the_thread->Start.Initial_stack.area,
the_thread->Start.Initial_stack.size,
isr_level,
_Thread_Handler,
is_fp,
the_thread->Start.tls_area
);
}
|