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:
Xiang Xiao
2022-02-16 00:59:06 +08:00
committed by archer
parent f42b56b1c4
commit 3bf416e8b8
59 changed files with 236 additions and 743 deletions
+12
View File
@@ -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)
/****************************************************************************
+1 -25
View File
@@ -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 */