source: rtems/cpukit/score/src/isr.c @ 6830941

4.115
Last change on this file since 6830941 was 6830941, checked in by Joel Sherrill <joel.sherrill@…>, on 08/19/10 at 12:13:56

2010-08-19 Gedare Bloom <giddyup44@…>

PR 1680/cpukit

  • score/src/isr.c: Correct initialization of _CPU_Interrupt_stack_high to properly do the alignment. This most likely only would have caused a propblem on CPUs where the stack grows down and have strict alignment.
  • Property mode set to 100644
File size: 1.8 KB
Line 
1/*
2 *  ISR Handler
3 *
4 *
5 *  COPYRIGHT (c) 1989-2008.
6 *  On-Line Applications Research Corporation (OAR).
7 *
8 *  The license and distribution terms for this file may be
9 *  found in the file LICENSE in this distribution or at
10 *  http://www.rtems.com/license/LICENSE.
11 *
12 *  $Id$
13 */
14
15#if HAVE_CONFIG_H
16#include "config.h"
17#endif
18
19#include <rtems/system.h>
20#include <rtems/score/isr.h>
21#include <rtems/score/stack.h>
22#include <rtems/score/interr.h>
23#include <rtems/score/wkspace.h>
24#include <rtems/config.h>
25
26/*  _ISR_Handler_initialization
27 *
28 *  This routine initializes the ISR handler.
29 *
30 *  Input parameters: NONE
31 *
32 *  Output parameters: NONE
33 */
34
35void _ISR_Handler_initialization( void )
36{
37  _ISR_Nest_level = 0;
38
39#if (CPU_SIMPLE_VECTORED_INTERRUPTS == TRUE)
40  _ISR_Vector_table = _Workspace_Allocate_or_fatal_error(
41     sizeof(ISR_Handler_entry) * ISR_NUMBER_OF_VECTORS
42  );
43#endif
44
45  _CPU_Initialize_vectors();
46
47#if ( CPU_ALLOCATE_INTERRUPT_STACK == TRUE )
48
49  if ( !_Stack_Is_enough(Configuration.interrupt_stack_size) )
50    _Internal_error_Occurred(
51      INTERNAL_ERROR_CORE,
52      true,
53      INTERNAL_ERROR_INTERRUPT_STACK_TOO_SMALL
54    );
55
56  _CPU_Interrupt_stack_low = _Workspace_Allocate_or_fatal_error(
57    Configuration.interrupt_stack_size
58  );
59
60  _CPU_Interrupt_stack_high = _Addresses_Add_offset(
61    _CPU_Interrupt_stack_low,
62    Configuration.interrupt_stack_size
63  );
64
65  _CPU_Interrupt_stack_high = (void *)
66    ((uintptr_t) _CPU_Interrupt_stack_high & ~(CPU_STACK_ALIGNMENT - 1));
67
68  /* Interrupt stack might have to be aligned and/or setup
69   * in a specific way.
70   */
71#if defined(_CPU_Interrupt_stack_setup)
72  _CPU_Interrupt_stack_setup(_CPU_Interrupt_stack_low, _CPU_Interrupt_stack_high);
73#endif
74
75#endif
76
77#if ( CPU_HAS_HARDWARE_INTERRUPT_STACK == TRUE )
78  _CPU_Install_interrupt_stack();
79#endif
80
81}
Note: See TracBrowser for help on using the repository browser.