arch/*/*_checkstack.c: Get aligned address only when CONFIG_TLS_ALIGNED is

enabled.
This commit is contained in:
Ouss4 2020-05-07 18:50:07 +01:00 committed by Gregory Nutt
parent e74899ff6d
commit a6da3c2cb6
4 changed files with 17 additions and 0 deletions

View File

@ -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 */

View File

@ -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;

View File

@ -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;

View File

@ -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 */