[rtems commit] rtems: rtems_configuration_get_interrupt_stack_size()

Sebastian Huber sebh at rtems.org
Mon Sep 18 05:24:04 UTC 2023


Module:    rtems
Branch:    master
Commit:    2111497c0f9ad5dda154ef533ab2c842435a8e09
Changeset: http://git.rtems.org/rtems/commit/?id=2111497c0f9ad5dda154ef533ab2c842435a8e09

Author:    Sebastian Huber <sebastian.huber at embedded-brains.de>
Date:      Thu Sep 14 09:09:53 2023 +0200

rtems: rtems_configuration_get_interrupt_stack_size()

Fix rtems_configuration_get_interrupt_stack_size() for some code models.

The _ISR_Stack_size symbol has an arbitrary absolute address and may not
be representable in the code model used by the compiler.

Update #4953.

---

 cpukit/include/rtems/config.h    |  2 +-
 cpukit/include/rtems/score/isr.h | 14 +++++++++++++-
 cpukit/score/src/isr.c           |  2 ++
 3 files changed, 16 insertions(+), 2 deletions(-)

diff --git a/cpukit/include/rtems/config.h b/cpukit/include/rtems/config.h
index 40d703d61a..a19d809cf9 100644
--- a/cpukit/include/rtems/config.h
+++ b/cpukit/include/rtems/config.h
@@ -438,7 +438,7 @@ const char *rtems_get_version_string( void );
  * @endparblock
  */
 #define rtems_configuration_get_interrupt_stack_size() \
-  ((size_t) _ISR_Stack_size)
+  ((size_t) _ISR_Stack_size_object)
 
 /* Generated from spec:/rtems/config/if/get-maximum-extensions */
 
diff --git a/cpukit/include/rtems/score/isr.h b/cpukit/include/rtems/score/isr.h
index bb1f3cee50..96ad816245 100644
--- a/cpukit/include/rtems/score/isr.h
+++ b/cpukit/include/rtems/score/isr.h
@@ -98,13 +98,25 @@ extern ISR_Handler_entry _ISR_Vector_table[ CPU_INTERRUPT_NUMBER_OF_VECTORS ];
 #endif
 
 /**
- * @brief Global symbol with a value equal to the configure interrupt stack size.
+ * @brief Provides the configured interrupt stack size through an address.
+ *
+ * The address of this global symbol is equal to the configured interrupt stack
+ * size.  The address of this symbol has an arbitrary value an may not be
+ * representable in the code model used by the compiler.
  *
  * This global symbol is defined by the application configuration option
  * CONFIGURE_INIT_TASK_STACK_SIZE via <rtems/confdefs.h>.
  */
 RTEMS_DECLARE_GLOBAL_SYMBOL( _ISR_Stack_size );
 
+/**
+ * @brief Provides the configured interrupt stack size through an object.
+ *
+ * This object is provided to avoid issues with the _ISR_Stack_size symbol
+ * address and the code model used by the compiler.
+ */
+extern const char * const volatile _ISR_Stack_size_object;
+
 /**
  * @brief The interrupt stack area begin.
  *
diff --git a/cpukit/score/src/isr.c b/cpukit/score/src/isr.c
index 75df00e228..7337028b0f 100644
--- a/cpukit/score/src/isr.c
+++ b/cpukit/score/src/isr.c
@@ -44,6 +44,8 @@
 #include <rtems/score/percpu.h>
 #include <rtems/config.h>
 
+const char * const volatile _ISR_Stack_size_object = _ISR_Stack_size;
+
 void _ISR_Handler_initialization( void )
 {
   uint32_t  cpu_max;



More information about the vc mailing list