[PATCH 04/11] smp: Make CPU_ALLOCATE_INTERRUPT_STACK optional

Sebastian Huber sebastian.huber at embedded-brains.de
Mon May 27 10:58:09 UTC 2013


---
 cpukit/score/include/rtems/score/percpu.h |    4 ----
 cpukit/score/src/percpu.c                 |   22 +++++++++++++---------
 2 files changed, 13 insertions(+), 13 deletions(-)

diff --git a/cpukit/score/include/rtems/score/percpu.h b/cpukit/score/include/rtems/score/percpu.h
index 3e4712d..5469d25 100644
--- a/cpukit/score/include/rtems/score/percpu.h
+++ b/cpukit/score/include/rtems/score/percpu.h
@@ -60,10 +60,6 @@ extern "C" {
 typedef struct Thread_Control_struct Thread_Control;
 #endif
 
-#if (CPU_ALLOCATE_INTERRUPT_STACK == FALSE) && defined(RTEMS_SMP)
-  #error "RTEMS must allocate per CPU interrupt stack for SMP"
-#endif
-
 typedef enum {
 
   /**
diff --git a/cpukit/score/src/percpu.c b/cpukit/score/src/percpu.c
index 0fcabbe..d40b2a6 100644
--- a/cpukit/score/src/percpu.c
+++ b/cpukit/score/src/percpu.c
@@ -31,15 +31,11 @@
 
   void _SMP_Handler_initialize(void)
   {
-    int         cpu;
-    size_t      size;
-    uintptr_t   ptr;
-
+    int cpu;
 
     /*
      *  Initialize per cpu pointer table
      */
-    size = rtems_configuration_get_interrupt_stack_size();
     _Per_CPU_Information_p[0] = &_Per_CPU_Information[0];
     for (cpu=1 ; cpu < rtems_configuration_get_maximum_processors(); cpu++ ) {
 
@@ -47,11 +43,19 @@
 
       _Per_CPU_Information_p[cpu] = p;
 
-      p->interrupt_stack_low = _Workspace_Allocate_or_fatal_error( size );
+#if CPU_ALLOCATE_INTERRUPT_STACK == TRUE
+      {
+        size_t size = rtems_configuration_get_interrupt_stack_size();
+        uintptr_t ptr;
+
+        p->interrupt_stack_low = _Workspace_Allocate_or_fatal_error( size );
+
+        ptr = (uintptr_t) _Addresses_Add_offset( p->interrupt_stack_low, size );
+        ptr &= ~(CPU_STACK_ALIGNMENT - 1);
+        p->interrupt_stack_high = (void *)ptr;
+      }
+#endif
 
-      ptr = (uintptr_t) _Addresses_Add_offset( p->interrupt_stack_low, size );
-      ptr &= ~(CPU_STACK_ALIGNMENT - 1);
-      p->interrupt_stack_high = (void *)ptr;
       p->state = RTEMS_BSP_SMP_CPU_INITIAL_STATE;
       RTEMS_COMPILER_MEMORY_BARRIER();
     }
-- 
1.7.7




More information about the devel mailing list