[rtems commit] config: Adjust stack allocator initialization

Sebastian Huber sebh at rtems.org
Wed Feb 24 13:51:33 UTC 2021


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

Author:    Sebastian Huber <sebastian.huber at embedded-brains.de>
Date:      Wed Feb 24 13:12:27 2021 +0100

config: Adjust stack allocator initialization

Use the right system initialization step for the stack allocator
initialization.  Do the stack allocator initialization before the
workspace initialization so that _Memory_Allocate() can be used to get
memory for the allocator.

---

 cpukit/include/rtems/confdefs/wkspace.h |  2 +-
 cpukit/include/rtems/sysinit.h          |  2 +-
 cpukit/sapi/src/sysinitverbose.c        | 11 ++++++++++-
 3 files changed, 12 insertions(+), 3 deletions(-)

diff --git a/cpukit/include/rtems/confdefs/wkspace.h b/cpukit/include/rtems/confdefs/wkspace.h
index b37af79..46bdee6 100644
--- a/cpukit/include/rtems/confdefs/wkspace.h
+++ b/cpukit/include/rtems/confdefs/wkspace.h
@@ -167,7 +167,7 @@ const uintptr_t _Stack_Space_size = _CONFIGURE_STACK_SPACE_SIZE;
 
     RTEMS_SYSINIT_ITEM(
       _Stack_Allocator_do_initialize,
-      RTEMS_SYSINIT_DIRTY_MEMORY,
+      RTEMS_SYSINIT_STACK_ALLOCATOR,
       RTEMS_SYSINIT_ORDER_MIDDLE
     );
   #endif
diff --git a/cpukit/include/rtems/sysinit.h b/cpukit/include/rtems/sysinit.h
index a28e448..cb17a0f 100644
--- a/cpukit/include/rtems/sysinit.h
+++ b/cpukit/include/rtems/sysinit.h
@@ -34,6 +34,7 @@ extern "C" {
 #define RTEMS_SYSINIT_ISR_STACK                  000200
 #define RTEMS_SYSINIT_PER_CPU_DATA               000220
 #define RTEMS_SYSINIT_SBRK                       000240
+#define RTEMS_SYSINIT_STACK_ALLOCATOR            000250
 #define RTEMS_SYSINIT_WORKSPACE                  000260
 #define RTEMS_SYSINIT_MALLOC                     000280
 #define RTEMS_SYSINIT_BSP_START                  000300
@@ -41,7 +42,6 @@ extern "C" {
 #define RTEMS_SYSINIT_INITIAL_EXTENSIONS         000500
 #define RTEMS_SYSINIT_MP_EARLY                   000600
 #define RTEMS_SYSINIT_DATA_STRUCTURES            000700
-#define RTEMS_SYSINIT_STACK_ALLOCATOR            000780
 #define RTEMS_SYSINIT_MP                         000800
 #define RTEMS_SYSINIT_USER_EXTENSIONS            000900
 #define RTEMS_SYSINIT_CLASSIC_TASKS              000a00
diff --git a/cpukit/sapi/src/sysinitverbose.c b/cpukit/sapi/src/sysinitverbose.c
index 157889c..d05f1de 100644
--- a/cpukit/sapi/src/sysinitverbose.c
+++ b/cpukit/sapi/src/sysinitverbose.c
@@ -61,6 +61,7 @@ SYSINIT_VERBOSE( ZERO_MEMORY );
 SYSINIT_VERBOSE( ISR_STACK );
 SYSINIT_VERBOSE( PER_CPU_DATA );
 SYSINIT_VERBOSE( SBRK );
+SYSINIT_VERBOSE( STACK_ALLOCATOR );
 SYSINIT_VERBOSE( WORKSPACE );
 SYSINIT_VERBOSE( MALLOC );
 SYSINIT_VERBOSE( BSP_START );
@@ -233,9 +234,17 @@ static void _Sysinit_Verbose_SBRK( void )
   }
 }
 
+static void _Sysinit_Verbose_STACK_ALLOCATOR( void )
+{
+  if ( !SYSINIT_IS_ADJACENT( SBRK, STACK_ALLOCATOR ) ) {
+    _Sysinit_Print_free_memory();
+    printk( "sysinit: STACK_ALLOCATOR: done\n" );
+  }
+}
+
 static void _Sysinit_Verbose_WORKSPACE( void )
 {
-  if ( !SYSINIT_IS_ADJACENT( SBRK, WORKSPACE ) ) {
+  if ( !SYSINIT_IS_ADJACENT( STACK_ALLOCATOR, WORKSPACE ) ) {
     _Sysinit_Print_free_memory();
     printk( "sysinit: WORKSPACE: done\n" );
   }



More information about the vc mailing list