This is an automated email from the ASF dual-hosted git repository. aguettouche pushed a commit to branch errno in repository https://gitbox.apache.org/repos/asf/incubator-nuttx.git
commit 4fc126f290b89495998485607078ee84c57b14af Author: Ouss4 <abdelatif.guettou...@gmail.com> AuthorDate: Thu May 7 18:50:07 2020 +0100 arch/*/*_checkstack.c: Get aligned address only when CONFIG_TLS_ALIGNED is enabled. --- arch/arm/src/common/arm_checkstack.c | 1 + arch/or1k/src/common/up_checkstack.c | 5 +++++ arch/risc-v/src/common/riscv_checkstack.c | 5 +++++ arch/xtensa/src/common/xtensa_checkstack.c | 6 ++++++ 4 files changed, 17 insertions(+) diff --git a/arch/arm/src/common/arm_checkstack.c b/arch/arm/src/common/arm_checkstack.c index 5ac36fd..ebdab95 100644 --- a/arch/arm/src/common/arm_checkstack.c +++ b/arch/arm/src/common/arm_checkstack.c @@ -108,6 +108,7 @@ static size_t do_stackcheck(uintptr_t alloc, size_t size, bool int_stack) UNUSED(int_stack); start = alloc & ~3; #endif + end = (alloc + size + 3) & ~3; /* Get the adjusted size based on the top and bottom of the stack */ diff --git a/arch/or1k/src/common/up_checkstack.c b/arch/or1k/src/common/up_checkstack.c index 964e600..e6f4cd9 100644 --- a/arch/or1k/src/common/up_checkstack.c +++ b/arch/or1k/src/common/up_checkstack.c @@ -97,6 +97,7 @@ static size_t do_stackcheck(uintptr_t alloc, size_t size, bool int_stack) /* Get aligned addresses of the top and bottom of the stack */ +#ifdef CONFIG_TLS_ALIGNED if (!int_stack) { /* Skip over the TLS data structure at the bottom of the stack */ @@ -108,6 +109,10 @@ static size_t do_stackcheck(uintptr_t alloc, size_t size, bool int_stack) { start = alloc & ~3; } +#else + UNUSED(int_stack); + start = alloc & ~3; +#endif end = (alloc + size + 3) & ~3; diff --git a/arch/risc-v/src/common/riscv_checkstack.c b/arch/risc-v/src/common/riscv_checkstack.c index c42707a..a8f28fa 100644 --- a/arch/risc-v/src/common/riscv_checkstack.c +++ b/arch/risc-v/src/common/riscv_checkstack.c @@ -91,6 +91,7 @@ static size_t do_stackcheck(uintptr_t alloc, size_t size, bool int_stack) /* Get aligned addresses of the top and bottom of the stack */ +#ifdef CONFIG_TLS_ALIGNED if (!int_stack) { /* Skip over the TLS data structure at the bottom of the stack */ @@ -102,6 +103,10 @@ static size_t do_stackcheck(uintptr_t alloc, size_t size, bool int_stack) { start = alloc & ~3; } +#else + UNUSED(int_stack); + start = alloc & ~3; +#endif end = (alloc + size + 3) & ~3; diff --git a/arch/xtensa/src/common/xtensa_checkstack.c b/arch/xtensa/src/common/xtensa_checkstack.c index d9509c9..cbac16a 100644 --- a/arch/xtensa/src/common/xtensa_checkstack.c +++ b/arch/xtensa/src/common/xtensa_checkstack.c @@ -91,10 +91,16 @@ static size_t do_stackcheck(uintptr_t alloc, size_t size) /* Get aligned addresses of the top and bottom of the stack */ +#ifdef CONFIG_TLS_ALIGNED + /* Skip over the TLS data structure at the bottom of the stack */ DEBUGASSERT((alloc & TLS_STACK_MASK) == 0); start = alloc + sizeof(struct tls_info_s); +#else + start = alloc & ~3; +#endif + end = (alloc + size + 3) & ~3; /* Get the adjusted size based on the top and bottom of the stack */