diff options
Diffstat (limited to 'cpukit/score/src/isr.c')
-rw-r--r-- | cpukit/score/src/isr.c | 64 |
1 files changed, 30 insertions, 34 deletions
diff --git a/cpukit/score/src/isr.c b/cpukit/score/src/isr.c index 1078ef6f63..3bda275b07 100644 --- a/cpukit/score/src/isr.c +++ b/cpukit/score/src/isr.c @@ -23,7 +23,6 @@ #include <rtems/score/interr.h> #include <rtems/score/percpu.h> #include <rtems/score/stackimpl.h> -#include <rtems/score/wkspace.h> #include <rtems/config.h> #if (CPU_SIMPLE_VECTORED_INTERRUPTS == TRUE) @@ -36,51 +35,48 @@ void _ISR_Handler_initialization( void ) { + uint32_t cpu_max; + uint32_t cpu_index; + size_t stack_size; + char *stack_low; + _ISR_Nest_level = 0; #if (CPU_SIMPLE_VECTORED_INTERRUPTS == TRUE) _CPU_Initialize_vectors(); #endif -#if ( CPU_ALLOCATE_INTERRUPT_STACK == TRUE ) - { - size_t stack_size = rtems_configuration_get_interrupt_stack_size(); - uint32_t cpu_max = rtems_configuration_get_maximum_processors(); - uint32_t cpu_index; + stack_size = rtems_configuration_get_interrupt_stack_size(); - if ( !_Stack_Is_enough( stack_size ) ) - _Internal_error( INTERNAL_ERROR_INTERRUPT_STACK_TOO_SMALL ); + if ( !_Stack_Is_enough( stack_size ) ) + _Internal_error( INTERNAL_ERROR_INTERRUPT_STACK_TOO_SMALL ); - for ( cpu_index = 0 ; cpu_index < cpu_max; ++cpu_index ) { - Per_CPU_Control *cpu = _Per_CPU_Get_by_index( cpu_index ); - void *low = _Workspace_Allocate_or_fatal_error( stack_size ); - void *high = _Addresses_Add_offset( low, stack_size ); + cpu_max = rtems_configuration_get_maximum_processors(); + stack_low = _Configuration_Interrupt_stack_area_begin; -#if (CPU_STACK_ALIGNMENT != 0) - high = _Addresses_Align_down( high, CPU_STACK_ALIGNMENT ); -#endif + for ( cpu_index = 0 ; cpu_index < cpu_max; ++cpu_index ) { + Per_CPU_Control *cpu; + char *stack_high; - cpu->interrupt_stack_low = low; - cpu->interrupt_stack_high = high; + cpu = _Per_CPU_Get_by_index( cpu_index ); + stack_high = _Addresses_Add_offset( stack_low, stack_size ); - /* - * Interrupt stack might have to be aligned and/or setup in a specific - * way. Do not use the local low or high variables here since - * _CPU_Interrupt_stack_setup() is a nasty macro that might want to play - * with the real memory locations. - */ -#if defined(_CPU_Interrupt_stack_setup) - _CPU_Interrupt_stack_setup( - cpu->interrupt_stack_low, - cpu->interrupt_stack_high - ); -#endif - } - } + cpu->interrupt_stack_low = stack_low; + cpu->interrupt_stack_high = stack_high; + /* + * Interrupt stack might have to be aligned and/or setup in a specific + * way. Do not use the local low or high variables here since + * _CPU_Interrupt_stack_setup() is a nasty macro that might want to play + * with the real memory locations. + */ +#if defined(_CPU_Interrupt_stack_setup) + _CPU_Interrupt_stack_setup( + cpu->interrupt_stack_low, + cpu->interrupt_stack_high + ); #endif -#if ( CPU_HAS_HARDWARE_INTERRUPT_STACK == TRUE ) - _CPU_Install_interrupt_stack(); -#endif + stack_low = stack_high; + } } |