diff --git a/arch/arm/src/common/arm_checkstack.c b/arch/arm/src/common/arm_checkstack.c index 61faad4d1b..8f624a6b68 100644 --- a/arch/arm/src/common/arm_checkstack.c +++ b/arch/arm/src/common/arm_checkstack.c @@ -59,7 +59,7 @@ * Private Function Prototypes ****************************************************************************/ -static size_t do_stackcheck(uintptr_t alloc, size_t size, bool int_stack); +static size_t do_stackcheck(uintptr_t alloc, size_t size); /**************************************************************************** * Name: do_stackcheck @@ -78,7 +78,7 @@ static size_t do_stackcheck(uintptr_t alloc, size_t size, bool int_stack); * ****************************************************************************/ -static size_t do_stackcheck(uintptr_t alloc, size_t size, bool int_stack) +static size_t do_stackcheck(uintptr_t alloc, size_t size) { FAR uintptr_t start; FAR uintptr_t end; @@ -92,20 +92,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 */ - if (!int_stack) - { - /* Skip over the TLS data structure at the bottom of the stack */ - -#ifdef CONFIG_TLS_ALIGNED - DEBUGASSERT((alloc & TLS_STACK_MASK) == 0); -#endif - start = alloc + sizeof(struct tls_info_s); - } - else - { - start = alloc & ~3; - } - + start = alloc & ~3; end = (alloc + size + 3) & ~3; /* Get the adjusted size based on the top and bottom of the stack */ @@ -188,8 +175,8 @@ static size_t do_stackcheck(uintptr_t alloc, size_t size, bool int_stack) size_t up_check_tcbstack(FAR struct tcb_s *tcb) { - return do_stackcheck((uintptr_t)tcb->stack_alloc_ptr, tcb->adj_stack_size, - false); + return do_stackcheck((uintptr_t)tcb->adj_stack_ptr - tcb->adj_stack_size, + tcb->adj_stack_size); } ssize_t up_check_tcbstack_remain(FAR struct tcb_s *tcb) @@ -212,12 +199,10 @@ size_t up_check_intstack(void) { #ifdef CONFIG_SMP return do_stackcheck(arm_intstack_base(), - (CONFIG_ARCH_INTERRUPTSTACK & ~3), - true); + (CONFIG_ARCH_INTERRUPTSTACK & ~3)); #else return do_stackcheck((uintptr_t)&g_intstackalloc, - (CONFIG_ARCH_INTERRUPTSTACK & ~3), - true); + (CONFIG_ARCH_INTERRUPTSTACK & ~3)); #endif } diff --git a/arch/arm/src/common/arm_createstack.c b/arch/arm/src/common/arm_createstack.c index 51cc7bde35..d4b699ba23 100644 --- a/arch/arm/src/common/arm_createstack.c +++ b/arch/arm/src/common/arm_createstack.c @@ -218,7 +218,6 @@ int up_create_stack(FAR struct tcb_s *tcb, size_t stack_size, uint8_t ttype) arm_stack_color((FAR void *)((uintptr_t)tcb->adj_stack_ptr - tcb->adj_stack_size), tcb->adj_stack_size); - #endif /* CONFIG_STACK_COLORATION */ board_autoled_on(LED_STACKCREATED); diff --git a/arch/arm/src/common/arm_usestack.c b/arch/arm/src/common/arm_usestack.c index 9975578268..3197eb8099 100644 --- a/arch/arm/src/common/arm_usestack.c +++ b/arch/arm/src/common/arm_usestack.c @@ -137,7 +137,7 @@ int up_use_stack(struct tcb_s *tcb, void *stack, size_t stack_size) memset(tcb->stack_alloc_ptr, 0, sizeof(struct tls_info_s)); - #ifdef CONFIG_STACK_COLORATION +#ifdef CONFIG_STACK_COLORATION /* If stack debug is enabled, then fill the stack with a * recognizable value that we can use later to test for high * water marks. @@ -145,8 +145,7 @@ int up_use_stack(struct tcb_s *tcb, void *stack, size_t stack_size) arm_stack_color((FAR void *)((uintptr_t)tcb->adj_stack_ptr - tcb->adj_stack_size), tcb->adj_stack_size); - - #endif /* CONFIG_STACK_COLORATION */ +#endif /* CONFIG_STACK_COLORATION */ return OK; }