Add CPU_CACHE_LINE_BYTES for the maximum cache line size in bytes. The actual processor may use no cache or a smaller cache line size. --- cpukit/score/cpu/arm/rtems/score/cpu.h | 6 ++++-- cpukit/score/cpu/bfin/rtems/score/cpu.h | 26 +++----------------------- cpukit/score/cpu/epiphany/rtems/score/cpu.h | 24 +++--------------------- cpukit/score/cpu/i386/rtems/score/cpu.h | 4 ++++ cpukit/score/cpu/lm32/rtems/score/cpu.h | 28 ++++------------------------ cpukit/score/cpu/m32c/rtems/score/cpu.h | 28 ++++------------------------ cpukit/score/cpu/m68k/rtems/score/cpu.h | 6 +++++- cpukit/score/cpu/mips/rtems/score/cpu.h | 28 +++------------------------- cpukit/score/cpu/moxie/rtems/score/cpu.h | 26 +++----------------------- cpukit/score/cpu/nios2/rtems/score/cpu.h | 6 +++++- cpukit/score/cpu/no_cpu/rtems/score/cpu.h | 21 ++++++++------------- cpukit/score/cpu/or1k/rtems/score/cpu.h | 24 +++--------------------- cpukit/score/cpu/powerpc/rtems/score/cpu.h | 23 ++--------------------- cpukit/score/cpu/sh/rtems/score/cpu.h | 23 +++-------------------- cpukit/score/cpu/sparc/rtems/score/cpu.h | 15 ++++----------- cpukit/score/cpu/sparc64/rtems/score/cpu.h | 5 ++++- cpukit/score/cpu/v850/rtems/score/cpu.h | 26 +++----------------------- 17 files changed, 65 insertions(+), 254 deletions(-)
diff --git a/cpukit/score/cpu/arm/rtems/score/cpu.h b/cpukit/score/cpu/arm/rtems/score/cpu.h index 089d4293..89b7609 100644 --- a/cpukit/score/cpu/arm/rtems/score/cpu.h +++ b/cpukit/score/cpu/arm/rtems/score/cpu.h @@ -144,8 +144,10 @@ #define CPU_STACK_GROWS_UP FALSE -/* XXX Why 32? */ -#define CPU_STRUCTURE_ALIGNMENT __attribute__ ((aligned (32))) +/* FIXME: Is this the right value? */ +#define CPU_CACHE_LINE_BYTES 32 + +#define CPU_STRUCTURE_ALIGNMENT RTEMS_ALIGNED( CPU_CACHE_LINE_BYTES ) /* * The interrupt mask disables only normal interrupts (IRQ). diff --git a/cpukit/score/cpu/bfin/rtems/score/cpu.h b/cpukit/score/cpu/bfin/rtems/score/cpu.h index 8257383..f4da07d 100644 --- a/cpukit/score/cpu/bfin/rtems/score/cpu.h +++ b/cpukit/score/cpu/bfin/rtems/score/cpu.h @@ -295,29 +295,9 @@ extern "C" { */ #define CPU_STACK_GROWS_UP FALSE -/** - * The following is the variable attribute used to force alignment - * of critical RTEMS structures. On some processors it may make - * sense to have these aligned on tighter boundaries than - * the minimum requirements of the compiler in order to have as - * much of the critical data area as possible in a cache line. - * - * The placement of this macro in the declaration of the variables - * is based on the syntactically requirements of the GNU C - * "__attribute__" extension. For example with GNU C, use - * the following to force a structures to a 32 byte boundary. - * - * __attribute__ ((aligned (32))) - * - * @note Currently only the Priority Bit Map table uses this feature. - * To benefit from using this, the data must be heavily - * used so it will stay in the cache and used frequently enough - * in the executive to justify turning this on. - * - * Port Specific Information: - * - * XXX document implementation including references if appropriate - */ +/* FIXME: Is this the right value? */ +#define CPU_CACHE_LINE_BYTES 32 + #define CPU_STRUCTURE_ALIGNMENT /** diff --git a/cpukit/score/cpu/epiphany/rtems/score/cpu.h b/cpukit/score/cpu/epiphany/rtems/score/cpu.h index 967b802..aa786cd 100644 --- a/cpukit/score/cpu/epiphany/rtems/score/cpu.h +++ b/cpukit/score/cpu/epiphany/rtems/score/cpu.h @@ -260,28 +260,10 @@ extern "C" { #define CPU_STACK_GROWS_UP FALSE -/* - * The following is the variable attribute used to force alignment - * of critical RTEMS structures. On some processors it may make - * sense to have these aligned on tighter boundaries than - * the minimum requirements of the compiler in order to have as - * much of the critical data area as possible in a cache line. - * - * The placement of this macro in the declaration of the variables - * is based on the syntactically requirements of the GNU C - * "__attribute__" extension. For example with GNU C, use - * the following to force a structures to a 32 byte boundary. - * - * __attribute__ ((aligned (32))) - * - * NOTE: Currently only the Priority Bit Map table uses this feature. - * To benefit from using this, the data must be heavily - * used so it will stay in the cache and used frequently enough - * in the executive to justify turning this on. - * - */ +/* FIXME: Is this the right value? */ +#define CPU_CACHE_LINE_BYTES 64 -#define CPU_STRUCTURE_ALIGNMENT __attribute__ ((aligned (64))) +#define CPU_STRUCTURE_ALIGNMENT RTEMS_ALIGNED( CPU_CACHE_LINE_BYTES ) /* * Define what is required to specify how the network to host conversion diff --git a/cpukit/score/cpu/i386/rtems/score/cpu.h b/cpukit/score/cpu/i386/rtems/score/cpu.h index 8a49597..5a8e5d6 100644 --- a/cpukit/score/cpu/i386/rtems/score/cpu.h +++ b/cpukit/score/cpu/i386/rtems/score/cpu.h @@ -100,6 +100,10 @@ extern "C" { #endif /* __SSE__ */ #define CPU_STACK_GROWS_UP FALSE + +/* FIXME: The Pentium 4 used 128 bytes, it this processor still relevant? */ +#define CPU_CACHE_LINE_BYTES 64 + #define CPU_STRUCTURE_ALIGNMENT /* diff --git a/cpukit/score/cpu/lm32/rtems/score/cpu.h b/cpukit/score/cpu/lm32/rtems/score/cpu.h index 1a61475..dd0ec47 100644 --- a/cpukit/score/cpu/lm32/rtems/score/cpu.h +++ b/cpukit/score/cpu/lm32/rtems/score/cpu.h @@ -289,30 +289,10 @@ extern "C" { */ #define CPU_STACK_GROWS_UP FALSE -/** - * The following is the variable attribute used to force alignment - * of critical RTEMS structures. On some processors it may make - * sense to have these aligned on tighter boundaries than - * the minimum requirements of the compiler in order to have as - * much of the critical data area as possible in a cache line. - * - * The placement of this macro in the declaration of the variables - * is based on the syntactically requirements of the GNU C - * "__attribute__" extension. For example with GNU C, use - * the following to force a structures to a 32 byte boundary. - * - * __attribute__ ((aligned (32))) - * - * NOTE: Currently only the Priority Bit Map table uses this feature. - * To benefit from using this, the data must be heavily - * used so it will stay in the cache and used frequently enough - * in the executive to justify turning this on. - * - * Port Specific Information: - * - * L2 cache lines are 32 bytes in Milkymist SoC - */ -#define CPU_STRUCTURE_ALIGNMENT __attribute__ ((aligned (32))) +/* L2 cache lines are 32 bytes in Milkymist SoC */ +#define CPU_CACHE_LINE_BYTES 32 + +#define CPU_STRUCTURE_ALIGNMENT RTEMS_ALIGNED( CPU_CACHE_LINE_BYTES ) /** * @defgroup CPUEndian Processor Dependent Endianness Support diff --git a/cpukit/score/cpu/m32c/rtems/score/cpu.h b/cpukit/score/cpu/m32c/rtems/score/cpu.h index 6819c82..59e9b4e 100644 --- a/cpukit/score/cpu/m32c/rtems/score/cpu.h +++ b/cpukit/score/cpu/m32c/rtems/score/cpu.h @@ -311,30 +311,10 @@ extern "C" { */ #define CPU_STACK_GROWS_UP TRUE -/** - * The following is the variable attribute used to force alignment - * of critical RTEMS structures. On some processors it may make - * sense to have these aligned on tighter boundaries than - * the minimum requirements of the compiler in order to have as - * much of the critical data area as possible in a cache line. - * - * The placement of this macro in the declaration of the variables - * is based on the syntactically requirements of the GNU C - * "__attribute__" extension. For example with GNU C, use - * the following to force a structures to a 32 byte boundary. - * - * __attribute__ ((aligned (32))) - * - * NOTE: Currently only the Priority Bit Map table uses this feature. - * To benefit from using this, the data must be heavily - * used so it will stay in the cache and used frequently enough - * in the executive to justify turning this on. - * - * Port Specific Information: - * - * XXX document implementation including references if appropriate - */ -#define CPU_STRUCTURE_ALIGNMENT __attribute__ ((aligned (2))) +/* FIXME: Is this the right value? */ +#define CPU_CACHE_LINE_BYTES 2 + +#define CPU_STRUCTURE_ALIGNMENT RTEMS_ALIGNED( CPU_CACHE_LINE_BYTES ) /** * @defgroup CPUEndian Processor Dependent Endianness Support diff --git a/cpukit/score/cpu/m68k/rtems/score/cpu.h b/cpukit/score/cpu/m68k/rtems/score/cpu.h index 47a2d8e..8e0efa1 100644 --- a/cpukit/score/cpu/m68k/rtems/score/cpu.h +++ b/cpukit/score/cpu/m68k/rtems/score/cpu.h @@ -99,7 +99,11 @@ extern "C" { #define CPU_PROVIDES_IDLE_THREAD_BODY TRUE #define CPU_STACK_GROWS_UP FALSE -#define CPU_STRUCTURE_ALIGNMENT __attribute__ ((aligned (4))) + +/* FIXME: Is this the right value? */ +#define CPU_CACHE_LINE_BYTES 16 + +#define CPU_STRUCTURE_ALIGNMENT RTEMS_ALIGNED( CPU_CACHE_LINE_BYTES ) /* * Define what is required to specify how the network to host conversion diff --git a/cpukit/score/cpu/mips/rtems/score/cpu.h b/cpukit/score/cpu/mips/rtems/score/cpu.h index bb897e1..01bd29a 100644 --- a/cpukit/score/cpu/mips/rtems/score/cpu.h +++ b/cpukit/score/cpu/mips/rtems/score/cpu.h @@ -280,32 +280,10 @@ extern "C" { /* our stack grows down */ #define CPU_STACK_GROWS_UP FALSE -/* - * The following is the variable attribute used to force alignment - * of critical RTEMS structures. On some processors it may make - * sense to have these aligned on tighter boundaries than - * the minimum requirements of the compiler in order to have as - * much of the critical data area as possible in a cache line. - * - * The placement of this macro in the declaration of the variables - * is based on the syntactically requirements of the GNU C - * "__attribute__" extension. For example with GNU C, use - * the following to force a structures to a 32 byte boundary. - * - * __attribute__ ((aligned (32))) - * - * NOTE: Currently only the Priority Bit Map table uses this feature. - * To benefit from using this, the data must be heavily - * used so it will stay in the cache and used frequently enough - * in the executive to justify turning this on. - */ +/* FIXME: Is this the right value? */ +#define CPU_CACHE_LINE_BYTES 16 -/* our cache line size is 16 bytes */ -#if __GNUC__ -#define CPU_STRUCTURE_ALIGNMENT __attribute__ ((aligned (16))) -#else -#define CPU_STRUCTURE_ALIGNMENT -#endif +#define CPU_STRUCTURE_ALIGNMENT RTEMS_ALIGNED( CPU_CACHE_LINE_BYTES ) /* * Define what is required to specify how the network to host conversion diff --git a/cpukit/score/cpu/moxie/rtems/score/cpu.h b/cpukit/score/cpu/moxie/rtems/score/cpu.h index 8348d48..4e4bbad 100644 --- a/cpukit/score/cpu/moxie/rtems/score/cpu.h +++ b/cpukit/score/cpu/moxie/rtems/score/cpu.h @@ -260,29 +260,9 @@ extern "C" { */ #define CPU_STACK_GROWS_UP FALSE -/* - * The following is the variable attribute used to force alignment - * of critical RTEMS structures. On some processors it may make - * sense to have these aligned on tighter boundaries than - * the minimum requirements of the compiler in order to have as - * much of the critical data area as possible in a cache line. - * - * The placement of this macro in the declaration of the variables - * is based on the syntactically requirements of the GNU C - * "__attribute__" extension. For example with GNU C, use - * the following to force a structures to a 32 byte boundary. - * - * __attribute__ ((aligned (32))) - * - * NOTE: Currently only the Priority Bit Map table uses this feature. - * To benefit from using this, the data must be heavily - * used so it will stay in the cache and used frequently enough - * in the executive to justify turning this on. - * - * MOXIE Specific Information: - * - * XXX - */ +/* FIXME: Is this the right value? */ +#define CPU_CACHE_LINE_BYTES 32 + #define CPU_STRUCTURE_ALIGNMENT /* diff --git a/cpukit/score/cpu/nios2/rtems/score/cpu.h b/cpukit/score/cpu/nios2/rtems/score/cpu.h index 4bd1fe7..1008865 100644 --- a/cpukit/score/cpu/nios2/rtems/score/cpu.h +++ b/cpukit/score/cpu/nios2/rtems/score/cpu.h @@ -64,7 +64,11 @@ extern "C" { #define CPU_STACK_GROWS_UP FALSE -#define CPU_STRUCTURE_ALIGNMENT __attribute__((section(".sdata"), aligned(32))) +/* FIXME: Is this the right value? */ +#define CPU_CACHE_LINE_BYTES 32 + +#define CPU_STRUCTURE_ALIGNMENT \ + RTEMS_SECTION( ".sdata" ) RTEMS_ALIGNED( CPU_CACHE_LINE_BYTES ) #define CPU_BIG_ENDIAN FALSE diff --git a/cpukit/score/cpu/no_cpu/rtems/score/cpu.h b/cpukit/score/cpu/no_cpu/rtems/score/cpu.h index ab81e64..67a725c 100644 --- a/cpukit/score/cpu/no_cpu/rtems/score/cpu.h +++ b/cpukit/score/cpu/no_cpu/rtems/score/cpu.h @@ -311,29 +311,24 @@ extern "C" { #define CPU_STACK_GROWS_UP TRUE /** + * The maximum cache line size in bytes. + * + * The actual processor may use no cache or a smaller cache line size. + */ +#define CPU_CACHE_LINE_BYTES 32 + +/** * The following is the variable attribute used to force alignment * of critical RTEMS structures. On some processors it may make * sense to have these aligned on tighter boundaries than * the minimum requirements of the compiler in order to have as * much of the critical data area as possible in a cache line. * - * The placement of this macro in the declaration of the variables - * is based on the syntactically requirements of the GNU C - * "__attribute__" extension. For example with GNU C, use - * the following to force a structures to a 32 byte boundary. - * - * __attribute__ ((aligned (32))) - * - * NOTE: Currently only the Priority Bit Map table uses this feature. - * To benefit from using this, the data must be heavily - * used so it will stay in the cache and used frequently enough - * in the executive to justify turning this on. - * * Port Specific Information: * * XXX document implementation including references if appropriate */ -#define CPU_STRUCTURE_ALIGNMENT +#define CPU_STRUCTURE_ALIGNMENT RTEMS_ALIGNED( CPU_CACHE_LINE_BYTES ) /** * @defgroup CPUEndian Processor Dependent Endianness Support diff --git a/cpukit/score/cpu/or1k/rtems/score/cpu.h b/cpukit/score/cpu/or1k/rtems/score/cpu.h index c9b833c..2405844 100644 --- a/cpukit/score/cpu/or1k/rtems/score/cpu.h +++ b/cpukit/score/cpu/or1k/rtems/score/cpu.h @@ -252,28 +252,10 @@ extern "C" { #define CPU_STACK_GROWS_UP FALSE -/* - * The following is the variable attribute used to force alignment - * of critical RTEMS structures. On some processors it may make - * sense to have these aligned on tighter boundaries than - * the minimum requirements of the compiler in order to have as - * much of the critical data area as possible in a cache line. - * - * The placement of this macro in the declaration of the variables - * is based on the syntactically requirements of the GNU C - * "__attribute__" extension. For example with GNU C, use - * the following to force a structures to a 32 byte boundary. - * - * __attribute__ ((aligned (32))) - * - * NOTE: Currently only the Priority Bit Map table uses this feature. - * To benefit from using this, the data must be heavily - * used so it will stay in the cache and used frequently enough - * in the executive to justify turning this on. - * - */ +/* FIXME: Is this the right value? */ +#define CPU_CACHE_LINE_BYTES 32 -#define CPU_STRUCTURE_ALIGNMENT __attribute__ ((aligned (32))) +#define CPU_STRUCTURE_ALIGNMENT RTEMS_ALIGNED( CPU_CACHE_LINE_BYTES ) /* * Define what is required to specify how the network to host conversion diff --git a/cpukit/score/cpu/powerpc/rtems/score/cpu.h b/cpukit/score/cpu/powerpc/rtems/score/cpu.h index 5e822e4..f988f8a 100644 --- a/cpukit/score/cpu/powerpc/rtems/score/cpu.h +++ b/cpukit/score/cpu/powerpc/rtems/score/cpu.h @@ -101,28 +101,9 @@ extern "C" { #define CPU_STACK_GROWS_UP FALSE -/* - * The following is the variable attribute used to force alignment - * of critical RTEMS structures. On some processors it may make - * sense to have these aligned on tighter boundaries than - * the minimum requirements of the compiler in order to have as - * much of the critical data area as possible in a cache line. - * - * The placement of this macro in the declaration of the variables - * is based on the syntactically requirements of the GNU C - * "__attribute__" extension. For example with GNU C, use - * the following to force a structures to a 32 byte boundary. - * - * __attribute__ ((aligned (32))) - * - * NOTE: Currently only the Priority Bit Map table uses this feature. - * To benefit from using this, the data must be heavily - * used so it will stay in the cache and used frequently enough - * in the executive to justify turning this on. - */ +#define CPU_CACHE_LINE_BYTES PPC_STRUCTURE_ALIGNMENT -#define CPU_STRUCTURE_ALIGNMENT \ - __attribute__ ((aligned (PPC_STRUCTURE_ALIGNMENT))) +#define CPU_STRUCTURE_ALIGNMENT RTEMS_ALIGNED( CPU_CACHE_LINE_BYTES ) /* * Define what is required to specify how the network to host conversion diff --git a/cpukit/score/cpu/sh/rtems/score/cpu.h b/cpukit/score/cpu/sh/rtems/score/cpu.h index bf12220..43d1915 100644 --- a/cpukit/score/cpu/sh/rtems/score/cpu.h +++ b/cpukit/score/cpu/sh/rtems/score/cpu.h @@ -229,27 +229,10 @@ extern "C" { #define CPU_STACK_GROWS_UP FALSE -/* - * The following is the variable attribute used to force alignment - * of critical RTEMS structures. On some processors it may make - * sense to have these aligned on tighter boundaries than - * the minimum requirements of the compiler in order to have as - * much of the critical data area as possible in a cache line. - * - * The placement of this macro in the declaration of the variables - * is based on the syntactically requirements of the GNU C - * "__attribute__" extension. For example with GNU C, use - * the following to force a structures to a 32 byte boundary. - * - * __attribute__ ((aligned (32))) - * - * NOTE: Currently only the Priority Bit Map table uses this feature. - * To benefit from using this, the data must be heavily - * used so it will stay in the cache and used frequently enough - * in the executive to justify turning this on. - */ +/* FIXME: Is this the right value? */ +#define CPU_CACHE_LINE_BYTES 16 -#define CPU_STRUCTURE_ALIGNMENT __attribute__ ((aligned(16))) +#define CPU_STRUCTURE_ALIGNMENT RTEMS_ALIGNED( CPU_CACHE_LINE_BYTES ) /* * Define what is required to specify how the network to host conversion diff --git a/cpukit/score/cpu/sparc/rtems/score/cpu.h b/cpukit/score/cpu/sparc/rtems/score/cpu.h index 9b4db13..4170cb9 100644 --- a/cpukit/score/cpu/sparc/rtems/score/cpu.h +++ b/cpukit/score/cpu/sparc/rtems/score/cpu.h @@ -210,17 +210,10 @@ extern "C" { */ #define CPU_STACK_GROWS_UP FALSE -/** - * The following is the variable attribute used to force alignment - * of critical data structures. On some processors it may make - * sense to have these aligned on tighter boundaries than - * the minimum requirements of the compiler in order to have as - * much of the critical data area as possible in a cache line. - * - * The SPARC does not appear to have particularly strict alignment - * requirements. This value was chosen to take advantages of caches. - */ -#define CPU_STRUCTURE_ALIGNMENT __attribute__ ((aligned (32))) +/* FIXME: Is this the right value? */ +#define CPU_CACHE_LINE_BYTES 32 + +#define CPU_STRUCTURE_ALIGNMENT RTEMS_ALIGNED( CPU_CACHE_LINE_BYTES ) /** * Define what is required to specify how the network to host conversion diff --git a/cpukit/score/cpu/sparc64/rtems/score/cpu.h b/cpukit/score/cpu/sparc64/rtems/score/cpu.h index 4838cac..80c3466 100644 --- a/cpukit/score/cpu/sparc64/rtems/score/cpu.h +++ b/cpukit/score/cpu/sparc64/rtems/score/cpu.h @@ -170,6 +170,9 @@ extern "C" { #define CPU_STACK_GROWS_UP FALSE +/* FIXME: Is this the right value? */ +#define CPU_CACHE_LINE_BYTES 32 + /* * The following is the variable attribute used to force alignment * of critical data structures. On some processors it may make @@ -184,7 +187,7 @@ extern "C" { * and is 16 if quad-word fp instructions are available (e.g. LDQF). */ -#define CPU_STRUCTURE_ALIGNMENT __attribute__ ((aligned (16))) +#define CPU_STRUCTURE_ALIGNMENT RTEMS_ALIGNED( 16 ) /* * Define what is required to specify how the network to host conversion diff --git a/cpukit/score/cpu/v850/rtems/score/cpu.h b/cpukit/score/cpu/v850/rtems/score/cpu.h index b2b9fc1..e910ae1 100644 --- a/cpukit/score/cpu/v850/rtems/score/cpu.h +++ b/cpukit/score/cpu/v850/rtems/score/cpu.h @@ -289,29 +289,9 @@ extern "C" { */ #define CPU_STACK_GROWS_UP FALSE -/** - * The following is the variable attribute used to force alignment - * of critical RTEMS structures. On some processors it may make - * sense to have these aligned on tighter boundaries than - * the minimum requirements of the compiler in order to have as - * much of the critical data area as possible in a cache line. - * - * The placement of this macro in the declaration of the variables - * is based on the syntactically requirements of the GNU C - * "__attribute__" extension. For example with GNU C, use - * the following to force a structures to a 32 byte boundary. - * - * __attribute__ ((aligned (32))) - * - * @note Currently only the Priority Bit Map table uses this feature. - * To benefit from using this, the data must be heavily - * used so it will stay in the cache and used frequently enough - * in the executive to justify turning this on. - * - * Port Specific Information: - * - * Until proven otherwise, use the compiler default. - */ +/* FIXME: Is this the right value? */ +#define CPU_CACHE_LINE_BYTES 32 + #define CPU_STRUCTURE_ALIGNMENT /** -- 1.8.4.5 _______________________________________________ devel mailing list devel@rtems.org http://lists.rtems.org/mailman/listinfo/devel