diff options
author | Sebastian Huber <sebastian.huber@embedded-brains.de> | 2021-03-27 11:15:43 +0100 |
---|---|---|
committer | Sebastian Huber <sebastian.huber@embedded-brains.de> | 2021-03-27 18:05:05 +0100 |
commit | e0aba8cb9edd3630be3b81e1f1c3e8bdaf728d1e (patch) | |
tree | f2d7d3f04eb1b6cadb8047323a6e319fd8a1a01c /cpukit/include/rtems/confdefs | |
parent | pwdgrp.c: Change to simply ignore return value from mkdir(/etc) (diff) | |
download | rtems-e0aba8cb9edd3630be3b81e1f1c3e8bdaf728d1e.tar.bz2 |
score: Fix task stack initialization
Do not adjust the stack area begin address since this may confuse the
stack allocator and result in failed stack frees.
Account for the alignment overhead in the stack space size estimate.
Check that the stack size is in the expected interval.
Diffstat (limited to 'cpukit/include/rtems/confdefs')
-rw-r--r-- | cpukit/include/rtems/confdefs/wkspace.h | 21 |
1 files changed, 18 insertions, 3 deletions
diff --git a/cpukit/include/rtems/confdefs/wkspace.h b/cpukit/include/rtems/confdefs/wkspace.h index 46bdee6da1..1db4f2d09d 100644 --- a/cpukit/include/rtems/confdefs/wkspace.h +++ b/cpukit/include/rtems/confdefs/wkspace.h @@ -10,7 +10,7 @@ */ /* - * Copyright (C) 2020 embedded brains GmbH (http://www.embedded-brains.de) + * Copyright (C) 2020, 2021 embedded brains GmbH (http://www.embedded-brains.de) * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -55,12 +55,27 @@ #include <rtems/score/stack.h> #include <rtems/sysinit.h> +#if CPU_STACK_ALIGNMENT > CPU_HEAP_ALIGNMENT + #define _CONFIGURE_TASK_STACK_ALLOC_SIZE( _stack_size ) \ + ( RTEMS_ALIGN_UP( \ + ( _stack_size ) + CONTEXT_FP_SIZE, \ + CPU_STACK_ALIGNMENT \ + ) + CPU_STACK_ALIGNMENT - CPU_HEAP_ALIGNMENT ) +#else + #define _CONFIGURE_TASK_STACK_ALLOC_SIZE( _stack_size ) \ + RTEMS_ALIGN_UP( ( _stack_size ) + CONTEXT_FP_SIZE, CPU_STACK_ALIGNMENT ) +#endif + #ifdef CONFIGURE_TASK_STACK_FROM_ALLOCATOR #define _Configure_From_stackspace( _stack_size ) \ - CONFIGURE_TASK_STACK_FROM_ALLOCATOR( _stack_size + CONTEXT_FP_SIZE ) + CONFIGURE_TASK_STACK_FROM_ALLOCATOR( \ + _CONFIGURE_TASK_STACK_ALLOC_SIZE( _stack_size ) \ + ) #else #define _Configure_From_stackspace( _stack_size ) \ - _Configure_From_workspace( _stack_size + CONTEXT_FP_SIZE ) + _Configure_From_workspace( \ + _CONFIGURE_TASK_STACK_ALLOC_SIZE( _stack_size ) \ + ) #endif #ifndef CONFIGURE_EXTRA_TASK_STACKS |