From 8ecbc3826edfbfebabf5b9b75243df8b04421073 Mon Sep 17 00:00:00 2001 From: Sebastian Huber Date: Tue, 4 Feb 2020 13:56:41 +0100 Subject: sysinit: Add RTEMS_SYSINIT_ZERO_MEMORY Use a dedicate system initialization step to zero the memory used for the workspace and C program heap. This avoids dead code in case CONFIGURE_ZERO_WORKSPACE_AUTOMATICALLY is not configured. --- cpukit/include/rtems/confdefs.h | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) (limited to 'cpukit/include/rtems/confdefs.h') diff --git a/cpukit/include/rtems/confdefs.h b/cpukit/include/rtems/confdefs.h index 7d0d3fbeab..982e3ddb56 100644 --- a/cpukit/include/rtems/confdefs.h +++ b/cpukit/include/rtems/confdefs.h @@ -2778,11 +2778,6 @@ struct _reent *__getreent(void) CONFIGURE_TASK_STACK_ALLOCATOR_INIT, /* stack allocator init */ CONFIGURE_TASK_STACK_ALLOCATOR, /* stack allocator */ CONFIGURE_TASK_STACK_DEALLOCATOR, /* stack deallocator */ - #ifdef CONFIGURE_ZERO_WORKSPACE_AUTOMATICALLY /* true to clear memory */ - true, - #else - false, - #endif #ifdef CONFIGURE_UNIFIED_WORK_AREAS /* true for unified work areas */ true, #else @@ -2807,6 +2802,16 @@ struct _reent *__getreent(void) #endif }; + #ifdef CONFIGURE_ZERO_WORKSPACE_AUTOMATICALLY + const bool _Memory_Zero_before_use = true; + + RTEMS_SYSINIT_ITEM( + _Memory_Zero_free_areas, + RTEMS_SYSINIT_ZERO_MEMORY, + RTEMS_SYSINIT_ORDER_MIDDLE + ); + #endif + #if CONFIGURE_RECORD_PER_PROCESSOR_ITEMS > 0 #if (CONFIGURE_RECORD_PER_PROCESSOR_ITEMS & (CONFIGURE_RECORD_PER_PROCESSOR_ITEMS - 1)) != 0 #error "CONFIGURE_RECORD_PER_PROCESSOR_ITEMS must be a power of two" -- cgit v1.2.3