summaryrefslogtreecommitdiffstats
path: root/cpukit
diff options
context:
space:
mode:
authorSebastian Huber <sebastian.huber@embedded-brains.de>2015-06-02 21:43:54 +0200
committerSebastian Huber <sebastian.huber@embedded-brains.de>2015-06-09 09:05:50 +0200
commit335e5caa9a9e0f28acf94fe4c2871017fcd71794 (patch)
tree13eb37c82f52e2a0e6199eb03aad6590eeabc566 /cpukit
parentb276507552744bba55017ef82a43afc3a6f63b6d (diff)
downloadrtems-335e5caa9a9e0f28acf94fe4c2871017fcd71794.tar.bz2
score: Add Thread_Control::is_fp
Store the floating-point unit property in the thread control block regardless of the CPU_HARDWARE_FP and CPU_SOFTWARE_FP settings. Make sure the floating-point unit is only enabled for the corresponding multilibs. This helps targets which have a volatile only floating point context like SPARC for example.
Diffstat (limited to '')
-rw-r--r--cpukit/posix/src/pthreadcreate.c6
-rw-r--r--cpukit/score/cpu/mips/cpu.c12
-rw-r--r--cpukit/score/include/rtems/score/thread.h2
-rw-r--r--cpukit/score/src/threadinitialize.c1
-rw-r--r--cpukit/score/src/threadloadenv.c7
5 files changed, 16 insertions, 12 deletions
diff --git a/cpukit/posix/src/pthreadcreate.c b/cpukit/posix/src/pthreadcreate.c
index c448c4253b..498242c02b 100644
--- a/cpukit/posix/src/pthreadcreate.c
+++ b/cpukit/posix/src/pthreadcreate.c
@@ -155,11 +155,7 @@ int pthread_create(
* Currently all POSIX threads are floating point if the hardware
* supports it.
*/
- #if ( CPU_HARDWARE_FP == TRUE ) || ( CPU_SOFTWARE_FP == TRUE )
- is_fp = true;
- #else
- is_fp = false;
- #endif
+ is_fp = true;
/*
* Allocate the thread control block.
diff --git a/cpukit/score/cpu/mips/cpu.c b/cpukit/score/cpu/mips/cpu.c
index fffee5e8d7..cb6c664f7a 100644
--- a/cpukit/score/cpu/mips/cpu.c
+++ b/cpukit/score/cpu/mips/cpu.c
@@ -179,6 +179,7 @@ void _CPU_Context_Initialize(
{
uintptr_t stack_tmp;
__MIPS_REGISTER_TYPE intlvl = new_level & 0xff;
+ __MIPS_REGISTER_TYPE c0_sr;
stack_tmp = (uintptr_t)stack_base;
stack_tmp += ((size) - CPU_STACK_ALIGNMENT);
@@ -187,11 +188,18 @@ void _CPU_Context_Initialize(
the_context->sp = (__MIPS_REGISTER_TYPE) stack_tmp;
the_context->fp = (__MIPS_REGISTER_TYPE) stack_tmp;
the_context->ra = (__MIPS_REGISTER_TYPE) (uintptr_t)entry_point;
- the_context->c0_sr =
+
+ c0_sr =
((intlvl==0)? (mips_interrupt_mask() | 0x300 | _INTON):
( ((intlvl<<9) & mips_interrupt_mask()) | 0x300 |
((intlvl & 1)?_INTON:0)) ) |
- SR_CU0 | ((is_fp)?SR_CU1:0) | _EXTRABITS;
+ SR_CU0 | _EXTRABITS;
+#if MIPS_HAS_FPU == 1
+ if ( is_fp ) {
+ c0_sr |= SR_CU1;
+ }
+#endif
+ the_context->c0_sr = c0_sr;
}
/*
* _CPU_Internal_threads_Idle_thread_body
diff --git a/cpukit/score/include/rtems/score/thread.h b/cpukit/score/include/rtems/score/thread.h
index 39fcb1707f..c69646b26b 100644
--- a/cpukit/score/include/rtems/score/thread.h
+++ b/cpukit/score/include/rtems/score/thread.h
@@ -750,6 +750,8 @@ struct Thread_Control_struct {
#endif
/** This field is true if the thread is preemptible. */
bool is_preemptible;
+ /** This field is true if the thread uses the floating point unit. */
+ bool is_fp;
/**
* @brief Scheduler related control.
diff --git a/cpukit/score/src/threadinitialize.c b/cpukit/score/src/threadinitialize.c
index 2133d7485b..a09693acc0 100644
--- a/cpukit/score/src/threadinitialize.c
+++ b/cpukit/score/src/threadinitialize.c
@@ -159,6 +159,7 @@ bool _Thread_Initialize(
* General initialization
*/
+ the_thread->is_fp = is_fp;
the_thread->Start.isr_level = isr_level;
the_thread->Start.is_preemptible = is_preemptible;
the_thread->Start.budget_algorithm = budget_algorithm;
diff --git a/cpukit/score/src/threadloadenv.c b/cpukit/score/src/threadloadenv.c
index c84e2b4388..43564af878 100644
--- a/cpukit/score/src/threadloadenv.c
+++ b/cpukit/score/src/threadloadenv.c
@@ -25,17 +25,14 @@ 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;
@@ -58,7 +55,7 @@ void _Thread_Load_environment(
the_thread->Start.Initial_stack.size,
isr_level,
_Thread_Handler,
- is_fp,
+ the_thread->is_fp,
the_thread->Start.tls_area
);