Changeset c2934b96 in rtems


Ignore:
Timestamp:
Feb 17, 2014, 12:24:55 PM (6 years ago)
Author:
Sebastian Huber <sebastian.huber@…>
Branches:
4.11, master
Children:
801b5d8
Parents:
2729c1c2
git-author:
Sebastian Huber <sebastian.huber@…> (02/17/14 12:24:55)
git-committer:
Sebastian Huber <sebastian.huber@…> (02/19/14 08:59:38)
Message:

score: Move SMP interrupt stack initialization

Move SMP interrupt stack initialization for secondary processors from
_SMP_Handler_initialize() to _ISR_Handler_initialization() to avoid code
duplication. Apply _CPU_Interrupt_stack_setup() to all interrupt
stacks.

Location:
cpukit/score/src
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • cpukit/score/src/isr.c

    r2729c1c2 rc2934b96  
    1919#endif
    2020
    21 #include <rtems/system.h>
     21#include <rtems/score/isr.h>
    2222#include <rtems/score/address.h>
    23 #include <rtems/score/isr.h>
     23#include <rtems/score/interr.h>
     24#include <rtems/score/percpu.h>
    2425#include <rtems/score/stackimpl.h>
    25 #include <rtems/score/interr.h>
    2626#include <rtems/score/wkspace.h>
    2727#include <rtems/config.h>
     
    4242  {
    4343    size_t stack_size = rtems_configuration_get_interrupt_stack_size();
     44    uint32_t max_cpus = rtems_configuration_get_maximum_processors();
     45    uint32_t cpu;
    4446
    4547    if ( !_Stack_Is_enough( stack_size ) )
     
    5052      );
    5153
    52     _CPU_Interrupt_stack_low = _Workspace_Allocate_or_fatal_error(
    53       stack_size
    54     );
    55 
    56     _CPU_Interrupt_stack_high = _Addresses_Add_offset(
    57       _CPU_Interrupt_stack_low,
    58       stack_size
    59     );
    60   }
     54    for ( cpu = 0 ; cpu < max_cpus; ++cpu ) {
     55      Per_CPU_Control *per_cpu = _Per_CPU_Get_by_index( cpu );
     56      void *low = _Workspace_Allocate_or_fatal_error( stack_size );
     57      void *high = _Addresses_Add_offset( low, stack_size );
    6158
    6259#if (CPU_STACK_ALIGNMENT != 0)
    63   _CPU_Interrupt_stack_high = (void *)
    64     ((uintptr_t) _CPU_Interrupt_stack_high & ~(CPU_STACK_ALIGNMENT - 1));
     60      high = _Addresses_Align_down( high, CPU_STACK_ALIGNMENT );
    6561#endif
    6662
    67   /* Interrupt stack might have to be aligned and/or setup
    68    * in a specific way.
    69    */
     63      per_cpu->interrupt_stack_low = low;
     64      per_cpu->interrupt_stack_high = high;
     65
     66      /*
     67       * Interrupt stack might have to be aligned and/or setup in a specific
     68       * way.  Do not use the local low or high variables here since
     69       * _CPU_Interrupt_stack_setup() is a nasty macro that might want to play
     70       * with the real memory locations.
     71       */
    7072#if defined(_CPU_Interrupt_stack_setup)
    71   _CPU_Interrupt_stack_setup(_CPU_Interrupt_stack_low, _CPU_Interrupt_stack_high);
     73      _CPU_Interrupt_stack_setup(
     74        per_cpu->interrupt_stack_low,
     75        per_cpu->interrupt_stack_high
     76      );
    7277#endif
     78    }
     79  }
    7380
    7481#endif
  • cpukit/score/src/percpu.c

    r2729c1c2 rc2934b96  
    3636    uint32_t max_cpus = rtems_configuration_get_maximum_processors();
    3737    uint32_t cpu;
    38 
    39     /*
    40      *  Initialize per cpu pointer table
    41      */
    42     for ( cpu = 1 ; cpu < max_cpus; ++cpu ) {
    43 
    44       Per_CPU_Control *p = _Per_CPU_Get_by_index( cpu );
    45 
    46 #if CPU_ALLOCATE_INTERRUPT_STACK == TRUE
    47       {
    48         size_t size = rtems_configuration_get_interrupt_stack_size();
    49         uintptr_t ptr;
    50 
    51         p->interrupt_stack_low = _Workspace_Allocate_or_fatal_error( size );
    52 
    53         ptr = (uintptr_t) _Addresses_Add_offset( p->interrupt_stack_low, size );
    54         ptr &= ~(CPU_STACK_ALIGNMENT - 1);
    55         p->interrupt_stack_high = (void *)ptr;
    56       }
    57 #endif
    58     }
    5938
    6039    /*
Note: See TracChangeset for help on using the changeset viewer.