diff --git a/arch/arm/src/armv7-a/addrenv.h b/arch/arm/src/armv7-a/addrenv.h index 451b50aca7d..a5453afd97f 100644 --- a/arch/arm/src/armv7-a/addrenv.h +++ b/arch/arm/src/armv7-a/addrenv.h @@ -38,12 +38,6 @@ * Pre-processor Definitions ****************************************************************************/ -/* Aligned size of the kernel stack */ - -#ifdef CONFIG_ARCH_KERNEL_STACK -# define ARCH_KERNEL_STACKSIZE ((CONFIG_ARCH_KERNEL_STACKSIZE + 7) & ~7) -#endif - /* Using a 4KiB page size, each 1MiB section maps to a PTE containing * 256*2KiB entries */ diff --git a/arch/arm/src/common/arm_internal.h b/arch/arm/src/common/arm_internal.h index 2918386c921..ba22c4a3bd1 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 -/* 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) - /* Check if an interrupt stack size is configured */ #ifndef CONFIG_ARCH_INTERRUPTSTACK diff --git a/arch/arm64/src/common/addrenv.h b/arch/arm64/src/common/addrenv.h index ac5b6181d83..8aa1241e1a9 100644 --- a/arch/arm64/src/common/addrenv.h +++ b/arch/arm64/src/common/addrenv.h @@ -40,12 +40,6 @@ * Pre-processor Definitions ****************************************************************************/ -/* Aligned size of the kernel stack */ - -#ifdef CONFIG_ARCH_KERNEL_STACK -# define ARCH_KERNEL_STACKSIZE STACK_ALIGN_UP(CONFIG_ARCH_KERNEL_STACKSIZE) -#endif - /* Base address for address environment */ #if CONFIG_ARCH_TEXT_VBASE != 0 diff --git a/arch/arm64/src/common/arm64_internal.h b/arch/arm64/src/common/arm64_internal.h index 3931db57102..afce97dab92 100644 --- a/arch/arm64/src/common/arm64_internal.h +++ b/arch/arm64/src/common/arm64_internal.h @@ -93,12 +93,6 @@ #define STACK_COLOR 0xdeaddead #define HEAP_COLOR 'h' -/* 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) - #ifdef CONFIG_SMP /* The size of interrupt and idle stack. This is the configured * value aligned the 8-bytes as required by the ARM EABI. diff --git a/arch/avr/src/avr32/avr32.h b/arch/avr/src/avr32/avr32.h index 6b58887f9a5..24367e93a96 100644 --- a/arch/avr/src/avr32/avr32.h +++ b/arch/avr/src/avr32/avr32.h @@ -38,12 +38,6 @@ * Pre-processor Definitions ****************************************************************************/ -/* 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) - /* Macros to handle saving and restore interrupt state. The state is copied * from the stack to the TCB, but only a referenced is passed to get the * state from the TCB. diff --git a/arch/ceva/src/common/ceva_internal.h b/arch/ceva/src/common/ceva_internal.h index e4737a59046..d43747ffd7d 100644 --- a/arch/ceva/src/common/ceva_internal.h +++ b/arch/ceva/src/common/ceva_internal.h @@ -73,12 +73,6 @@ # define USE_SERIALDRIVER 1 #endif -/* Stack alignment macros */ - -#define STACK_ALIGN_MASK (sizeof(uint32_t) - 1) -#define STACK_ALIGN_DOWN(a) ((a) & ~STACK_ALIGN_MASK) -#define STACK_ALIGN_UP(a) (((a) + STACK_ALIGN_MASK) & ~STACK_ALIGN_MASK) - /* Linker defined section addresses */ #define _START_TEXT _stext diff --git a/arch/hc/src/common/hc_internal.h b/arch/hc/src/common/hc_internal.h index dc816473bb7..c05b2f55e6e 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 -/* 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 getreg8(a) (*(volatile uint8_t *)(a)) #define putreg8(v,a) (*(volatile uint8_t *)(a) = (v)) #define getreg16(a) (*(volatile uint16_t *)(a)) diff --git a/arch/mips/src/common/mips_internal.h b/arch/mips/src/common/mips_internal.h index 8989e88e626..53b012355d9 100644 --- a/arch/mips/src/common/mips_internal.h +++ b/arch/mips/src/common/mips_internal.h @@ -71,12 +71,6 @@ # define CONFIG_ARCH_INTERRUPTSTACK 0 #endif -/* 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 getreg8(a) (*(volatile uint8_t *)(a)) #define putreg8(v,a) (*(volatile uint8_t *)(a) = (v)) #define getreg16(a) (*(volatile uint16_t *)(a)) diff --git a/arch/misoc/src/lm32/lm32.h b/arch/misoc/src/lm32/lm32.h index 6f2acedaedf..4e83d27f41e 100644 --- a/arch/misoc/src/lm32/lm32.h +++ b/arch/misoc/src/lm32/lm32.h @@ -66,12 +66,6 @@ # endif #endif -/* 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) - /**************************************************************************** * Public Types ****************************************************************************/ diff --git a/arch/misoc/src/minerva/minerva.h b/arch/misoc/src/minerva/minerva.h index 498f4ccbced..6d5a57af2e4 100644 --- a/arch/misoc/src/minerva/minerva.h +++ b/arch/misoc/src/minerva/minerva.h @@ -65,12 +65,6 @@ # endif #endif -/* 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) - /**************************************************************************** * Public Types ****************************************************************************/ diff --git a/arch/or1k/src/common/or1k_internal.h b/arch/or1k/src/common/or1k_internal.h index 24d3d06e15c..2eaade2fe26 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 -/* 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 or1k_savestate(regs) or1k_copyfullstate(regs, up_current_regs()) #define or1k_restorestate(regs) or1k_copyfullstate(up_current_regs(), regs) diff --git a/arch/renesas/src/common/renesas_internal.h b/arch/renesas/src/common/renesas_internal.h index 6df7bb45f60..57e34390341 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 -/* 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 renesas_savestate(regs) renesas_copystate(regs, up_current_regs()) #define getreg8(a) (*(volatile uint8_t *)(a)) diff --git a/arch/risc-v/src/common/addrenv.h b/arch/risc-v/src/common/addrenv.h index 233f7c4ecd7..ec4557311ff 100644 --- a/arch/risc-v/src/common/addrenv.h +++ b/arch/risc-v/src/common/addrenv.h @@ -40,12 +40,6 @@ * Pre-processor Definitions ****************************************************************************/ -/* Aligned size of the kernel stack */ - -#ifdef CONFIG_ARCH_KERNEL_STACK -# define ARCH_KERNEL_STACKSIZE STACK_ALIGN_UP(CONFIG_ARCH_KERNEL_STACKSIZE) -#endif - /* Base address for address environment */ #if CONFIG_ARCH_TEXT_VBASE != 0 diff --git a/arch/risc-v/src/common/riscv_exception_common.S b/arch/risc-v/src/common/riscv_exception_common.S index 7bcc4a5de16..1ac81a6681c 100644 --- a/arch/risc-v/src/common/riscv_exception_common.S +++ b/arch/risc-v/src/common/riscv_exception_common.S @@ -26,6 +26,7 @@ #include +#include #include #include #include diff --git a/arch/risc-v/src/common/riscv_internal.h b/arch/risc-v/src/common/riscv_internal.h index f48e1938be9..8e25f4ee3a2 100644 --- a/arch/risc-v/src/common/riscv_internal.h +++ b/arch/risc-v/src/common/riscv_internal.h @@ -74,12 +74,6 @@ #define STACK_FRAME_SIZE __XSTR(STACK_ALIGNMENT) -/* 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) - /* Interrupt Stack macros */ #define INT_STACK_SIZE (STACK_ALIGN_DOWN(CONFIG_ARCH_INTERRUPTSTACK)) diff --git a/arch/risc-v/src/nuttsbi/sbi_internal.h b/arch/risc-v/src/nuttsbi/sbi_internal.h index b021c81cf67..5939acf9cb3 100644 --- a/arch/risc-v/src/nuttsbi/sbi_internal.h +++ b/arch/risc-v/src/nuttsbi/sbi_internal.h @@ -62,10 +62,6 @@ #define MTIMER_TIME_BASE (CONFIG_NUTTSBI_MTIME_BASE) #define MTIMER_CMP_BASE (CONFIG_NUTTSBI_MTIMECMP_BASE) -#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) - /* Temporary stack placement and size */ #define TEMP_STACK_BASE (_ebss) diff --git a/arch/sim/src/sim/sim_internal.h b/arch/sim/src/sim/sim_internal.h index d45b8e511c3..69d4ef27893 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 -/* 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) - /* Simulated Heap Definitions ***********************************************/ /* Size of the simulated heap */ diff --git a/arch/sparc/src/common/sparc_internal.h b/arch/sparc/src/common/sparc_internal.h index fd7c6629a93..063caa7b7b9 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) -/* 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) - /* This is the value used to mark the stack for subsequent stack monitoring * logic. */ diff --git a/arch/tricore/src/common/tricore_internal.h b/arch/tricore/src/common/tricore_internal.h index c3b5761a85b..7fd1e7a0e37 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 -/* 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) - /* Check if an interrupt stack size is configured */ #ifndef CONFIG_ARCH_INTERRUPTSTACK diff --git a/arch/x86/src/common/x86_internal.h b/arch/x86/src/common/x86_internal.h index e0f70273792..e7fc43364ca 100644 --- a/arch/x86/src/common/x86_internal.h +++ b/arch/x86/src/common/x86_internal.h @@ -73,12 +73,6 @@ # define CONFIG_ARCH_INTERRUPTSTACK 0 #endif -/* 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 getreg8(p) inb(p) #define putreg8(v,p) outb(v,p) #define getreg16(p) inw(p) diff --git a/arch/x86_64/src/common/addrenv.h b/arch/x86_64/src/common/addrenv.h index 7fda891eccd..e9ddee927f8 100644 --- a/arch/x86_64/src/common/addrenv.h +++ b/arch/x86_64/src/common/addrenv.h @@ -40,12 +40,6 @@ * Pre-processor Definitions ****************************************************************************/ -/* Aligned size of the kernel stack */ - -#ifdef CONFIG_ARCH_KERNEL_STACK -# define ARCH_KERNEL_STACKSIZE STACK_ALIGN_UP(CONFIG_ARCH_KERNEL_STACKSIZE) -#endif - /* Base address for address environment */ #if CONFIG_ARCH_TEXT_VBASE != 0 diff --git a/arch/x86_64/src/common/x86_64_internal.h b/arch/x86_64/src/common/x86_64_internal.h index f9021b3675f..92c5afa5e0e 100644 --- a/arch/x86_64/src/common/x86_64_internal.h +++ b/arch/x86_64/src/common/x86_64_internal.h @@ -94,12 +94,6 @@ # define CONFIG_ARCH_INTERRUPTSTACK 0 #endif -/* 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) - /* This is the value used to mark the stack for subsequent stack monitoring * logic. */ diff --git a/arch/x86_64/src/intel64/intel64_initialstate.c b/arch/x86_64/src/intel64/intel64_initialstate.c index 60460d3948f..b05640ba1e3 100644 --- a/arch/x86_64/src/intel64/intel64_initialstate.c +++ b/arch/x86_64/src/intel64/intel64_initialstate.c @@ -51,12 +51,6 @@ # error x86_64 stack canaries requires TLS support ! #endif -/* Aligned size of the kernel stack */ - -#ifdef CONFIG_ARCH_KERNEL_STACK -# define ARCH_KERNEL_STACKSIZE STACK_ALIGN_UP(CONFIG_ARCH_KERNEL_STACKSIZE) -#endif - /**************************************************************************** * Public Functions ****************************************************************************/ diff --git a/arch/xtensa/src/common/xtensa.h b/arch/xtensa/src/common/xtensa.h index f4ce7abd6cf..4c08f4101ad 100644 --- a/arch/xtensa/src/common/xtensa.h +++ b/arch/xtensa/src/common/xtensa.h @@ -84,12 +84,6 @@ # define INTSTACK_SIZE INTSTACK_ALIGNUP(CONFIG_ARCH_INTERRUPTSTACK) #endif -/* 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) - /* An IDLE thread stack size for CPU0 must be defined */ #if !defined(CONFIG_IDLETHREAD_STACKSIZE) diff --git a/arch/z16/src/common/z16_internal.h b/arch/z16/src/common/z16_internal.h index 6d8ce0882e7..626a80d0fa8 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 -/* 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) - /* Macros for portability */ #define IN_INTERRUPT (up_current_regs() != NULL) diff --git a/arch/z80/src/common/z80_internal.h b/arch/z80/src/common/z80_internal.h index 87e82706e24..24e373dc0f8 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 -/* 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) - /* Register access macros *************************************************** * * The register access mechanism provided in ez8.h differs from the useful in diff --git a/include/nuttx/irq.h b/include/nuttx/irq.h index 4f483af6af0..18e4a3e46f6 100644 --- a/include/nuttx/irq.h +++ b/include/nuttx/irq.h @@ -98,6 +98,18 @@ while (0) #endif +/* 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) + +/* Aligned size of the kernel stack */ + +#ifdef CONFIG_ARCH_KERNEL_STACK +# define ARCH_KERNEL_STACKSIZE STACK_ALIGN_UP(CONFIG_ARCH_KERNEL_STACKSIZE) +#endif + /* Interrupt was handled by this device */ #define IRQ_HANDLED 0