wangchdo commented on code in PR #17029: URL: https://github.com/apache/nuttx/pull/17029#discussion_r2355394740
########## arch/tricore/src/common/tricore_usestack.c: ########## @@ -93,26 +93,11 @@ int up_use_stack(struct tcb_s *tcb, void *stack, size_t stack_size) /* Save the new stack allocation */ tcb->stack_alloc_ptr = stack; + tcb->stack_base_ptr = (void *)STACK_ALIGN_UP((uintptr_t)stack); - /* RISC-V uses a push-down stack: the stack grows toward lower addresses in - * memory. The stack pointer register, points to the lowest, valid work - * address (the "top" of the stack). Items on the stack are referenced - * as positive word offsets from SP. - */ - - top_of_stack = (uintptr_t)tcb->stack_alloc_ptr + stack_size; - - /* The RISC-V stack must be aligned at 128-bit (16-byte) boundaries. - * If necessary top_of_stack must be rounded down to the next boundary. - */ - - top_of_stack = STACK_ALIGN_DOWN(top_of_stack); - size_of_stack = top_of_stack - (uintptr_t)tcb->stack_alloc_ptr; - - /* Save the adjusted stack values in the struct tcb_s */ - - tcb->stack_base_ptr = tcb->stack_alloc_ptr; - tcb->adj_stack_size = size_of_stack; + top_of_stack = STACK_ALIGN_DOWN((uintptr_t)stack + stack_size); Review Comment: I think this is a normal case... all the arch have this issue -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: commits-unsubscr...@nuttx.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org