smp: Make CPU_ALLOCATE_INTERRUPT_STACK optional

This commit is contained in:
Sebastian Huber
2013-05-13 15:44:02 +02:00
parent a29704eb04
commit 10643e958c
2 changed files with 13 additions and 13 deletions

View File

@@ -60,10 +60,6 @@ extern "C" {
typedef struct Thread_Control_struct Thread_Control; typedef struct Thread_Control_struct Thread_Control;
#endif #endif
#if (CPU_ALLOCATE_INTERRUPT_STACK == FALSE) && defined(RTEMS_SMP)
#error "RTEMS must allocate per CPU interrupt stack for SMP"
#endif
typedef enum { typedef enum {
/** /**

View File

@@ -32,14 +32,10 @@
void _SMP_Handler_initialize(void) void _SMP_Handler_initialize(void)
{ {
int cpu; int cpu;
size_t size;
uintptr_t ptr;
/* /*
* Initialize per cpu pointer table * Initialize per cpu pointer table
*/ */
size = rtems_configuration_get_interrupt_stack_size();
_Per_CPU_Information_p[0] = &_Per_CPU_Information[0]; _Per_CPU_Information_p[0] = &_Per_CPU_Information[0];
for (cpu=1 ; cpu < rtems_configuration_get_maximum_processors(); cpu++ ) { for (cpu=1 ; cpu < rtems_configuration_get_maximum_processors(); cpu++ ) {
@@ -47,11 +43,19 @@
_Per_CPU_Information_p[cpu] = p; _Per_CPU_Information_p[cpu] = p;
#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 ); p->interrupt_stack_low = _Workspace_Allocate_or_fatal_error( size );
ptr = (uintptr_t) _Addresses_Add_offset( p->interrupt_stack_low, size ); ptr = (uintptr_t) _Addresses_Add_offset( p->interrupt_stack_low, size );
ptr &= ~(CPU_STACK_ALIGNMENT - 1); ptr &= ~(CPU_STACK_ALIGNMENT - 1);
p->interrupt_stack_high = (void *)ptr; p->interrupt_stack_high = (void *)ptr;
}
#endif
p->state = RTEMS_BSP_SMP_CPU_INITIAL_STATE; p->state = RTEMS_BSP_SMP_CPU_INITIAL_STATE;
RTEMS_COMPILER_MEMORY_BARRIER(); RTEMS_COMPILER_MEMORY_BARRIER();
} }