[rtems commit] score: Add CPU_INTERRUPT_STACK_ALIGNMENT

Sebastian Huber sebh at rtems.org
Fri Jun 29 09:53:43 UTC 2018


Module:    rtems
Branch:    master
Commit:    c8df844cf3bddde0221614843c97cb6c950cdba9
Changeset: http://git.rtems.org/rtems/commit/?id=c8df844cf3bddde0221614843c97cb6c950cdba9

Author:    Sebastian Huber <sebastian.huber at embedded-brains.de>
Date:      Tue Jun 19 14:59:51 2018 +0200

score: Add CPU_INTERRUPT_STACK_ALIGNMENT

Add CPU port define for the interrupt stack alignment.  The alignment
should take the stack ABI and the cache line size into account.

Update #3459.

---

 cpukit/score/cpu/arm/include/rtems/score/cpu.h      | 2 ++
 cpukit/score/cpu/bfin/include/rtems/score/cpu.h     | 2 ++
 cpukit/score/cpu/epiphany/include/rtems/score/cpu.h | 2 ++
 cpukit/score/cpu/i386/include/rtems/score/cpu.h     | 2 ++
 cpukit/score/cpu/lm32/include/rtems/score/cpu.h     | 2 ++
 cpukit/score/cpu/m32c/include/rtems/score/cpu.h     | 2 ++
 cpukit/score/cpu/m68k/include/rtems/score/cpu.h     | 2 ++
 cpukit/score/cpu/mips/include/rtems/score/cpu.h     | 2 ++
 cpukit/score/cpu/moxie/include/rtems/score/cpu.h    | 2 ++
 cpukit/score/cpu/nios2/include/rtems/score/cpu.h    | 2 ++
 cpukit/score/cpu/no_cpu/include/rtems/score/cpu.h   | 8 ++++++++
 cpukit/score/cpu/or1k/include/rtems/score/cpu.h     | 2 ++
 cpukit/score/cpu/powerpc/include/rtems/score/cpu.h  | 2 ++
 cpukit/score/cpu/riscv/include/rtems/score/cpu.h    | 5 +++++
 cpukit/score/cpu/sh/include/rtems/score/cpu.h       | 2 ++
 cpukit/score/cpu/sparc/include/rtems/score/cpu.h    | 2 ++
 cpukit/score/cpu/sparc64/include/rtems/score/cpu.h  | 2 ++
 cpukit/score/cpu/v850/include/rtems/score/cpu.h     | 2 ++
 18 files changed, 45 insertions(+)

diff --git a/cpukit/score/cpu/arm/include/rtems/score/cpu.h b/cpukit/score/cpu/arm/include/rtems/score/cpu.h
index f5827b4..3f06c03 100644
--- a/cpukit/score/cpu/arm/include/rtems/score/cpu.h
+++ b/cpukit/score/cpu/arm/include/rtems/score/cpu.h
@@ -165,6 +165,8 @@
 /* AAPCS, section 5.2.1.2, Stack constraints at a public interface */
 #define CPU_STACK_ALIGNMENT 8
 
+#define CPU_INTERRUPT_STACK_ALIGNMENT CPU_CACHE_LINE_BYTES
+
 /*
  * Bitfield handler macros.
  *
diff --git a/cpukit/score/cpu/bfin/include/rtems/score/cpu.h b/cpukit/score/cpu/bfin/include/rtems/score/cpu.h
index a361e02..d3e4e4b 100644
--- a/cpukit/score/cpu/bfin/include/rtems/score/cpu.h
+++ b/cpukit/score/cpu/bfin/include/rtems/score/cpu.h
@@ -563,6 +563,8 @@ typedef struct {
  */
 #define CPU_STACK_ALIGNMENT        8
 
+#define CPU_INTERRUPT_STACK_ALIGNMENT CPU_CACHE_LINE_BYTES
+
 #ifndef ASM
 
 /*
diff --git a/cpukit/score/cpu/epiphany/include/rtems/score/cpu.h b/cpukit/score/cpu/epiphany/include/rtems/score/cpu.h
index 84565d1..65f28ac 100644
--- a/cpukit/score/cpu/epiphany/include/rtems/score/cpu.h
+++ b/cpukit/score/cpu/epiphany/include/rtems/score/cpu.h
@@ -465,6 +465,8 @@ typedef Context_Control CPU_Interrupt_frame;
 
 #define CPU_STACK_ALIGNMENT        8
 
+#define CPU_INTERRUPT_STACK_ALIGNMENT CPU_CACHE_LINE_BYTES
+
 /* ISR handler macros */
 
 /*
diff --git a/cpukit/score/cpu/i386/include/rtems/score/cpu.h b/cpukit/score/cpu/i386/include/rtems/score/cpu.h
index 72ba77d..c22b42e 100644
--- a/cpukit/score/cpu/i386/include/rtems/score/cpu.h
+++ b/cpukit/score/cpu/i386/include/rtems/score/cpu.h
@@ -383,6 +383,8 @@ extern Context_Control_fp _CPU_Null_fp_context;
 
 #define CPU_STACK_ALIGNMENT             16
 
+#define CPU_INTERRUPT_STACK_ALIGNMENT CPU_CACHE_LINE_BYTES
+
 /* macros */
 
 #ifndef ASM
diff --git a/cpukit/score/cpu/lm32/include/rtems/score/cpu.h b/cpukit/score/cpu/lm32/include/rtems/score/cpu.h
index fe8107c..77f3389 100644
--- a/cpukit/score/cpu/lm32/include/rtems/score/cpu.h
+++ b/cpukit/score/cpu/lm32/include/rtems/score/cpu.h
@@ -581,6 +581,8 @@ extern Context_Control_fp _CPU_Null_fp_context;
  */
 #define CPU_STACK_ALIGNMENT        CPU_ALIGNMENT
 
+#define CPU_INTERRUPT_STACK_ALIGNMENT CPU_CACHE_LINE_BYTES
+
 /*
  *  ISR handler macros
  */
diff --git a/cpukit/score/cpu/m32c/include/rtems/score/cpu.h b/cpukit/score/cpu/m32c/include/rtems/score/cpu.h
index c5486e8..3f23c21 100644
--- a/cpukit/score/cpu/m32c/include/rtems/score/cpu.h
+++ b/cpukit/score/cpu/m32c/include/rtems/score/cpu.h
@@ -556,6 +556,8 @@ typedef struct {
  */
 #define CPU_STACK_ALIGNMENT        0
 
+#define CPU_INTERRUPT_STACK_ALIGNMENT CPU_CACHE_LINE_BYTES
+
 /*
  *  ISR handler macros
  */
diff --git a/cpukit/score/cpu/m68k/include/rtems/score/cpu.h b/cpukit/score/cpu/m68k/include/rtems/score/cpu.h
index 52795d6..1b1b460 100644
--- a/cpukit/score/cpu/m68k/include/rtems/score/cpu.h
+++ b/cpukit/score/cpu/m68k/include/rtems/score/cpu.h
@@ -354,6 +354,8 @@ extern void*                     _VBR;
 
 #define CPU_STACK_ALIGNMENT        0
 
+#define CPU_INTERRUPT_STACK_ALIGNMENT CPU_CACHE_LINE_BYTES
+
 #ifndef ASM
 
 /* macros */
diff --git a/cpukit/score/cpu/mips/include/rtems/score/cpu.h b/cpukit/score/cpu/mips/include/rtems/score/cpu.h
index 46d1eb2..c20e5f4 100644
--- a/cpukit/score/cpu/mips/include/rtems/score/cpu.h
+++ b/cpukit/score/cpu/mips/include/rtems/score/cpu.h
@@ -631,6 +631,8 @@ extern Context_Control_fp _CPU_Null_fp_context;
 
 #define CPU_STACK_ALIGNMENT        CPU_ALIGNMENT
 
+#define CPU_INTERRUPT_STACK_ALIGNMENT CPU_CACHE_LINE_BYTES
+
 void mips_vector_exceptions( CPU_Interrupt_frame *frame );
 
 /*
diff --git a/cpukit/score/cpu/moxie/include/rtems/score/cpu.h b/cpukit/score/cpu/moxie/include/rtems/score/cpu.h
index 403b05f..9b6dbec 100644
--- a/cpukit/score/cpu/moxie/include/rtems/score/cpu.h
+++ b/cpukit/score/cpu/moxie/include/rtems/score/cpu.h
@@ -465,6 +465,8 @@ typedef struct {
  */
 #define CPU_STACK_ALIGNMENT        0
 
+#define CPU_INTERRUPT_STACK_ALIGNMENT CPU_CACHE_LINE_BYTES
+
 /*
  *  ISR handler macros
  */
diff --git a/cpukit/score/cpu/nios2/include/rtems/score/cpu.h b/cpukit/score/cpu/nios2/include/rtems/score/cpu.h
index 1d088ed..3cc56e5 100644
--- a/cpukit/score/cpu/nios2/include/rtems/score/cpu.h
+++ b/cpukit/score/cpu/nios2/include/rtems/score/cpu.h
@@ -87,6 +87,8 @@ extern "C" {
  */
 #define CPU_STACK_ALIGNMENT 4
 
+#define CPU_INTERRUPT_STACK_ALIGNMENT CPU_CACHE_LINE_BYTES
+
 /*
  * A Nios II configuration with an external interrupt controller (EIC) supports
  * up to 64 interrupt levels.  A Nios II configuration with an internal
diff --git a/cpukit/score/cpu/no_cpu/include/rtems/score/cpu.h b/cpukit/score/cpu/no_cpu/include/rtems/score/cpu.h
index 45edbaa..c843e26 100644
--- a/cpukit/score/cpu/no_cpu/include/rtems/score/cpu.h
+++ b/cpukit/score/cpu/no_cpu/include/rtems/score/cpu.h
@@ -695,6 +695,14 @@ extern Context_Control_fp _CPU_Null_fp_context;
  */
 #define CPU_STACK_ALIGNMENT        0
 
+/**
+ * The alignment of the interrupt stack in bytes.
+ *
+ * The alignment should take the stack ABI and the cache line size into
+ * account.
+ */
+#define CPU_INTERRUPT_STACK_ALIGNMENT CPU_CACHE_LINE_BYTES
+
 /*
  *  ISR handler macros
  */
diff --git a/cpukit/score/cpu/or1k/include/rtems/score/cpu.h b/cpukit/score/cpu/or1k/include/rtems/score/cpu.h
index 1dedeb6..4f8df4a 100644
--- a/cpukit/score/cpu/or1k/include/rtems/score/cpu.h
+++ b/cpukit/score/cpu/or1k/include/rtems/score/cpu.h
@@ -462,6 +462,8 @@ typedef Context_Control CPU_Interrupt_frame;
 
 #define CPU_STACK_ALIGNMENT        0
 
+#define CPU_INTERRUPT_STACK_ALIGNMENT CPU_CACHE_LINE_BYTES
+
 /* ISR handler macros */
 
 /*
diff --git a/cpukit/score/cpu/powerpc/include/rtems/score/cpu.h b/cpukit/score/cpu/powerpc/include/rtems/score/cpu.h
index 6c663cd..65f31dd 100644
--- a/cpukit/score/cpu/powerpc/include/rtems/score/cpu.h
+++ b/cpukit/score/cpu/powerpc/include/rtems/score/cpu.h
@@ -761,6 +761,8 @@ void ppc_set_interrupt_level( uint32_t level );
 
 #define CPU_STACK_ALIGNMENT        (PPC_STACK_ALIGNMENT)
 
+#define CPU_INTERRUPT_STACK_ALIGNMENT CPU_CACHE_LINE_BYTES
+
 #ifndef ASM
 /*  The following routine swaps the endian format of an unsigned int.
  *  It must be static because it is referenced indirectly.
diff --git a/cpukit/score/cpu/riscv/include/rtems/score/cpu.h b/cpukit/score/cpu/riscv/include/rtems/score/cpu.h
index 663dd09..2b3b609 100644
--- a/cpukit/score/cpu/riscv/include/rtems/score/cpu.h
+++ b/cpukit/score/cpu/riscv/include/rtems/score/cpu.h
@@ -137,6 +137,8 @@ typedef Context_Control CPU_Interrupt_frame;
 #define CPU_CONTEXT_FP_SIZE  0
 Context_Control_fp  _CPU_Null_fp_context;
 
+#define CPU_CACHE_LINE_BYTES 64
+
 #define CPU_MPCI_RECEIVE_SERVER_EXTRA_STACK 0
 #if __riscv_xlen == 32
 #define CPU_STACK_MINIMUM_SIZE  4096
@@ -148,6 +150,9 @@ Context_Control_fp  _CPU_Null_fp_context;
 #define CPU_HEAP_ALIGNMENT         CPU_ALIGNMENT
 #define CPU_PARTITION_ALIGNMENT    CPU_ALIGNMENT
 #define CPU_STACK_ALIGNMENT        8
+
+#define CPU_INTERRUPT_STACK_ALIGNMENT CPU_CACHE_LINE_BYTES
+
 #define _CPU_Initialize_vectors()
 
 /*
diff --git a/cpukit/score/cpu/sh/include/rtems/score/cpu.h b/cpukit/score/cpu/sh/include/rtems/score/cpu.h
index 79453bc..d3c9bc6 100644
--- a/cpukit/score/cpu/sh/include/rtems/score/cpu.h
+++ b/cpukit/score/cpu/sh/include/rtems/score/cpu.h
@@ -438,6 +438,8 @@ void CPU_delay( uint32_t   microseconds );
 
 #define CPU_STACK_ALIGNMENT        CPU_ALIGNMENT
 
+#define CPU_INTERRUPT_STACK_ALIGNMENT CPU_CACHE_LINE_BYTES
+
 /*
  *  ISR handler macros
  */
diff --git a/cpukit/score/cpu/sparc/include/rtems/score/cpu.h b/cpukit/score/cpu/sparc/include/rtems/score/cpu.h
index 76c8e42..16618e7 100644
--- a/cpukit/score/cpu/sparc/include/rtems/score/cpu.h
+++ b/cpukit/score/cpu/sparc/include/rtems/score/cpu.h
@@ -823,6 +823,8 @@ extern const CPU_Trap_table_entry _CPU_Trap_slot_template;
  */
 #define CPU_STACK_ALIGNMENT CPU_ALIGNMENT
 
+#define CPU_INTERRUPT_STACK_ALIGNMENT CPU_CACHE_LINE_BYTES
+
 #ifndef ASM
 
 /*
diff --git a/cpukit/score/cpu/sparc64/include/rtems/score/cpu.h b/cpukit/score/cpu/sparc64/include/rtems/score/cpu.h
index f1412e0..feb7752 100644
--- a/cpukit/score/cpu/sparc64/include/rtems/score/cpu.h
+++ b/cpukit/score/cpu/sparc64/include/rtems/score/cpu.h
@@ -709,6 +709,8 @@ extern const CPU_Trap_table_entry _CPU_Trap_slot_template;
 
 #define CPU_STACK_ALIGNMENT        16
 
+#define CPU_INTERRUPT_STACK_ALIGNMENT CPU_CACHE_LINE_BYTES
+
 #ifndef ASM
 
 /*
diff --git a/cpukit/score/cpu/v850/include/rtems/score/cpu.h b/cpukit/score/cpu/v850/include/rtems/score/cpu.h
index 5c65f85..dbae3c4 100644
--- a/cpukit/score/cpu/v850/include/rtems/score/cpu.h
+++ b/cpukit/score/cpu/v850/include/rtems/score/cpu.h
@@ -524,6 +524,8 @@ typedef struct {
  */
 #define CPU_STACK_ALIGNMENT        4
 
+#define CPU_INTERRUPT_STACK_ALIGNMENT CPU_CACHE_LINE_BYTES
+
 /*
  *  ISR handler macros
  */




More information about the vc mailing list