summaryrefslogtreecommitdiffstats
path: root/cpukit/score/src
diff options
context:
space:
mode:
authorJoel Sherrill <joel.sherrill@OARcorp.com>2010-06-29 00:34:12 +0000
committerJoel Sherrill <joel.sherrill@OARcorp.com>2010-06-29 00:34:12 +0000
commit11e8bc5f0fa2d9485908874dbfe9cd65c1aec477 (patch)
tree8e21888988f4c1e22aff26478e3f158e60c444c6 /cpukit/score/src
parent2010-06-28 Joel Sherrill <joel.sherrill@oarcorp.com> (diff)
downloadrtems-11e8bc5f0fa2d9485908874dbfe9cd65c1aec477.tar.bz2
2010-06-28 Joel Sherrill <joel.sherrill@oarcorp.com>
PR 1573/cpukit * configure.ac, posix/src/killinfo.c, posix/src/psignalclearprocesssignals.c, posix/src/psignalsetprocesssignals.c, posix/src/psignalunblockthread.c, posix/src/pthreadcreate.c, posix/src/pthreadkill.c, posix/src/pthreadsigmask.c, rtems/src/signalsend.c, rtems/src/taskmode.c, score/Makefile.am, score/preinstall.am, score/include/rtems/system.h, score/include/rtems/score/context.h, score/include/rtems/score/isr.h, score/include/rtems/score/thread.h, score/src/isr.c, score/src/isrthreaddispatch.c, score/src/thread.c, score/src/threaddispatch.c, score/src/threadloadenv.c: Add a per cpu data structure which contains the information required by RTEMS for each CPU core. This encapsulates information such as thread executing, heir, idle and dispatch needed. * score/include/rtems/score/percpu.h, score/src/percpu.c: New files.
Diffstat (limited to 'cpukit/score/src')
-rw-r--r--cpukit/score/src/isr.c5
-rw-r--r--cpukit/score/src/isrthreaddispatch.c9
-rw-r--r--cpukit/score/src/percpu.c29
-rw-r--r--cpukit/score/src/thread.c2
-rw-r--r--cpukit/score/src/threaddispatch.c22
-rw-r--r--cpukit/score/src/threadloadenv.c2
6 files changed, 48 insertions, 21 deletions
diff --git a/cpukit/score/src/isr.c b/cpukit/score/src/isr.c
index 0c6956fb19..4925ee9117 100644
--- a/cpukit/score/src/isr.c
+++ b/cpukit/score/src/isr.c
@@ -34,8 +34,6 @@
void _ISR_Handler_initialization( void )
{
- _ISR_Signals_to_thread_executing = false;
-
_ISR_Nest_level = 0;
#if (CPU_SIMPLE_VECTORED_INTERRUPTS == TRUE)
@@ -64,6 +62,9 @@ void _ISR_Handler_initialization( void )
Configuration.interrupt_stack_size
);
+ _CPU_Interrupt_stack_high = (void *)
+ ((uintptr_t) _CPU_Interrupt_stack_high & ~CPU_STACK_ALIGNMENT);
+
/* Interrupt stack might have to be aligned and/or setup
* in a specific way.
*/
diff --git a/cpukit/score/src/isrthreaddispatch.c b/cpukit/score/src/isrthreaddispatch.c
index 229c1fa70e..d0b499b210 100644
--- a/cpukit/score/src/isrthreaddispatch.c
+++ b/cpukit/score/src/isrthreaddispatch.c
@@ -33,15 +33,6 @@ void _ISR_Thread_dispatch( void )
{
if ( _Context_Switch_necessary ) {
_Thread_Dispatch();
- } else if ( _ISR_Signals_to_thread_executing ) {
- _ISR_Signals_to_thread_executing = false;
- if (
- _Thread_Do_post_task_switch_extension
- || _Thread_Executing->do_post_task_switch_extension
- ) {
- _Thread_Executing->do_post_task_switch_extension = false;
- _API_extensions_Run_postswitch();
- }
}
}
diff --git a/cpukit/score/src/percpu.c b/cpukit/score/src/percpu.c
new file mode 100644
index 0000000000..4c719af6db
--- /dev/null
+++ b/cpukit/score/src/percpu.c
@@ -0,0 +1,29 @@
+/*
+ * COPYRIGHT (c) 1989-2010.
+ * 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.com/license/LICENSE.
+ *
+ * $Id$
+ */
+
+#if HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include <rtems/system.h>
+#include <rtems/score/thread.h>
+#include <rtems/score/percpu.h>
+#include <rtems/score/wkspace.h>
+#include <rtems/score/wkspace.h>
+#include <rtems/config.h>
+#include <string.h>
+
+/*
+ * On single core systems, we can efficiently directly access a single
+ * statically allocated per cpu structure. And the fields are initialized
+ * as individual elements just like it has always been done.
+ */
+Per_CPU_Control _Per_CPU_Information;
diff --git a/cpukit/score/src/thread.c b/cpukit/score/src/thread.c
index cc99bf668b..e96770acf1 100644
--- a/cpukit/score/src/thread.c
+++ b/cpukit/score/src/thread.c
@@ -76,8 +76,6 @@ void _Thread_Handler_initialization(void)
_Thread_Allocated_fp = NULL;
#endif
- _Thread_Do_post_task_switch_extension = 0;
-
_Thread_Maximum_extensions = maximum_extensions;
_Thread_Ticks_per_timeslice = ticks_per_timeslice;
diff --git a/cpukit/score/src/threaddispatch.c b/cpukit/score/src/threaddispatch.c
index e0d0f5cdf7..3d7fe24947 100644
--- a/cpukit/score/src/threaddispatch.c
+++ b/cpukit/score/src/threaddispatch.c
@@ -94,12 +94,26 @@ void _Thread_Dispatch( void )
_Thread_Dispatch_disable_level = 1;
_Context_Switch_necessary = false;
_Thread_Executing = heir;
+
+ /*
+ * When the heir and executing are the same, then we are being
+ * requested to do the post switch dispatching. This is normally
+ * done to dispatch signals.
+ */
+ if ( heir == executing )
+ goto post_switch;
+
+ /*
+ * Since heir and executing are not the same, we need to do a real
+ * context switch.
+ */
#if __RTEMS_ADA__
executing->rtems_ada_self = rtems_ada_self;
rtems_ada_self = heir->rtems_ada_self;
#endif
if ( heir->budget_algorithm == THREAD_CPU_BUDGET_ALGORITHM_RESET_TIMESLICE )
heir->cpu_time_budget = _Thread_Ticks_per_timeslice;
+
_ISR_Enable( level );
#ifndef __RTEMS_USE_TICKS_FOR_STATISTICS__
@@ -170,14 +184,10 @@ void _Thread_Dispatch( void )
_ISR_Disable( level );
}
+post_switch:
_Thread_Dispatch_disable_level = 0;
_ISR_Enable( level );
- if ( _Thread_Do_post_task_switch_extension ||
- executing->do_post_task_switch_extension ) {
- executing->do_post_task_switch_extension = false;
- _API_extensions_Run_postswitch();
- }
-
+ _API_extensions_Run_postswitch();
}
diff --git a/cpukit/score/src/threadloadenv.c b/cpukit/score/src/threadloadenv.c
index 6a30adbdde..164db0115a 100644
--- a/cpukit/score/src/threadloadenv.c
+++ b/cpukit/score/src/threadloadenv.c
@@ -58,8 +58,6 @@ void _Thread_Load_environment(
#endif
is_fp = false;
-
- the_thread->do_post_task_switch_extension = 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;