diff --git a/arch/arm/include/irq.h b/arch/arm/include/irq.h index 28139f63e96..f251788408e 100644 --- a/arch/arm/include/irq.h +++ b/arch/arm/include/irq.h @@ -94,6 +94,12 @@ } while (0) #endif +/* For use with EABI and floating point, the stack must be aligned to 8-byte + * addresses. + */ + +#define STACK_ALIGNMENT 8 + #ifdef __cplusplus #define EXTERN extern "C" extern "C" diff --git a/arch/arm/src/common/arm_internal.h b/arch/arm/src/common/arm_internal.h index 36431940e9e..2918386c921 100644 --- a/arch/arm/src/common/arm_internal.h +++ b/arch/arm/src/common/arm_internal.h @@ -80,12 +80,6 @@ # define USE_SERIALDRIVER 1 #endif -/* For use with EABI and floating point, the stack must be aligned to 8-byte - * addresses. - */ - -#define STACK_ALIGNMENT 8 - /* Stack alignment macros */ #define STACK_ALIGN_MASK (STACK_ALIGNMENT - 1) diff --git a/arch/arm64/include/irq.h b/arch/arm64/include/irq.h index 1779009d9aa..bb1f7977693 100644 --- a/arch/arm64/include/irq.h +++ b/arch/arm64/include/irq.h @@ -243,6 +243,10 @@ #define IRQ_SPSR_MASK (IRQ_DAIF_MASK << 6) +/* AArch64 the stack-pointer must be 128-bit aligned */ + +#define STACK_ALIGNMENT 16 + #ifndef __ASSEMBLY__ #ifdef __cplusplus diff --git a/arch/arm64/src/common/arm64_internal.h b/arch/arm64/src/common/arm64_internal.h index 4d5e38d9f63..3931db57102 100644 --- a/arch/arm64/src/common/arm64_internal.h +++ b/arch/arm64/src/common/arm64_internal.h @@ -93,10 +93,6 @@ #define STACK_COLOR 0xdeaddead #define HEAP_COLOR 'h' -/* AArch64 the stack-pointer must be 128-bit aligned */ - -#define STACK_ALIGNMENT 16 - /* Stack alignment macros */ #define STACK_ALIGN_MASK (STACK_ALIGNMENT - 1) diff --git a/arch/avr/include/irq.h b/arch/avr/include/irq.h index cf4dbde3682..453a8684e7d 100644 --- a/arch/avr/include/irq.h +++ b/arch/avr/include/irq.h @@ -58,6 +58,12 @@ * Pre-processor Definitions ****************************************************************************/ +/* The AVR32 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 + /**************************************************************************** * Public Types ****************************************************************************/ diff --git a/arch/avr/src/avr32/avr32.h b/arch/avr/src/avr32/avr32.h index a645ba846e6..6b58887f9a5 100644 --- a/arch/avr/src/avr32/avr32.h +++ b/arch/avr/src/avr32/avr32.h @@ -38,12 +38,6 @@ * Pre-processor Definitions ****************************************************************************/ -/* The AVR32 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) diff --git a/arch/hc/include/irq.h b/arch/hc/include/irq.h index f00c78c0e30..976b97e131f 100644 --- a/arch/hc/include/irq.h +++ b/arch/hc/include/irq.h @@ -58,6 +58,12 @@ * Pre-processor Definitions ****************************************************************************/ +/* The CPU12 stack should be aligned at half-word (2 byte) boundaries. If + * necessary frame_size must be rounded up to the next boundary + */ + +#define STACK_ALIGNMENT 2 + /**************************************************************************** * Public Types ****************************************************************************/ diff --git a/arch/hc/src/common/hc_internal.h b/arch/hc/src/common/hc_internal.h index 42897b562b4..dc816473bb7 100644 --- a/arch/hc/src/common/hc_internal.h +++ b/arch/hc/src/common/hc_internal.h @@ -73,12 +73,6 @@ # define CONFIG_ARCH_INTERRUPTSTACK 0 #endif -/* The CPU12 stack should be aligned at half-word (2 byte) boundaries. If - * necessary frame_size must be rounded up to the next boundary - */ - -#define STACK_ALIGNMENT 2 - /* Stack alignment macros */ #define STACK_ALIGN_MASK (STACK_ALIGNMENT - 1) diff --git a/arch/mips/include/irq.h b/arch/mips/include/irq.h index 907c982698c..d7c2e1b1063 100644 --- a/arch/mips/include/irq.h +++ b/arch/mips/include/irq.h @@ -56,6 +56,16 @@ * Pre-processor Definitions ****************************************************************************/ +/* MIPS requires at least a 4-byte stack alignment. For floating point use, + * however, the stack must be aligned to 8-byte addresses. + */ + +#ifdef CONFIG_LIBC_FLOATINGPOINT +# define STACK_ALIGNMENT 8 +#else +# define STACK_ALIGNMENT 4 +#endif + /**************************************************************************** * Public Types ****************************************************************************/ diff --git a/arch/mips/src/common/mips_internal.h b/arch/mips/src/common/mips_internal.h index 56900f9498b..8989e88e626 100644 --- a/arch/mips/src/common/mips_internal.h +++ b/arch/mips/src/common/mips_internal.h @@ -71,16 +71,6 @@ # define CONFIG_ARCH_INTERRUPTSTACK 0 #endif -/* MIPS requires at least a 4-byte stack alignment. For floating point use, - * however, the stack must be aligned to 8-byte addresses. - */ - -#ifdef CONFIG_LIBC_FLOATINGPOINT -# define STACK_ALIGNMENT 8 -#else -# define STACK_ALIGNMENT 4 -#endif - /* Stack alignment macros */ #define STACK_ALIGN_MASK (STACK_ALIGNMENT - 1) diff --git a/arch/misoc/src/lm32/lm32.h b/arch/misoc/src/lm32/lm32.h index ae8d06b6eff..6f2acedaedf 100644 --- a/arch/misoc/src/lm32/lm32.h +++ b/arch/misoc/src/lm32/lm32.h @@ -66,16 +66,6 @@ # endif #endif -/* LM32 requires at least a 4-byte stack alignment. For floating point use, - * however, the stack must be aligned to 8-byte addresses. - */ - -#ifdef CONFIG_LIBC_FLOATINGPOINT -# define STACK_ALIGNMENT 8 -#else -# define STACK_ALIGNMENT 4 -#endif - /* Stack alignment macros */ #define STACK_ALIGN_MASK (STACK_ALIGNMENT - 1) diff --git a/arch/misoc/src/minerva/minerva.h b/arch/misoc/src/minerva/minerva.h index 5780d3eb2ca..498f4ccbced 100644 --- a/arch/misoc/src/minerva/minerva.h +++ b/arch/misoc/src/minerva/minerva.h @@ -65,16 +65,6 @@ # endif #endif -/* MINERVA requires at least a 4-byte stack alignment. For floating point - * use, however, the stack must be aligned to 8-byte addresses. - */ - -#ifdef CONFIG_LIBC_FLOATINGPOINT -# define STACK_ALIGNMENT 8 -#else -# define STACK_ALIGNMENT 4 -#endif - /* Stack alignment macros */ #define STACK_ALIGN_MASK (STACK_ALIGNMENT - 1) diff --git a/arch/or1k/include/irq.h b/arch/or1k/include/irq.h index 0491446fe51..36412cd33d6 100644 --- a/arch/or1k/include/irq.h +++ b/arch/or1k/include/irq.h @@ -44,6 +44,16 @@ #include +/**************************************************************************** + * Pre-processor Definitions + ****************************************************************************/ + +/* For use with EABI and floating point, the stack must be aligned to 8-byte + * addresses. + */ + +#define STACK_ALIGNMENT 8 + /**************************************************************************** * Inline functions ****************************************************************************/ diff --git a/arch/or1k/src/common/or1k_internal.h b/arch/or1k/src/common/or1k_internal.h index 4d52245cb6d..24d3d06e15c 100644 --- a/arch/or1k/src/common/or1k_internal.h +++ b/arch/or1k/src/common/or1k_internal.h @@ -74,12 +74,6 @@ # define CONFIG_ARCH_INTERRUPTSTACK 0 #endif -/* For use with EABI and floating point, the stack must be aligned to 8-byte - * addresses. - */ - -#define STACK_ALIGNMENT 8 - /* Stack alignment macros */ #define STACK_ALIGN_MASK (STACK_ALIGNMENT - 1) diff --git a/arch/renesas/include/irq.h b/arch/renesas/include/irq.h index cc4efe02185..a32eeb144e3 100644 --- a/arch/renesas/include/irq.h +++ b/arch/renesas/include/irq.h @@ -43,6 +43,12 @@ * Pre-processor Definitions ****************************************************************************/ +/* 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 + /**************************************************************************** * Public Types ****************************************************************************/ diff --git a/arch/renesas/src/common/renesas_internal.h b/arch/renesas/src/common/renesas_internal.h index 6e8433a70de..6df7bb45f60 100644 --- a/arch/renesas/src/common/renesas_internal.h +++ b/arch/renesas/src/common/renesas_internal.h @@ -77,12 +77,6 @@ # 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) diff --git a/arch/risc-v/include/irq.h b/arch/risc-v/include/irq.h index 3dd83618d03..7300da552d6 100644 --- a/arch/risc-v/include/irq.h +++ b/arch/risc-v/include/irq.h @@ -52,6 +52,10 @@ #endif #define __XSTR(s) __STR(s) +/* RISC-V requires a 16-byte stack alignment. */ + +#define STACK_ALIGNMENT 16 + /**************************************************************************** * Map RISC-V exception code to NuttX IRQ, * the exception that code > 19 is reserved or custom exception. diff --git a/arch/risc-v/src/common/riscv_internal.h b/arch/risc-v/src/common/riscv_internal.h index 8fd3dd4795e..f48e1938be9 100644 --- a/arch/risc-v/src/common/riscv_internal.h +++ b/arch/risc-v/src/common/riscv_internal.h @@ -72,9 +72,6 @@ #define INTSTACK_COLOR 0xdeadbeef #define HEAP_COLOR 'h' -/* RISC-V requires a 16-byte stack alignment. */ - -#define STACK_ALIGNMENT 16 #define STACK_FRAME_SIZE __XSTR(STACK_ALIGNMENT) /* Stack alignment macros */ diff --git a/arch/risc-v/src/nuttsbi/sbi_internal.h b/arch/risc-v/src/nuttsbi/sbi_internal.h index 32456fdd91c..b021c81cf67 100644 --- a/arch/risc-v/src/nuttsbi/sbi_internal.h +++ b/arch/risc-v/src/nuttsbi/sbi_internal.h @@ -62,9 +62,6 @@ #define MTIMER_TIME_BASE (CONFIG_NUTTSBI_MTIME_BASE) #define MTIMER_CMP_BASE (CONFIG_NUTTSBI_MTIMECMP_BASE) -/* For stack alignment */ - -#define STACK_ALIGNMENT 16 #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) diff --git a/arch/sim/include/irq.h b/arch/sim/include/irq.h index 61195440e7e..cff7bda864f 100644 --- a/arch/sim/include/irq.h +++ b/arch/sim/include/irq.h @@ -43,6 +43,12 @@ #define NR_IRQS 64 +/* Use a stack alignment of 16 bytes. If necessary frame_size must be + * rounded up to the next boundary + */ + +#define STACK_ALIGNMENT 16 + /**************************************************************************** * Public Types ****************************************************************************/ diff --git a/arch/sim/src/sim/sim_internal.h b/arch/sim/src/sim/sim_internal.h index 205dc0ee9ea..d45b8e511c3 100644 --- a/arch/sim/src/sim/sim_internal.h +++ b/arch/sim/src/sim/sim_internal.h @@ -84,12 +84,6 @@ # define CONFIG_SIM_FB_INTERVAL_LINE 0 #endif -/* Use a stack alignment of 16 bytes. If necessary frame_size must be - * rounded up to the next boundary - */ - -#define STACK_ALIGNMENT 16 - /* Stack alignment macros */ #define STACK_ALIGN_MASK (STACK_ALIGNMENT - 1) diff --git a/arch/sparc/include/irq.h b/arch/sparc/include/irq.h index 67aeb9197df..cdffd4770d0 100644 --- a/arch/sparc/include/irq.h +++ b/arch/sparc/include/irq.h @@ -56,6 +56,12 @@ * Pre-processor Definitions ****************************************************************************/ +/* sparc requires at least a 4-byte stack alignment. For floating point use, + * however, the stack must be aligned to 8-byte addresses. + */ + +#define STACK_ALIGNMENT 8 + /**************************************************************************** * Public Types ****************************************************************************/ diff --git a/arch/sparc/src/common/sparc_internal.h b/arch/sparc/src/common/sparc_internal.h index 5600350f304..fd7c6629a93 100644 --- a/arch/sparc/src/common/sparc_internal.h +++ b/arch/sparc/src/common/sparc_internal.h @@ -84,12 +84,6 @@ #define INTSTACK_SIZE (CONFIG_ARCH_INTERRUPTSTACK & ~STACK_ALIGN_MASK) -/* sparc requires at least a 4-byte stack alignment. For floating point use, - * however, the stack must be aligned to 8-byte addresses. - */ - -#define STACK_ALIGNMENT 8 - /* Stack alignment macros */ #define STACK_ALIGN_MASK (STACK_ALIGNMENT - 1) diff --git a/arch/tricore/include/irq.h b/arch/tricore/include/irq.h index 9f357334229..71495db329e 100644 --- a/arch/tricore/include/irq.h +++ b/arch/tricore/include/irq.h @@ -60,6 +60,12 @@ #define tricore_addr2csa(addr) ((uintptr_t)(((((uintptr_t)(addr)) & 0xF0000000) >> 12) \ | (((uintptr_t)(addr) & 0x003FFFC0) >> 6))) +/* For use with EABI and floating point, the stack must be aligned to 8-byte + * addresses. + */ + +#define STACK_ALIGNMENT 8 + #ifndef __ASSEMBLY__ #ifdef __cplusplus diff --git a/arch/tricore/src/common/tricore_internal.h b/arch/tricore/src/common/tricore_internal.h index 57d4557146f..5e4014cd6e9 100644 --- a/arch/tricore/src/common/tricore_internal.h +++ b/arch/tricore/src/common/tricore_internal.h @@ -85,12 +85,6 @@ # define USE_SERIALDRIVER 1 #endif -/* For use with EABI and floating point, the stack must be aligned to 8-byte - * addresses. - */ - -#define STACK_ALIGNMENT 8 - /* Stack alignment macros */ #define STACK_ALIGN_MASK (STACK_ALIGNMENT - 1) diff --git a/arch/x86/include/irq.h b/arch/x86/include/irq.h index 14117ecff1e..ab6d0a1a07d 100644 --- a/arch/x86/include/irq.h +++ b/arch/x86/include/irq.h @@ -55,6 +55,13 @@ * Pre-processor Definitions ****************************************************************************/ +/* The initial stack point is aligned at word (4 byte) boundaries. If + * necessary frame_size must be rounded up to the next boundary to retain + * this alignment. + */ + +#define STACK_ALIGNMENT 4 + /**************************************************************************** * Public Types ****************************************************************************/ diff --git a/arch/x86/src/common/x86_internal.h b/arch/x86/src/common/x86_internal.h index a3b33ac713e..e0f70273792 100644 --- a/arch/x86/src/common/x86_internal.h +++ b/arch/x86/src/common/x86_internal.h @@ -73,13 +73,6 @@ # define CONFIG_ARCH_INTERRUPTSTACK 0 #endif -/* The initial stack point is aligned at word (4 byte) boundaries. If - * necessary frame_size must be rounded up to the next boundary to retain - * this alignment. - */ - -#define STACK_ALIGNMENT 4 - /* Stack alignment macros */ #define STACK_ALIGN_MASK (STACK_ALIGNMENT - 1) diff --git a/arch/x86_64/include/irq.h b/arch/x86_64/include/irq.h index 89f6eaa1867..574f5874586 100644 --- a/arch/x86_64/include/irq.h +++ b/arch/x86_64/include/irq.h @@ -55,6 +55,13 @@ #define X86_64_CPUPRIV_UVBASE_OFFSET (24) #define X86_64_CPUPRIV_KTOPSTK_OFFSET (32) +/* The initial stack point is aligned at 16 bytes boundaries. If + * necessary frame_size must be rounded up to the next boundary to retain + * this alignment. + */ + +#define STACK_ALIGNMENT 16 + /**************************************************************************** * Public Data ****************************************************************************/ diff --git a/arch/x86_64/src/common/x86_64_internal.h b/arch/x86_64/src/common/x86_64_internal.h index 3e961fe99ad..f9021b3675f 100644 --- a/arch/x86_64/src/common/x86_64_internal.h +++ b/arch/x86_64/src/common/x86_64_internal.h @@ -94,13 +94,6 @@ # define CONFIG_ARCH_INTERRUPTSTACK 0 #endif -/* The initial stack point is aligned at 16 bytes boundaries. If - * necessary frame_size must be rounded up to the next boundary to retain - * this alignment. - */ - -#define STACK_ALIGNMENT 16 - /* Stack alignment macros */ #define STACK_ALIGN_MASK (STACK_ALIGNMENT - 1) diff --git a/arch/xtensa/include/irq.h b/arch/xtensa/include/irq.h index 39ae9149f03..1a5f024129c 100644 --- a/arch/xtensa/include/irq.h +++ b/arch/xtensa/include/irq.h @@ -71,6 +71,10 @@ * Pre-processor Definitions ****************************************************************************/ +/* XTENSA requires at least a 16-byte stack alignment. */ + +#define STACK_ALIGNMENT 16 + /* IRQ Stack Frame Format. Each value is a uint32_t register index */ #define REG_PC (0) /* Return PC */ diff --git a/arch/xtensa/src/common/xtensa.h b/arch/xtensa/src/common/xtensa.h index bf5515d1acd..f4ce7abd6cf 100644 --- a/arch/xtensa/src/common/xtensa.h +++ b/arch/xtensa/src/common/xtensa.h @@ -84,10 +84,6 @@ # define INTSTACK_SIZE INTSTACK_ALIGNUP(CONFIG_ARCH_INTERRUPTSTACK) #endif -/* XTENSA requires at least a 16-byte stack alignment. */ - -#define STACK_ALIGNMENT 16 - /* Stack alignment macros */ #define STACK_ALIGN_MASK (STACK_ALIGNMENT - 1) diff --git a/arch/z16/include/irq.h b/arch/z16/include/irq.h index 162bbd2de6c..7d3bb74f88d 100644 --- a/arch/z16/include/irq.h +++ b/arch/z16/include/irq.h @@ -43,6 +43,12 @@ * Pre-processor Definitions ****************************************************************************/ +/* Align the stack to word (4 byte) boundaries. This is probablya greater + * alignment than is required. + */ + +#define STACK_ALIGNMENT 4 + /**************************************************************************** * Public Types ****************************************************************************/ diff --git a/arch/z16/src/common/z16_internal.h b/arch/z16/src/common/z16_internal.h index 55d69808537..6d8ce0882e7 100644 --- a/arch/z16/src/common/z16_internal.h +++ b/arch/z16/src/common/z16_internal.h @@ -72,12 +72,6 @@ # define USE_SERIALDRIVER 1 #endif -/* Align the stack to word (4 byte) boundaries. This is probablya greater - * alignment than is required. - */ - -#define STACK_ALIGNMENT 4 - /* Stack alignment macros */ #define STACK_ALIGN_MASK (STACK_ALIGNMENT - 1) diff --git a/arch/z80/include/irq.h b/arch/z80/include/irq.h index c27006ebe39..d0ab4fc9f1e 100644 --- a/arch/z80/include/irq.h +++ b/arch/z80/include/irq.h @@ -34,6 +34,16 @@ #include #include +/**************************************************************************** + * Pre-processor Definitions + ****************************************************************************/ + +/* The Z80 stack does not need to be aligned. Here is is aligned at word + * (4 byte) boundary. + */ + +#define STACK_ALIGNMENT 4 + /**************************************************************************** * Public Function Prototypes ****************************************************************************/ diff --git a/arch/z80/src/common/z80_internal.h b/arch/z80/src/common/z80_internal.h index 80171435efa..87e82706e24 100644 --- a/arch/z80/src/common/z80_internal.h +++ b/arch/z80/src/common/z80_internal.h @@ -63,12 +63,6 @@ # define USE_SERIALDRIVER 1 #endif -/* The Z80 stack does not need to be aligned. Here is is aligned at word - * (4 byte) boundary. - */ - -#define STACK_ALIGNMENT 4 - /* Stack alignment macros */ #define STACK_ALIGN_MASK (STACK_ALIGNMENT - 1)