mirror of
https://github.com/apache/nuttx.git
synced 2026-05-27 03:05:40 +08:00
arch/*/*_checkstack.c: Get aligned address only when CONFIG_TLS_ALIGNED is
enabled.
This commit is contained in:
@@ -108,6 +108,7 @@ static size_t do_stackcheck(uintptr_t alloc, size_t size, bool int_stack)
|
|||||||
UNUSED(int_stack);
|
UNUSED(int_stack);
|
||||||
start = alloc & ~3;
|
start = alloc & ~3;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
end = (alloc + size + 3) & ~3;
|
end = (alloc + size + 3) & ~3;
|
||||||
|
|
||||||
/* Get the adjusted size based on the top and bottom of the stack */
|
/* Get the adjusted size based on the top and bottom of the stack */
|
||||||
|
|||||||
@@ -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 */
|
/* Get aligned addresses of the top and bottom of the stack */
|
||||||
|
|
||||||
|
#ifdef CONFIG_TLS_ALIGNED
|
||||||
if (!int_stack)
|
if (!int_stack)
|
||||||
{
|
{
|
||||||
/* Skip over the TLS data structure at the bottom of the 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;
|
start = alloc & ~3;
|
||||||
}
|
}
|
||||||
|
#else
|
||||||
|
UNUSED(int_stack);
|
||||||
|
start = alloc & ~3;
|
||||||
|
#endif
|
||||||
|
|
||||||
end = (alloc + size + 3) & ~3;
|
end = (alloc + size + 3) & ~3;
|
||||||
|
|
||||||
|
|||||||
@@ -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 */
|
/* Get aligned addresses of the top and bottom of the stack */
|
||||||
|
|
||||||
|
#ifdef CONFIG_TLS_ALIGNED
|
||||||
if (!int_stack)
|
if (!int_stack)
|
||||||
{
|
{
|
||||||
/* Skip over the TLS data structure at the bottom of the 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;
|
start = alloc & ~3;
|
||||||
}
|
}
|
||||||
|
#else
|
||||||
|
UNUSED(int_stack);
|
||||||
|
start = alloc & ~3;
|
||||||
|
#endif
|
||||||
|
|
||||||
end = (alloc + size + 3) & ~3;
|
end = (alloc + size + 3) & ~3;
|
||||||
|
|
||||||
|
|||||||
@@ -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 */
|
/* 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 */
|
/* Skip over the TLS data structure at the bottom of the stack */
|
||||||
|
|
||||||
DEBUGASSERT((alloc & TLS_STACK_MASK) == 0);
|
DEBUGASSERT((alloc & TLS_STACK_MASK) == 0);
|
||||||
start = alloc + sizeof(struct tls_info_s);
|
start = alloc + sizeof(struct tls_info_s);
|
||||||
|
#else
|
||||||
|
start = alloc & ~3;
|
||||||
|
#endif
|
||||||
|
|
||||||
end = (alloc + size + 3) & ~3;
|
end = (alloc + size + 3) & ~3;
|
||||||
|
|
||||||
/* Get the adjusted size based on the top and bottom of the stack */
|
/* Get the adjusted size based on the top and bottom of the stack */
|
||||||
|
|||||||
Reference in New Issue
Block a user