mirror of
https://github.com/apache/nuttx.git
synced 2026-05-26 02:36:11 +08:00
arch: rename STACK_ALIGNMENT to STACKFRAME_ALIGN across all architectures
Rename STACK_ALIGNMENT macro to STACKFRAME_ALIGN throughout the codebase to provide clearer naming semantics. The new name better reflects the macro's purpose of frame alignment rather than general stack alignment. Signed-off-by: hujun5 <hujun5@xiaomi.com>
This commit is contained in:
@@ -98,7 +98,7 @@
|
||||
* addresses.
|
||||
*/
|
||||
|
||||
#define STACK_ALIGNMENT 8
|
||||
#define STACKFRAME_ALIGN 8
|
||||
|
||||
#ifdef __cplusplus
|
||||
#define EXTERN extern "C"
|
||||
|
||||
@@ -121,7 +121,7 @@ void up_schedule_sigaction(struct tcb_s *tcb)
|
||||
|
||||
/* Stack pointer should be 8-byte aligned */
|
||||
|
||||
tcb->xcp.regs = (void *)STACK_ALIGN_DOWN(
|
||||
tcb->xcp.regs = (void *)STACKFRAME_ALIGN_DOWN(
|
||||
(uint32_t)tcb->xcp.regs);
|
||||
|
||||
/* Duplicate the register context. These will be
|
||||
|
||||
@@ -105,8 +105,8 @@ size_t arm_stack_check(void *stackbase, size_t nbytes)
|
||||
|
||||
/* Take extra care that we do not check outside the stack boundaries */
|
||||
|
||||
start = STACK_ALIGN_UP((uintptr_t)stackbase);
|
||||
end = STACK_ALIGN_DOWN((uintptr_t)stackbase + nbytes);
|
||||
start = STACKFRAME_ALIGN_UP((uintptr_t)stackbase);
|
||||
end = STACKFRAME_ALIGN_DOWN((uintptr_t)stackbase + nbytes);
|
||||
|
||||
/* Get the adjusted size based on the top and bottom of the stack */
|
||||
|
||||
@@ -183,7 +183,7 @@ void arm_stack_color(void *stackbase, size_t nbytes)
|
||||
|
||||
/* Take extra care that we do not write outside the stack boundaries */
|
||||
|
||||
stkptr = (uint32_t *)STACK_ALIGN_UP((uintptr_t)stackbase);
|
||||
stkptr = (uint32_t *)STACKFRAME_ALIGN_UP((uintptr_t)stackbase);
|
||||
|
||||
if (nbytes == 0) /* 0: colorize the running stack */
|
||||
{
|
||||
@@ -198,7 +198,7 @@ void arm_stack_color(void *stackbase, size_t nbytes)
|
||||
stkend = (uintptr_t)stackbase + nbytes;
|
||||
}
|
||||
|
||||
stkend = STACK_ALIGN_DOWN(stkend);
|
||||
stkend = STACKFRAME_ALIGN_DOWN(stkend);
|
||||
nwords = (stkend - (uintptr_t)stkptr) >> 2;
|
||||
|
||||
/* Set the entire stack to the coloration value */
|
||||
@@ -255,7 +255,7 @@ size_t up_check_intstack(int cpu, size_t check_size)
|
||||
{
|
||||
if (check_size == 0)
|
||||
{
|
||||
check_size = STACK_ALIGN_DOWN(CONFIG_ARCH_INTERRUPTSTACK);
|
||||
check_size = STACKFRAME_ALIGN_DOWN(CONFIG_ARCH_INTERRUPTSTACK);
|
||||
}
|
||||
|
||||
return arm_stack_check((void *)up_get_intstackbase(cpu), check_size);
|
||||
|
||||
@@ -176,7 +176,7 @@ int up_create_stack(struct tcb_s *tcb, size_t stack_size, uint8_t ttype)
|
||||
|
||||
/* Align the top of stack to STACK_ALIGNMENT. */
|
||||
|
||||
top_of_stack = STACK_ALIGN_DOWN(top_of_stack);
|
||||
top_of_stack = STACKFRAME_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 */
|
||||
|
||||
@@ -86,7 +86,7 @@
|
||||
# define CONFIG_ARCH_INTERRUPTSTACK 0
|
||||
#endif
|
||||
|
||||
#define INTSTACK_SIZE (CONFIG_ARCH_INTERRUPTSTACK & ~STACK_ALIGN_MASK)
|
||||
#define INTSTACK_SIZE (CONFIG_ARCH_INTERRUPTSTACK & ~STACKFRAME_ALIGN_MASK)
|
||||
|
||||
/* Toolchain dependent, linker defined section addresses */
|
||||
|
||||
|
||||
@@ -77,7 +77,7 @@ void *up_stack_frame(struct tcb_s *tcb, size_t frame_size)
|
||||
|
||||
/* Align the frame_size */
|
||||
|
||||
frame_size = STACK_ALIGN_UP(frame_size);
|
||||
frame_size = STACKFRAME_ALIGN_UP(frame_size);
|
||||
|
||||
/* Is there already a stack allocated? Is it big enough? */
|
||||
|
||||
|
||||
@@ -106,9 +106,9 @@ 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);
|
||||
tcb->stack_base_ptr = (void *)STACKFRAME_ALIGN_UP((uintptr_t)stack);
|
||||
|
||||
top_of_stack = STACK_ALIGN_DOWN((uintptr_t)stack + stack_size);
|
||||
top_of_stack = STACKFRAME_ALIGN_DOWN((uintptr_t)stack + stack_size);
|
||||
size_of_stack = top_of_stack - (uintptr_t)tcb->stack_base_ptr;
|
||||
tcb->adj_stack_size = size_of_stack;
|
||||
|
||||
|
||||
@@ -245,7 +245,7 @@
|
||||
|
||||
/* AArch64 the stack-pointer must be 128-bit aligned */
|
||||
|
||||
#define STACK_ALIGNMENT 16
|
||||
#define STACKFRAME_ALIGN 16
|
||||
|
||||
#ifndef __ASSEMBLY__
|
||||
|
||||
|
||||
@@ -87,8 +87,8 @@ size_t arm64_stack_check(void *stackbase, size_t nbytes)
|
||||
|
||||
/* Take extra care that we do not check outside the stack boundaries */
|
||||
|
||||
start = STACK_ALIGN_UP((uintptr_t)stackbase);
|
||||
end = STACK_ALIGN_DOWN((uintptr_t)stackbase + nbytes);
|
||||
start = STACKFRAME_ALIGN_UP((uintptr_t)stackbase);
|
||||
end = STACKFRAME_ALIGN_DOWN((uintptr_t)stackbase + nbytes);
|
||||
|
||||
/* Get the adjusted size based on the top and bottom of the stack */
|
||||
|
||||
@@ -166,7 +166,7 @@ void arm64_stack_color(void *stackbase, size_t nbytes)
|
||||
|
||||
/* Take extra care that we do not write outside the stack boundaries */
|
||||
|
||||
start = (uintptr_t)STACK_ALIGN_UP((uintptr_t)stackbase);
|
||||
start = (uintptr_t)STACKFRAME_ALIGN_UP((uintptr_t)stackbase);
|
||||
|
||||
if (nbytes == 0) /* 0: colorize the running stack */
|
||||
{
|
||||
@@ -240,7 +240,7 @@ size_t up_check_intstack(int cpu, size_t check_size)
|
||||
{
|
||||
if (check_size == 0)
|
||||
{
|
||||
check_size = STACK_ALIGN_DOWN(CONFIG_ARCH_INTERRUPTSTACK);
|
||||
check_size = STACKFRAME_ALIGN_DOWN(CONFIG_ARCH_INTERRUPTSTACK);
|
||||
}
|
||||
|
||||
return arm64_stack_check((void *)up_get_intstackbase(cpu), check_size);
|
||||
|
||||
@@ -93,7 +93,7 @@
|
||||
|
||||
int up_create_stack(struct tcb_s *tcb, size_t stack_size, uint8_t ttype)
|
||||
{
|
||||
stack_size = STACK_ALIGN_UP(stack_size);
|
||||
stack_size = STACKFRAME_ALIGN_UP(stack_size);
|
||||
|
||||
#ifdef CONFIG_TLS_ALIGNED
|
||||
/* The allocated stack size must not exceed the maximum possible for the
|
||||
|
||||
@@ -98,7 +98,7 @@
|
||||
* value aligned the 8-bytes as required by the ARM EABI.
|
||||
*/
|
||||
|
||||
# define SMP_STACK_SIZE STACK_ALIGN_UP(CONFIG_IDLETHREAD_STACKSIZE)
|
||||
# define SMP_STACK_SIZE STACKFRAME_ALIGN_UP(CONFIG_IDLETHREAD_STACKSIZE)
|
||||
# define SMP_STACK_WORDS (SMP_STACK_SIZE >> 2)
|
||||
#endif
|
||||
|
||||
@@ -147,9 +147,9 @@ extern "C"
|
||||
EXTERN char sym[n][size]
|
||||
|
||||
#define STACK_PTR_TO_FRAME(type, ptr) \
|
||||
(type *)STACK_ALIGN_DOWN((uintptr_t)(ptr) - sizeof(type))
|
||||
(type *)STACKFRAME_ALIGN_DOWN((uintptr_t)(ptr) - sizeof(type))
|
||||
|
||||
#define INTSTACK_SIZE (CONFIG_ARCH_INTERRUPTSTACK & ~STACK_ALIGN_MASK)
|
||||
#define INTSTACK_SIZE (CONFIG_ARCH_INTERRUPTSTACK & ~STACKFRAME_ALIGN_MASK)
|
||||
|
||||
#ifdef CONFIG_SMP
|
||||
|
||||
|
||||
@@ -79,7 +79,7 @@ void *up_stack_frame(struct tcb_s *tcb, size_t frame_size)
|
||||
|
||||
/* Align the frame_size */
|
||||
|
||||
frame_size = STACK_ALIGN_UP(frame_size);
|
||||
frame_size = STACKFRAME_ALIGN_UP(frame_size);
|
||||
|
||||
/* Is there already a stack allocated? Is it big enough? */
|
||||
|
||||
|
||||
@@ -118,9 +118,9 @@ 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);
|
||||
tcb->stack_base_ptr = (void *)STACKFRAME_ALIGN_UP((uintptr_t)stack);
|
||||
|
||||
top_of_stack = STACK_ALIGN_DOWN((uintptr_t)stack + stack_size);
|
||||
top_of_stack = STACKFRAME_ALIGN_DOWN((uintptr_t)stack + stack_size);
|
||||
size_of_stack = top_of_stack - (uintptr_t)tcb->stack_base_ptr;
|
||||
tcb->adj_stack_size = size_of_stack;
|
||||
|
||||
|
||||
@@ -62,7 +62,7 @@
|
||||
* frame_size must be rounded up to the next boundary
|
||||
*/
|
||||
|
||||
#define STACK_ALIGNMENT 4
|
||||
#define STACKFRAME_ALIGN 4
|
||||
|
||||
/****************************************************************************
|
||||
* Public Types
|
||||
|
||||
@@ -77,7 +77,7 @@ FAR void *up_stack_frame(FAR struct tcb_s *tcb, size_t frame_size)
|
||||
|
||||
/* Align the frame_size */
|
||||
|
||||
frame_size = STACK_ALIGN_UP(frame_size);
|
||||
frame_size = STACKFRAME_ALIGN_UP(frame_size);
|
||||
|
||||
/* Is there already a stack allocated? Is it big enough? */
|
||||
|
||||
|
||||
@@ -93,9 +93,9 @@ 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);
|
||||
tcb->stack_base_ptr = (void *)STACKFRAME_ALIGN_UP((uintptr_t)stack);
|
||||
|
||||
top_of_stack = STACK_ALIGN_DOWN((uintptr_t)stack + stack_size);
|
||||
top_of_stack = STACKFRAME_ALIGN_DOWN((uintptr_t)stack + stack_size);
|
||||
size_of_stack = top_of_stack - (uintptr_t)tcb->stack_base_ptr;
|
||||
tcb->adj_stack_size = size_of_stack;
|
||||
|
||||
|
||||
@@ -196,7 +196,7 @@ int up_create_stack(struct tcb_s *tcb, size_t stack_size, uint8_t ttype)
|
||||
*/
|
||||
|
||||
top_of_stack = (uintptr_t)tcb->stack_alloc_ptr + stack_size;
|
||||
top_of_stack = STACK_ALIGN_DOWN(top_of_stack);
|
||||
top_of_stack = STACKFRAME_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 */
|
||||
@@ -239,7 +239,7 @@ void ceva_stack_color(void *stackbase, size_t nbytes)
|
||||
|
||||
/* Take extra care that we do not write outside the stack boundaries */
|
||||
|
||||
stkptr = (uint32_t *)STACK_ALIGN_UP((uintptr_t)stackbase);
|
||||
stkptr = (uint32_t *)STACKFRAME_ALIGN_UP((uintptr_t)stackbase);
|
||||
|
||||
if (nbytes == 0) /* 0: colorize the running stack */
|
||||
{
|
||||
@@ -254,7 +254,7 @@ void ceva_stack_color(void *stackbase, size_t nbytes)
|
||||
stkend = (uintptr_t)stackbase + nbytes;
|
||||
}
|
||||
|
||||
stkend = STACK_ALIGN_DOWN(stkend);
|
||||
stkend = STACKFRAME_ALIGN_DOWN(stkend);
|
||||
nwords = (stkend - (uintptr_t)stkptr) >> 2;
|
||||
|
||||
/* Set the entire stack to the coloration value */
|
||||
|
||||
@@ -73,7 +73,7 @@ void *up_stack_frame(struct tcb_s *tcb, size_t frame_size)
|
||||
|
||||
/* Align the frame_size */
|
||||
|
||||
frame_size = STACK_ALIGN_UP(frame_size);
|
||||
frame_size = STACKFRAME_ALIGN_UP(frame_size);
|
||||
|
||||
/* Is there already a stack allocated? Is it big enough? */
|
||||
|
||||
|
||||
@@ -91,9 +91,9 @@ 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);
|
||||
tcb->stack_base_ptr = (void *)STACKFRAMEFRAME_ALIGN_UP((uintptr_t)stack);
|
||||
|
||||
top_of_stack = STACK_ALIGN_DOWN((uintptr_t)stack + stack_size);
|
||||
top_of_stack = STACKFRAME_ALIGN_DOWN((uintptr_t)stack + stack_size);
|
||||
size_of_stack = top_of_stack - (uintptr_t)tcb->stack_base_ptr;
|
||||
tcb->adj_stack_size = size_of_stack;
|
||||
|
||||
|
||||
@@ -62,7 +62,7 @@
|
||||
* necessary frame_size must be rounded up to the next boundary
|
||||
*/
|
||||
|
||||
#define STACK_ALIGNMENT 2
|
||||
#define STACKFRAME_ALIGN 2
|
||||
|
||||
/****************************************************************************
|
||||
* Public Types
|
||||
|
||||
@@ -77,7 +77,7 @@ FAR void *up_stack_frame(FAR struct tcb_s *tcb, size_t frame_size)
|
||||
|
||||
/* Align the frame_size */
|
||||
|
||||
frame_size = STACK_ALIGN_UP(frame_size);
|
||||
frame_size = STACKFRAME_ALIGN_UP(frame_size);
|
||||
|
||||
/* Is there already a stack allocated? Is it big enough? */
|
||||
|
||||
|
||||
@@ -92,9 +92,9 @@ int up_use_stack(FAR struct tcb_s *tcb, FAR 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);
|
||||
tcb->stack_base_ptr = (void *)STACKFRAME_ALIGN_UP((uintptr_t)stack);
|
||||
|
||||
top_of_stack = STACK_ALIGN_DOWN((uintptr_t)stack + stack_size);
|
||||
top_of_stack = STACKFRAME_ALIGN_DOWN((uintptr_t)stack + stack_size);
|
||||
size_of_stack = top_of_stack - (uintptr_t)tcb->stack_base_ptr;
|
||||
tcb->adj_stack_size = size_of_stack;
|
||||
|
||||
|
||||
@@ -61,9 +61,9 @@
|
||||
*/
|
||||
|
||||
#ifdef CONFIG_LIBC_FLOATINGPOINT
|
||||
# define STACK_ALIGNMENT 8
|
||||
# define STACKFRAME_ALIGN 8
|
||||
#else
|
||||
# define STACK_ALIGNMENT 4
|
||||
# define STACKFRAME_ALIGN 4
|
||||
#endif
|
||||
|
||||
/****************************************************************************
|
||||
|
||||
@@ -188,7 +188,7 @@ int up_create_stack(struct tcb_s *tcb, size_t stack_size, uint8_t ttype)
|
||||
* boundary to meet these alignment requirements.
|
||||
*/
|
||||
|
||||
top_of_stack = STACK_ALIGN_DOWN(top_of_stack);
|
||||
top_of_stack = STACKFRAME_ALIGN_DOWN(top_of_stack);
|
||||
|
||||
/* The size of the stack in bytes is then the difference between
|
||||
* the top and the bottom of the stack (+4 because if the top
|
||||
|
||||
@@ -76,7 +76,7 @@ void *up_stack_frame(struct tcb_s *tcb, size_t frame_size)
|
||||
|
||||
/* Align the frame_size */
|
||||
|
||||
frame_size = STACK_ALIGN_UP(frame_size);
|
||||
frame_size = STACKFRAME_ALIGN_UP(frame_size);
|
||||
|
||||
/* Is there already a stack allocated? Is it big enough? */
|
||||
|
||||
|
||||
@@ -93,9 +93,9 @@ 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);
|
||||
tcb->stack_base_ptr = (void *)STACKFRAME_ALIGN_UP((uintptr_t)stack);
|
||||
|
||||
top_of_stack = STACK_ALIGN_DOWN((uintptr_t)stack + stack_size);
|
||||
top_of_stack = STACKFRAME_ALIGN_DOWN((uintptr_t)stack + stack_size);
|
||||
size_of_stack = top_of_stack - (uintptr_t)tcb->stack_base_ptr;
|
||||
tcb->adj_stack_size = size_of_stack;
|
||||
|
||||
|
||||
@@ -188,7 +188,7 @@ int up_create_stack(struct tcb_s *tcb, size_t stack_size, uint8_t ttype)
|
||||
* boundary to meet these alignment requirements.
|
||||
*/
|
||||
|
||||
top_of_stack = STACK_ALIGN_DOWN(top_of_stack);
|
||||
top_of_stack = STACKFRAME_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 */
|
||||
|
||||
@@ -76,7 +76,7 @@ void *up_stack_frame(struct tcb_s *tcb, size_t frame_size)
|
||||
|
||||
/* Align the frame_size */
|
||||
|
||||
frame_size = STACK_ALIGN_UP(frame_size);
|
||||
frame_size = STACKFRAME_ALIGN_UP(frame_size);
|
||||
|
||||
/* Is there already a stack allocated? Is it big enough? */
|
||||
|
||||
|
||||
@@ -93,9 +93,9 @@ 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);
|
||||
tcb->stack_base_ptr = (void *)STACKFRAME_ALIGN_UP((uintptr_t)stack);
|
||||
|
||||
top_of_stack = STACK_ALIGN_DOWN((uintptr_t)stack + stack_size);
|
||||
top_of_stack = STACKFRAME_ALIGN_DOWN((uintptr_t)stack + stack_size);
|
||||
size_of_stack = top_of_stack - (uintptr_t)tcb->stack_base_ptr;
|
||||
tcb->adj_stack_size = size_of_stack;
|
||||
|
||||
|
||||
@@ -189,7 +189,7 @@ int up_create_stack(struct tcb_s *tcb, size_t stack_size, uint8_t ttype)
|
||||
* to meet these alignment requirements.
|
||||
*/
|
||||
|
||||
top_of_stack = STACK_ALIGN_DOWN(top_of_stack);
|
||||
top_of_stack = STACKFRAME_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 */
|
||||
|
||||
@@ -76,7 +76,7 @@ void *up_stack_frame(struct tcb_s *tcb, size_t frame_size)
|
||||
|
||||
/* Align the frame_size */
|
||||
|
||||
frame_size = STACK_ALIGN_UP(frame_size);
|
||||
frame_size = STACKFRAME_ALIGN_UP(frame_size);
|
||||
|
||||
/* Is there already a stack allocated? Is it big enough? */
|
||||
|
||||
|
||||
@@ -93,9 +93,9 @@ 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);
|
||||
tcb->stack_base_ptr = (void *)STACKFRAME_ALIGN_UP((uintptr_t)stack);
|
||||
|
||||
top_of_stack = STACK_ALIGN_DOWN((uintptr_t)stack + stack_size);
|
||||
top_of_stack = STACKFRAME_ALIGN_DOWN((uintptr_t)stack + stack_size);
|
||||
size_of_stack = top_of_stack - (uintptr_t)tcb->stack_base_ptr;
|
||||
tcb->adj_stack_size = size_of_stack;
|
||||
|
||||
|
||||
@@ -52,7 +52,7 @@
|
||||
* addresses.
|
||||
*/
|
||||
|
||||
#define STACK_ALIGNMENT 8
|
||||
#define STACKFRAME_ALIGN 8
|
||||
|
||||
/****************************************************************************
|
||||
* Inline functions
|
||||
|
||||
@@ -169,7 +169,7 @@ int up_create_stack(struct tcb_s *tcb, size_t stack_size, uint8_t ttype)
|
||||
size_t size_of_stack;
|
||||
|
||||
top_of_stack = (uintptr_t)tcb->stack_alloc_ptr + stack_size;
|
||||
top_of_stack = STACK_ALIGN_DOWN(top_of_stack);
|
||||
top_of_stack = STACKFRAME_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 */
|
||||
@@ -212,7 +212,7 @@ void or1k_stack_color(void *stackbase, size_t nbytes)
|
||||
|
||||
/* Take extra care that we do not write outside the stack boundaries */
|
||||
|
||||
stkptr = (uint32_t *)STACK_ALIGN_UP((uintptr_t)stackbase);
|
||||
stkptr = (uint32_t *)STACKFRAME_ALIGN_UP((uintptr_t)stackbase);
|
||||
|
||||
if (nbytes == 0) /* 0: colorize the running stack */
|
||||
{
|
||||
@@ -227,7 +227,7 @@ void or1k_stack_color(void *stackbase, size_t nbytes)
|
||||
stkend = (uintptr_t)stackbase + nbytes;
|
||||
}
|
||||
|
||||
stkend = STACK_ALIGN_DOWN(stkend);
|
||||
stkend = STACKFRAME_ALIGN_DOWN(stkend);
|
||||
nwords = (stkend - (uintptr_t)stkptr) >> 2;
|
||||
|
||||
/* Set the entire stack to the coloration value */
|
||||
|
||||
@@ -77,7 +77,7 @@ void *up_stack_frame(struct tcb_s *tcb, size_t frame_size)
|
||||
|
||||
/* Align the frame_size */
|
||||
|
||||
frame_size = STACK_ALIGN_UP(frame_size);
|
||||
frame_size = STACKFRAME_ALIGN_UP(frame_size);
|
||||
|
||||
/* Is there already a stack allocated? Is it big enough? */
|
||||
|
||||
|
||||
@@ -93,9 +93,9 @@ 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);
|
||||
tcb->stack_base_ptr = (void *)STACKFRAME_ALIGN_UP((uintptr_t)stack);
|
||||
|
||||
top_of_stack = STACK_ALIGN_DOWN((uintptr_t)stack + stack_size);
|
||||
top_of_stack = STACKFRAME_ALIGN_DOWN((uintptr_t)stack + stack_size);
|
||||
size_of_stack = top_of_stack - (uintptr_t)tcb->stack_base_ptr;
|
||||
tcb->adj_stack_size = size_of_stack;
|
||||
|
||||
|
||||
@@ -47,7 +47,7 @@
|
||||
* frame_size must be rounded up to the next boundary
|
||||
*/
|
||||
|
||||
#define STACK_ALIGNMENT 4
|
||||
#define STACKFRAME_ALIGN 4
|
||||
|
||||
/****************************************************************************
|
||||
* Public Types
|
||||
|
||||
@@ -76,7 +76,7 @@ void *up_stack_frame(struct tcb_s *tcb, size_t frame_size)
|
||||
|
||||
/* Align the frame_size */
|
||||
|
||||
frame_size = STACK_ALIGN_UP(frame_size);
|
||||
frame_size = STACKFRAME_ALIGN_UP(frame_size);
|
||||
|
||||
/* Is there already a stack allocated? Is it big enough? */
|
||||
|
||||
|
||||
@@ -93,9 +93,9 @@ 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);
|
||||
tcb->stack_base_ptr = (void *)STACKFRAME_ALIGN_UP((uintptr_t)stack);
|
||||
|
||||
top_of_stack = STACK_ALIGN_DOWN((uintptr_t)stack + stack_size);
|
||||
top_of_stack = STACKFRAME_ALIGN_DOWN((uintptr_t)stack + stack_size);
|
||||
size_of_stack = top_of_stack - (uintptr_t)tcb->stack_base_ptr;
|
||||
tcb->adj_stack_size = size_of_stack;
|
||||
|
||||
|
||||
@@ -54,7 +54,7 @@
|
||||
|
||||
/* RISC-V requires a 16-byte stack alignment. */
|
||||
|
||||
#define STACK_ALIGNMENT 16
|
||||
#define STACKFRAME_ALIGN 16
|
||||
|
||||
/****************************************************************************
|
||||
* Map RISC-V exception code to NuttX IRQ,
|
||||
|
||||
@@ -57,7 +57,7 @@
|
||||
#if defined(CONFIG_SMP) && CONFIG_ARCH_INTERRUPTSTACK > 15
|
||||
.macro setintstack tmp0, tmp1
|
||||
up_cpu_index \tmp0
|
||||
li \tmp1, STACK_ALIGN_DOWN(CONFIG_ARCH_INTERRUPTSTACK)
|
||||
li \tmp1, STACKFRAME_ALIGN_DOWN(CONFIG_ARCH_INTERRUPTSTACK)
|
||||
mul \tmp1, \tmp0, \tmp1
|
||||
la \tmp0, g_intstacktop
|
||||
sub sp, \tmp0, \tmp1
|
||||
|
||||
@@ -178,7 +178,7 @@ int up_create_stack(struct tcb_s *tcb, size_t stack_size, uint8_t ttype)
|
||||
* If necessary top_of_stack must be rounded down to the next boundary.
|
||||
*/
|
||||
|
||||
top_of_stack = STACK_ALIGN_DOWN(top_of_stack);
|
||||
top_of_stack = STACKFRAME_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 */
|
||||
@@ -222,7 +222,7 @@ void riscv_stack_color(void *stackbase, size_t nbytes)
|
||||
|
||||
/* Take extra care that we do not write outside the stack boundaries */
|
||||
|
||||
stkptr = (uint32_t *)STACK_ALIGN_UP((uintptr_t)stackbase);
|
||||
stkptr = (uint32_t *)STACKFRAME_ALIGN_UP((uintptr_t)stackbase);
|
||||
|
||||
if (nbytes == 0) /* 0: colorize the running stack */
|
||||
{
|
||||
@@ -237,7 +237,7 @@ void riscv_stack_color(void *stackbase, size_t nbytes)
|
||||
stkend = (uintptr_t)stackbase + nbytes;
|
||||
}
|
||||
|
||||
stkend = STACK_ALIGN_DOWN(stkend);
|
||||
stkend = STACKFRAME_ALIGN_DOWN(stkend);
|
||||
nwords = (stkend - (uintptr_t)stkptr) >> 2;
|
||||
|
||||
/* Set the entire stack to the coloration value */
|
||||
|
||||
@@ -361,8 +361,8 @@ riscv_jump_to_user:
|
||||
.type g_intstackalloc, object
|
||||
.type g_intstacktop, object
|
||||
g_intstackalloc:
|
||||
.skip STACK_ALIGN_UP(STACK_ALLOC_SIZE)
|
||||
.skip STACKFRAME_ALIGN_UP(STACK_ALLOC_SIZE)
|
||||
g_intstacktop:
|
||||
.size g_intstacktop, 0
|
||||
.size g_intstackalloc, STACK_ALIGN_DOWN(STACK_ALLOC_SIZE)
|
||||
.size g_intstackalloc, STACKFRAME_ALIGN_DOWN(STACK_ALLOC_SIZE)
|
||||
#endif
|
||||
|
||||
@@ -110,7 +110,7 @@
|
||||
# define FORK_FPU_SIZE (0)
|
||||
#endif
|
||||
|
||||
#define FORK_SIZEOF STACK_ALIGN_UP(FORK_INT_SIZE + FORK_FPU_SIZE)
|
||||
#define FORK_SIZEOF STACKFRAME_ALIGN_UP(FORK_INT_SIZE + FORK_FPU_SIZE)
|
||||
|
||||
/****************************************************************************
|
||||
* Public Types
|
||||
|
||||
@@ -72,11 +72,11 @@
|
||||
#define INTSTACK_COLOR 0xdeadbeef
|
||||
#define HEAP_COLOR 'h'
|
||||
|
||||
#define STACK_FRAME_SIZE __XSTR(STACK_ALIGNMENT)
|
||||
#define STACK_FRAME_SIZE __XSTR(STACKFRAME_ALIGN)
|
||||
|
||||
/* Interrupt Stack macros */
|
||||
|
||||
#define INT_STACK_SIZE (STACK_ALIGN_DOWN(CONFIG_ARCH_INTERRUPTSTACK))
|
||||
#define INT_STACK_SIZE (STACKFRAME_ALIGN_DOWN(CONFIG_ARCH_INTERRUPTSTACK))
|
||||
|
||||
/* Determine which (if any) console driver to use. If a console is enabled
|
||||
* and no other console device is specified, then a serial console is
|
||||
|
||||
@@ -411,11 +411,11 @@
|
||||
/* ensure the last XCPTCONTEXT_SIZE is reserved for non boot CPU */
|
||||
|
||||
bnez \hartid, 998f
|
||||
li t1, STACK_ALIGN_DOWN(\size)
|
||||
li t1, STACKFRAME_ALIGN_DOWN(\size)
|
||||
j 999f
|
||||
|
||||
998:
|
||||
li t1, STACK_ALIGN_DOWN(\size - XCPTCONTEXT_SIZE)
|
||||
li t1, STACKFRAME_ALIGN_DOWN(\size - XCPTCONTEXT_SIZE)
|
||||
|
||||
999:
|
||||
add t0, t0, t1
|
||||
|
||||
@@ -76,7 +76,7 @@ void *up_stack_frame(struct tcb_s *tcb, size_t frame_size)
|
||||
|
||||
/* Align the frame_size */
|
||||
|
||||
frame_size = STACK_ALIGN_UP(frame_size);
|
||||
frame_size = STACKFRAME_ALIGN_UP(frame_size);
|
||||
|
||||
/* Is there already a stack allocated? Is it big enough? */
|
||||
|
||||
|
||||
@@ -93,9 +93,9 @@ 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);
|
||||
tcb->stack_base_ptr = (void *)STACKFRAME_ALIGN_UP((uintptr_t)stack);
|
||||
|
||||
top_of_stack = STACK_ALIGN_DOWN((uintptr_t)stack + stack_size);
|
||||
top_of_stack = STACKFRAME_ALIGN_DOWN((uintptr_t)stack + stack_size);
|
||||
size_of_stack = top_of_stack - (uintptr_t)tcb->stack_base_ptr;
|
||||
tcb->adj_stack_size = size_of_stack;
|
||||
|
||||
|
||||
@@ -67,7 +67,7 @@ extern int g_eic7700x_boot_hart;
|
||||
#if defined(CONFIG_SMP) && CONFIG_ARCH_INTERRUPTSTACK > 15
|
||||
.macro setintstack tmp0, tmp1
|
||||
up_cpu_index \tmp0
|
||||
li \tmp1, STACK_ALIGN_DOWN(CONFIG_ARCH_INTERRUPTSTACK)
|
||||
li \tmp1, STACKFRAME_ALIGN_DOWN(CONFIG_ARCH_INTERRUPTSTACK)
|
||||
mul \tmp1, \tmp0, \tmp1
|
||||
la \tmp0, g_intstacktop
|
||||
sub sp, \tmp0, \tmp1
|
||||
|
||||
@@ -57,7 +57,7 @@
|
||||
#if defined(CONFIG_SMP) && CONFIG_ARCH_INTERRUPTSTACK > 15
|
||||
.macro setintstack tmp0, tmp1
|
||||
up_cpu_index \tmp0
|
||||
li \tmp1, STACK_ALIGN_DOWN(CONFIG_ARCH_INTERRUPTSTACK)
|
||||
li \tmp1, STACKFRAME_ALIGN_DOWN(CONFIG_ARCH_INTERRUPTSTACK)
|
||||
mul \tmp1, \tmp0, \tmp1
|
||||
la \tmp0, g_intstacktop
|
||||
sub sp, \tmp0, \tmp1
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user