1 | /* |
---|
2 | * Thread Handler |
---|
3 | * |
---|
4 | * |
---|
5 | * COPYRIGHT (c) 1989-1999. |
---|
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_Load_environment |
---|
36 | * |
---|
37 | * Load starting environment for another thread from its start area in the |
---|
38 | * thread. Only called from t_restart and t_start. |
---|
39 | * |
---|
40 | * Input parameters: |
---|
41 | * the_thread - thread control block pointer |
---|
42 | * |
---|
43 | * Output parameters: NONE |
---|
44 | */ |
---|
45 | |
---|
46 | void _Thread_Load_environment( |
---|
47 | Thread_Control *the_thread |
---|
48 | ) |
---|
49 | { |
---|
50 | boolean is_fp; |
---|
51 | |
---|
52 | #if ( CPU_HARDWARE_FP == TRUE ) || ( CPU_SOFTWARE_FP == TRUE ) |
---|
53 | if ( the_thread->Start.fp_context ) { |
---|
54 | the_thread->fp_context = the_thread->Start.fp_context; |
---|
55 | _Context_Initialize_fp( &the_thread->fp_context ); |
---|
56 | is_fp = TRUE; |
---|
57 | } else |
---|
58 | #endif |
---|
59 | is_fp = FALSE; |
---|
60 | |
---|
61 | |
---|
62 | the_thread->do_post_task_switch_extension = FALSE; |
---|
63 | the_thread->is_preemptible = the_thread->Start.is_preemptible; |
---|
64 | the_thread->budget_algorithm = the_thread->Start.budget_algorithm; |
---|
65 | the_thread->budget_callout = the_thread->Start.budget_callout; |
---|
66 | |
---|
67 | _Context_Initialize( |
---|
68 | &the_thread->Registers, |
---|
69 | the_thread->Start.Initial_stack.area, |
---|
70 | the_thread->Start.Initial_stack.size, |
---|
71 | the_thread->Start.isr_level, |
---|
72 | _Thread_Handler, |
---|
73 | is_fp |
---|
74 | ); |
---|
75 | |
---|
76 | } |
---|