mirror of
https://github.com/apache/nuttx.git
synced 2026-06-06 00:14:22 +08:00
arch: Move STACK_ALIGNMENT definition to up_internal.h
to avoid the same macro duplicate to many place Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
This commit is contained in:
@@ -75,6 +75,18 @@
|
||||
# define CONFIG_ARCH_INTERRUPTSTACK 0
|
||||
#endif
|
||||
|
||||
/* The SH stack must be aligned at word (4 byte) boundaries. If necessary
|
||||
* frame_size must be rounded up to the next boundary
|
||||
*/
|
||||
|
||||
#define STACK_ALIGNMENT 4
|
||||
|
||||
/* Stack alignment macros */
|
||||
|
||||
#define STACK_ALIGN_MASK (STACK_ALIGNMENT - 1)
|
||||
#define STACK_ALIGN_DOWN(a) ((a) & ~STACK_ALIGN_MASK)
|
||||
#define STACK_ALIGN_UP(a) (((a) + STACK_ALIGN_MASK) & ~STACK_ALIGN_MASK)
|
||||
|
||||
#define up_savestate(regs) up_copystate(regs, (uint32_t *)g_current_regs)
|
||||
|
||||
/****************************************************************************
|
||||
|
||||
@@ -33,30 +33,6 @@
|
||||
|
||||
#include "up_internal.h"
|
||||
|
||||
/****************************************************************************
|
||||
* Pre-processor Macros
|
||||
****************************************************************************/
|
||||
|
||||
/* The SH stack must be aligned at word (4 byte) boundaries. If necessary
|
||||
* frame_size must be rounded up to the next boundary
|
||||
*/
|
||||
|
||||
#define STACK_ALIGNMENT 4
|
||||
|
||||
/* Stack alignment macros */
|
||||
|
||||
#define STACK_ALIGN_MASK (STACK_ALIGNMENT-1)
|
||||
#define STACK_ALIGN_DOWN(a) ((a) & ~STACK_ALIGN_MASK)
|
||||
#define STACK_ALIGN_UP(a) (((a) + STACK_ALIGN_MASK) & ~STACK_ALIGN_MASK)
|
||||
|
||||
/****************************************************************************
|
||||
* Private Types
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Private Function Prototypes
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Public Functions
|
||||
****************************************************************************/
|
||||
@@ -112,7 +88,7 @@ FAR void *up_stack_frame(FAR struct tcb_s *tcb, size_t frame_size)
|
||||
|
||||
/* Save the adjusted stack values in the struct tcb_s */
|
||||
|
||||
tcb->stack_base_ptr = (FAR uint8_t *)tcb->stack_base_ptr + frame_size;
|
||||
tcb->stack_base_ptr = (FAR uint8_t *)tcb->stack_base_ptr + frame_size;
|
||||
tcb->adj_stack_size -= frame_size;
|
||||
|
||||
/* And return a pointer to allocated memory */
|
||||
|
||||
Reference in New Issue
Block a user