[rtems commit] score: _CPU_Context_switch_to_first_task_smp()

Sebastian Huber sebh at rtems.org
Wed Feb 5 14:40:14 UTC 2014


Module:    rtems
Branch:    master
Commit:    558cc8ddb73c42bcf3de7bf7e2576ffc01f15699
Changeset: http://git.rtems.org/rtems/commit/?id=558cc8ddb73c42bcf3de7bf7e2576ffc01f15699

Author:    Sebastian Huber <sebastian.huber at embedded-brains.de>
Date:      Wed Feb  5 15:41:00 2014 +0100

score: _CPU_Context_switch_to_first_task_smp()

Delete _CPU_Context_switch_to_first_task_smp() and use
_CPU_Context_restore() instead.

---

 c/src/lib/libbsp/sparc/shared/irq_asm.S    |   28 ----------------------------
 cpukit/score/cpu/arm/rtems/score/cpu.h     |    3 ---
 cpukit/score/cpu/i386/rtems/score/cpu.h    |    3 ---
 cpukit/score/cpu/powerpc/rtems/score/cpu.h |    3 ---
 cpukit/score/cpu/sparc/rtems/score/cpu.h   |   14 --------------
 cpukit/score/include/rtems/score/context.h |   17 -----------------
 cpukit/score/src/threadstartmultitasking.c |    2 +-
 7 files changed, 1 insertions(+), 69 deletions(-)

diff --git a/c/src/lib/libbsp/sparc/shared/irq_asm.S b/c/src/lib/libbsp/sparc/shared/irq_asm.S
index 66125c7..dbf4af9 100644
--- a/c/src/lib/libbsp/sparc/shared/irq_asm.S
+++ b/c/src/lib/libbsp/sparc/shared/irq_asm.S
@@ -239,34 +239,6 @@ SYM(_CPU_Context_restore):
         GET_SELF_CPU_CONTROL %o3, %o4
         ba      SYM(_CPU_Context_restore_heir)
         mov     %i0, %o1                      ! in the delay slot
-        .align 4
-
-#if defined(RTEMS_SMP)
-/*
- *  void _CPU_Context_switch_to_first_task_smp(
- *    Context_Control *new_context
- *  )
- *
- *  This routine is only used to switch to the first task on a
- *  secondary core in an SMP configuration.  We do not need to
- *  flush any windows and, in fact, this can be dangerous
- *  as they may or may not be initialized properly.  So we just
- *  reinitialize the PSR and WIM.
- */
-        PUBLIC(_CPU_Context_switch_to_first_task_smp)
-SYM(_CPU_Context_switch_to_first_task_smp):
-	mov	%psr, %g1		! Turn of traps when modifying WIM
-	andn	%g1, SPARC_PSR_ET_MASK, %g1
-	mov	%g1, %psr
-	/* WIM and PSR will be set in done_flushing, it need args:
-	 * g1=PSR, g3=CWP, o1=Context
-	 */
-	and	%g1, SPARC_NUMBER_OF_REGISTER_WINDOWS - 1, %g3
-	nop
-	mov	%o0, %o1		! in the delay slot
-	GET_SELF_CPU_CONTROL %o3, %o4
-	ba,a	done_flushing
-#endif
 
 /*
  *  void _ISR_Handler()
diff --git a/cpukit/score/cpu/arm/rtems/score/cpu.h b/cpukit/score/cpu/arm/rtems/score/cpu.h
index 216f39f..a2498aa 100644
--- a/cpukit/score/cpu/arm/rtems/score/cpu.h
+++ b/cpukit/score/cpu/arm/rtems/score/cpu.h
@@ -470,9 +470,6 @@ void _CPU_Context_volatile_clobber( uintptr_t pattern );
 void _CPU_Context_validate( uintptr_t pattern );
 
 #ifdef RTEMS_SMP
-  #define _CPU_Context_switch_to_first_task_smp( _context ) \
-    _CPU_Context_restore( _context )
-
   RTEMS_COMPILER_PURE_ATTRIBUTE static inline uint32_t
     _CPU_SMP_Get_current_processor( void )
   {
diff --git a/cpukit/score/cpu/i386/rtems/score/cpu.h b/cpukit/score/cpu/i386/rtems/score/cpu.h
index dd06059..b308ccf 100644
--- a/cpukit/score/cpu/i386/rtems/score/cpu.h
+++ b/cpukit/score/cpu/i386/rtems/score/cpu.h
@@ -462,9 +462,6 @@ uint32_t   _CPU_ISR_Get_level( void );
    _CPU_Context_restore( (_the_context) );
 
 #if defined(RTEMS_SMP)
-  #define _CPU_Context_switch_to_first_task_smp( _the_context ) \
-     _CPU_Context_restore( (_the_context) );
-
   RTEMS_COMPILER_PURE_ATTRIBUTE uint32_t _CPU_SMP_Get_current_processor( void );
 
   void _CPU_SMP_Send_interrupt( uint32_t target_processor_index );
diff --git a/cpukit/score/cpu/powerpc/rtems/score/cpu.h b/cpukit/score/cpu/powerpc/rtems/score/cpu.h
index 8eb2327..45b8827 100644
--- a/cpukit/score/cpu/powerpc/rtems/score/cpu.h
+++ b/cpukit/score/cpu/powerpc/rtems/score/cpu.h
@@ -1010,9 +1010,6 @@ void _CPU_Context_volatile_clobber( uintptr_t pattern );
 void _CPU_Context_validate( uintptr_t pattern );
 
 #ifdef RTEMS_SMP
-  #define _CPU_Context_switch_to_first_task_smp( _context ) \
-    _CPU_Context_restore( _context )
-
   RTEMS_COMPILER_PURE_ATTRIBUTE static inline uint32_t
     _CPU_SMP_Get_current_processor( void )
   {
diff --git a/cpukit/score/cpu/sparc/rtems/score/cpu.h b/cpukit/score/cpu/sparc/rtems/score/cpu.h
index ae89311..ad0cbd2 100644
--- a/cpukit/score/cpu/sparc/rtems/score/cpu.h
+++ b/cpukit/score/cpu/sparc/rtems/score/cpu.h
@@ -1189,20 +1189,6 @@ void _CPU_Context_restore(
 ) RTEMS_COMPILER_NO_RETURN_ATTRIBUTE;
 
 #if defined(RTEMS_SMP)
-  /**
-   * @brief SPARC specific method to switch to first task.
-   *
-   * This routine is only used to switch to the first task on a
-   * secondary core in an SMP configuration.  We do not need to
-   * flush all the windows and, in fact, this can be dangerous
-   * as they may or may not be initialized properly.
-   *
-   * @param[in] new_context is the context to restore
-   */
-  void _CPU_Context_switch_to_first_task_smp(
-    Context_Control *new_context
-  );
-
   RTEMS_COMPILER_PURE_ATTRIBUTE uint32_t _CPU_SMP_Get_current_processor( void );
 
   void _CPU_SMP_Send_interrupt( uint32_t target_processor_index );
diff --git a/cpukit/score/include/rtems/score/context.h b/cpukit/score/include/rtems/score/context.h
index ffffe9b..c0eb80e 100644
--- a/cpukit/score/include/rtems/score/context.h
+++ b/cpukit/score/include/rtems/score/context.h
@@ -106,23 +106,6 @@ extern "C" {
 #define _Context_Restart_self( _the_context ) \
    _CPU_Context_Restart_self( _the_context )
 
-#if defined(RTEMS_SMP)
-/*
- *  @brief Switch to first task on secondary core.
- *
- *  This routine is only used to switch to the first task on a
- *  secondary core in an SMP configuration.  Since the switch
- *  to the first task is done from an interrupt handler, this
- *  may be different from simply restarting the currently running
- *  task.
- *
- *  @param[in] _the_context is the context of the first thread to
- *             run on this core
- */
-#define _Context_Switch_to_first_task_smp( _the_context ) \
-   _CPU_Context_switch_to_first_task_smp( _the_context )
-#endif
-
 /**
  *  @brief Return starting address of floating point context.
  *
diff --git a/cpukit/score/src/threadstartmultitasking.c b/cpukit/score/src/threadstartmultitasking.c
index 74ed40c..52337ab 100644
--- a/cpukit/score/src/threadstartmultitasking.c
+++ b/cpukit/score/src/threadstartmultitasking.c
@@ -78,7 +78,7 @@ void _Thread_Start_multitasking( Context_Control *context )
      */
     self_cpu->thread_dispatch_disable_level = 1;
 
-    _CPU_Context_switch_to_first_task_smp( &heir->Registers );
+    _CPU_Context_restore( &heir->Registers );
   }
 #endif
 }




More information about the vc mailing list