[PATCH] score: Statically initialize _ISR_Vector_table
Sebastian Huber
sebastian.huber at embedded-brains.de
Mon Apr 28 07:29:12 UTC 2014
---
c/src/lib/libbsp/mips/malta/irq/maxvectors.c | 3 +-
c/src/lib/libbsp/mips/shared/irq/maxvectors.c | 2 +-
cpukit/sapi/include/confdefs.h | 28 ---------------------
cpukit/score/cpu/mips/rtems/score/cpu.h | 8 +++--
cpukit/score/cpu/nios2/Makefile.am | 1 -
cpukit/score/cpu/nios2/nios2-initialize-vectors.c | 25 ------------------
cpukit/score/cpu/nios2/rtems/score/cpu.h | 2 +-
cpukit/score/cpu/no_cpu/rtems/score/cpu.h | 17 ++++++++----
cpukit/score/include/rtems/score/isr.h | 14 +---------
cpukit/score/src/isr.c | 12 ++++++---
testsuites/sptests/spfatal07/testcase.h | 4 ---
testsuites/sptests/spintr_err01/init.c | 2 +-
12 files changed, 29 insertions(+), 89 deletions(-)
delete mode 100644 cpukit/score/cpu/nios2/nios2-initialize-vectors.c
diff --git a/c/src/lib/libbsp/mips/malta/irq/maxvectors.c b/c/src/lib/libbsp/mips/malta/irq/maxvectors.c
index c17583e..f2aee55 100644
--- a/c/src/lib/libbsp/mips/malta/irq/maxvectors.c
+++ b/c/src/lib/libbsp/mips/malta/irq/maxvectors.c
@@ -20,5 +20,4 @@
#include <rtems.h>
-unsigned int mips_interrupt_number_of_vectors = 13;
-
+uint32_t _MIPS_Interrupt_maximum_vector_number = 12;
diff --git a/c/src/lib/libbsp/mips/shared/irq/maxvectors.c b/c/src/lib/libbsp/mips/shared/irq/maxvectors.c
index 273253b..80f7f02 100644
--- a/c/src/lib/libbsp/mips/shared/irq/maxvectors.c
+++ b/c/src/lib/libbsp/mips/shared/irq/maxvectors.c
@@ -17,4 +17,4 @@
#include <rtems.h>
#include <bsp/irq.h>
-unsigned int mips_interrupt_number_of_vectors = BSP_INTERRUPT_VECTOR_MAX;
+uint32_t _MIPS_Interrupt_maximum_vector_number = BSP_INTERRUPT_VECTOR_MAX;
diff --git a/cpukit/sapi/include/confdefs.h b/cpukit/sapi/include/confdefs.h
index 69c74f7..0dc9137 100644
--- a/cpukit/sapi/include/confdefs.h
+++ b/cpukit/sapi/include/confdefs.h
@@ -2245,31 +2245,6 @@ const rtems_libio_helper rtems_fs_init_helper =
#endif
/**
- * On architectures that use Simple Vectored Interrupts, it is RTEMS
- * responsibility to allocate the vector table. This avoids reserving
- * the memory on architectures that use the Programmable Interrupt
- * Controller Vectored Interrupts.
- */
-#if (CPU_SIMPLE_VECTORED_INTERRUPTS == TRUE)
- /*
- * This is a (hopefully) temporary hack. On the mips, the number of
- * vectors is NOT statically defined. But it has to be statically
- * defined for this to work. This is an issue looking for a nice
- * solution.
- */
- #if defined(__mips__)
- #define CONFIGURE_INTERRUPT_VECTOR_TABLE \
- _Configure_From_workspace( (sizeof(ISR_Handler_entry) * 256))
- #else
- #define CONFIGURE_INTERRUPT_VECTOR_TABLE \
- _Configure_From_workspace( \
- (sizeof(ISR_Handler_entry) * ISR_NUMBER_OF_VECTORS))
- #endif
-#else
- #define CONFIGURE_INTERRUPT_VECTOR_TABLE 0
-#endif
-
-/**
* RTEMS uses two instance of an internal mutex class. This accounts
* for these mutexes.
*/
@@ -2298,7 +2273,6 @@ const rtems_libio_helper rtems_fs_init_helper =
*/
#define CONFIGURE_MEMORY_FOR_SYSTEM_OVERHEAD \
( CONFIGURE_MEMORY_FOR_IDLE_TASK + /* IDLE and stack */ \
- CONFIGURE_INTERRUPT_VECTOR_TABLE + /* interrupt vectors */ \
CONFIGURE_INTERRUPT_STACK_MEMORY + /* interrupt stack */ \
CONFIGURE_API_MUTEX_MEMORY /* allocation mutex */ \
)
@@ -2716,7 +2690,6 @@ const rtems_libio_helper rtems_fs_init_helper =
uint32_t POSIX;
/* System overhead pieces */
- uint32_t INTERRUPT_VECTOR_TABLE;
uint32_t INTERRUPT_STACK_MEMORY;
uint32_t MEMORY_FOR_IDLE_TASK;
@@ -2771,7 +2744,6 @@ const rtems_libio_helper rtems_fs_init_helper =
CONFIGURE_MEMORY_FOR_POSIX,
/* System overhead pieces */
- CONFIGURE_INTERRUPT_VECTOR_TABLE,
CONFIGURE_INTERRUPT_STACK_MEMORY,
CONFIGURE_MEMORY_FOR_IDLE_TASK,
diff --git a/cpukit/score/cpu/mips/rtems/score/cpu.h b/cpukit/score/cpu/mips/rtems/score/cpu.h
index b871969..42c5508 100644
--- a/cpukit/score/cpu/mips/rtems/score/cpu.h
+++ b/cpukit/score/cpu/mips/rtems/score/cpu.h
@@ -664,9 +664,11 @@ SCORE_EXTERN Context_Control_fp _CPU_Null_fp_context;
* by RTEMS.
*/
-extern unsigned int mips_interrupt_number_of_vectors;
-#define CPU_INTERRUPT_NUMBER_OF_VECTORS (mips_interrupt_number_of_vectors)
-#define CPU_INTERRUPT_MAXIMUM_VECTOR_NUMBER (CPU_INTERRUPT_NUMBER_OF_VECTORS - 1)
+#define CPU_INTERRUPT_NUMBER_OF_VECTORS 256
+
+extern uint32_t _MIPS_Interrupt_maximum_vector_number;
+
+#define CPU_INTERRUPT_MAXIMUM_VECTOR_NUMBER _MIPS_Interrupt_maximum_vector_number
/*
* Should be large enough to run all RTEMS tests. This ensures
diff --git a/cpukit/score/cpu/nios2/Makefile.am b/cpukit/score/cpu/nios2/Makefile.am
index 62286cd..6004467 100644
--- a/cpukit/score/cpu/nios2/Makefile.am
+++ b/cpukit/score/cpu/nios2/Makefile.am
@@ -33,7 +33,6 @@ libscorecpu_a_SOURCES += nios2-fatal-halt.c
libscorecpu_a_SOURCES += nios2-iic-low-level.S
libscorecpu_a_SOURCES += nios2-iic-irq.c
libscorecpu_a_SOURCES += nios2-initialize.c
-libscorecpu_a_SOURCES += nios2-initialize-vectors.c
libscorecpu_a_SOURCES += nios2-isr-get-level.c
libscorecpu_a_SOURCES += nios2-isr-install-raw-handler.c
libscorecpu_a_SOURCES += nios2-isr-install-vector.c
diff --git a/cpukit/score/cpu/nios2/nios2-initialize-vectors.c b/cpukit/score/cpu/nios2/nios2-initialize-vectors.c
deleted file mode 100644
index da1ee4b..0000000
--- a/cpukit/score/cpu/nios2/nios2-initialize-vectors.c
+++ /dev/null
@@ -1,25 +0,0 @@
-/*
- * Copyright (c) 2011 embedded brains GmbH
- *
- * Copyright (c) 2006 Kolja Waschk (rtemsdev/ixo.de)
- *
- * COPYRIGHT (c) 1989-2006
- * On-Line Applications Research Corporation (OAR).
- *
- * The license and distribution terms for this file may be
- * found in the file LICENSE in this distribution or at
- * http://www.rtems.org/license/LICENSE.
- */
-
-#ifdef HAVE_CONFIG_H
- #include "config.h"
-#endif
-
-#include <rtems/score/isr.h>
-
-#include <string.h>
-
-void _CPU_Initialize_vectors( void )
-{
- memset(_ISR_Vector_table, 0, sizeof(ISR_Handler_entry) * ISR_NUMBER_OF_VECTORS);
-}
diff --git a/cpukit/score/cpu/nios2/rtems/score/cpu.h b/cpukit/score/cpu/nios2/rtems/score/cpu.h
index 6c62a1f..fcfef8d 100644
--- a/cpukit/score/cpu/nios2/rtems/score/cpu.h
+++ b/cpukit/score/cpu/nios2/rtems/score/cpu.h
@@ -192,7 +192,7 @@ typedef struct {
uint32_t ipending;
} CPU_Exception_frame;
-void _CPU_Initialize_vectors( void );
+#define _CPU_Initialize_vectors()
/**
* @brief Macro to disable interrupts.
diff --git a/cpukit/score/cpu/no_cpu/rtems/score/cpu.h b/cpukit/score/cpu/no_cpu/rtems/score/cpu.h
index 959fb58..fbf207a 100644
--- a/cpukit/score/cpu/no_cpu/rtems/score/cpu.h
+++ b/cpukit/score/cpu/no_cpu/rtems/score/cpu.h
@@ -686,19 +686,24 @@ SCORE_EXTERN Context_Control_fp _CPU_Null_fp_context;
/**
* @ingroup CPUInterrupt
*
- * This defines the number of entries in the @ref _ISR_Vector_table managed
- * by RTEMS.
+ * This defines the number of entries in the _ISR_Vector_table managed by RTEMS
+ * in case CPU_SIMPLE_VECTORED_INTERRUPTS is defined to TRUE. It must be a
+ * compile-time constant.
*
- * Port Specific Information:
- *
- * XXX document implementation including references if appropriate
+ * It must be undefined in case CPU_SIMPLE_VECTORED_INTERRUPTS is defined to
+ * FALSE.
*/
#define CPU_INTERRUPT_NUMBER_OF_VECTORS 32
/**
* @ingroup CPUInterrupt
*
- * This defines the highest interrupt vector number for this port.
+ * This defines the highest interrupt vector number for this port in case
+ * CPU_SIMPLE_VECTORED_INTERRUPTS is defined to TRUE. It must be less than
+ * CPU_INTERRUPT_NUMBER_OF_VECTORS. It may be not a compile-time constant.
+ *
+ * It must be undefined in case CPU_SIMPLE_VECTORED_INTERRUPTS is defined to
+ * FALSE.
*/
#define CPU_INTERRUPT_MAXIMUM_VECTOR_NUMBER (CPU_INTERRUPT_NUMBER_OF_VECTORS - 1)
diff --git a/cpukit/score/include/rtems/score/isr.h b/cpukit/score/include/rtems/score/isr.h
index f1ac5ae..dcb25e1 100644
--- a/cpukit/score/include/rtems/score/isr.h
+++ b/cpukit/score/include/rtems/score/isr.h
@@ -71,22 +71,10 @@ typedef ISR_Handler ( *ISR_Handler_entry )(
#endif
/**
- * This constant promotes out the number of vectors truly supported by
- * the current CPU being used. This is usually the number of distinct vectors
- * the cpu can vector.
- */
-#define ISR_NUMBER_OF_VECTORS CPU_INTERRUPT_NUMBER_OF_VECTORS
-
-/**
- * This constant promotes out the highest valid interrupt vector number.
- */
-#define ISR_INTERRUPT_MAXIMUM_VECTOR_NUMBER CPU_INTERRUPT_MAXIMUM_VECTOR_NUMBER
-
-/**
* The following declares the Vector Table. Application
* interrupt service routines are vectored by the ISR Handler via this table.
*/
-SCORE_EXTERN ISR_Handler_entry *_ISR_Vector_table;
+extern ISR_Handler_entry _ISR_Vector_table[ CPU_INTERRUPT_NUMBER_OF_VECTORS ];
#endif
/**
diff --git a/cpukit/score/src/isr.c b/cpukit/score/src/isr.c
index 07f3e61..1ae6e59 100644
--- a/cpukit/score/src/isr.c
+++ b/cpukit/score/src/isr.c
@@ -26,15 +26,19 @@
#include <rtems/score/wkspace.h>
#include <rtems/config.h>
+#if (CPU_SIMPLE_VECTORED_INTERRUPTS == TRUE)
+ ISR_Handler_entry _ISR_Vector_table[ CPU_INTERRUPT_NUMBER_OF_VECTORS ];
+#elif defined(CPU_INTERRUPT_NUMBER_OF_VECTORS)
+ #error "CPU_INTERRUPT_NUMBER_OF_VECTORS is defined for non-simple vectored interrupts"
+#elif defined(CPU_INTERRUPT_MAXIMUM_VECTOR_NUMBER)
+ #error "CPU_INTERRUPT_MAXIMUM_VECTOR_NUMBER is defined for non-simple vectored interrupts"
+#endif
+
void _ISR_Handler_initialization( void )
{
_ISR_Nest_level = 0;
#if (CPU_SIMPLE_VECTORED_INTERRUPTS == TRUE)
- _ISR_Vector_table = _Workspace_Allocate_or_fatal_error(
- sizeof(ISR_Handler_entry) * ISR_NUMBER_OF_VECTORS
- );
-
_CPU_Initialize_vectors();
#endif
diff --git a/testsuites/sptests/spfatal07/testcase.h b/testsuites/sptests/spfatal07/testcase.h
index 25fc8f2..e18563c 100644
--- a/testsuites/sptests/spfatal07/testcase.h
+++ b/testsuites/sptests/spfatal07/testcase.h
@@ -37,10 +37,6 @@ rtems_initialization_tasks_table Initialization_tasks[] = {
#define FATAL_ERROR_EXPECTED_ERROR \
INTERNAL_ERROR_INTERRUPT_STACK_TOO_SMALL
-#if CPU_SIMPLE_VECTORED_INTERRUPTS == TRUE
- #define CONFIGURE_MEMORY_OVERHEAD (sizeof(ISR_Handler_entry) * ISR_NUMBER_OF_VECTORS)
-#endif
-
#if CPU_ALLOCATE_INTERRUPT_STACK == TRUE
#define CONFIGURE_INTERRUPT_STACK_SIZE (STACK_MINIMUM_SIZE - 1)
#endif
diff --git a/testsuites/sptests/spintr_err01/init.c b/testsuites/sptests/spintr_err01/init.c
index c2c39ae..84ebfdb 100644
--- a/testsuites/sptests/spintr_err01/init.c
+++ b/testsuites/sptests/spintr_err01/init.c
@@ -36,7 +36,7 @@ rtems_task Init(
rtems_isr_entry old_service_routine;
status = rtems_interrupt_catch(
Service_routine,
- ISR_INTERRUPT_MAXIMUM_VECTOR_NUMBER + 10,
+ CPU_INTERRUPT_MAXIMUM_VECTOR_NUMBER + 1,
&old_service_routine
);
fatal_directive_status(
--
1.7.7
More information about the devel
mailing list