[rtems commit] score: Add _CPU_Instruction_no_operation()
Sebastian Huber
sebh at rtems.org
Tue Jul 24 07:13:39 UTC 2018
Module: rtems
Branch: master
Commit: b74353ef9cadda401f7637beeb56f7f8a2092a43
Changeset: http://git.rtems.org/rtems/commit/?id=b74353ef9cadda401f7637beeb56f7f8a2092a43
Author: Sebastian Huber <sebastian.huber at embedded-brains.de>
Date: Fri Jul 20 08:06:46 2018 +0200
score: Add _CPU_Instruction_no_operation()
This helps to reduce the use of architecture-specific defines throughout
the code base.
---
cpukit/score/cpu/arm/include/rtems/score/cpuimpl.h | 5 +++++
cpukit/score/cpu/bfin/include/rtems/score/cpuimpl.h | 5 +++++
cpukit/score/cpu/epiphany/include/rtems/score/cpuimpl.h | 5 +++++
cpukit/score/cpu/i386/include/rtems/score/cpuimpl.h | 5 +++++
cpukit/score/cpu/lm32/include/rtems/score/cpuimpl.h | 5 +++++
cpukit/score/cpu/m32c/include/rtems/score/cpuimpl.h | 5 +++++
cpukit/score/cpu/m68k/include/rtems/score/cpuimpl.h | 5 +++++
cpukit/score/cpu/mips/include/rtems/score/cpuimpl.h | 5 +++++
cpukit/score/cpu/moxie/include/rtems/score/cpuimpl.h | 5 +++++
cpukit/score/cpu/nios2/include/rtems/score/cpuimpl.h | 5 +++++
cpukit/score/cpu/no_cpu/include/rtems/score/cpuimpl.h | 10 ++++++++++
cpukit/score/cpu/or1k/include/rtems/score/cpuimpl.h | 5 +++++
cpukit/score/cpu/powerpc/include/rtems/score/cpuimpl.h | 5 +++++
cpukit/score/cpu/riscv/include/rtems/score/cpuimpl.h | 5 +++++
cpukit/score/cpu/sh/include/rtems/score/cpuimpl.h | 5 +++++
cpukit/score/cpu/sparc/include/rtems/score/cpuimpl.h | 5 +++++
cpukit/score/cpu/sparc64/include/rtems/score/cpuimpl.h | 5 +++++
cpukit/score/cpu/v850/include/rtems/score/cpuimpl.h | 5 +++++
cpukit/score/cpu/x86_64/include/rtems/score/cpuimpl.h | 5 +++++
testsuites/sptests/spcache01/init.c | 7 ++-----
20 files changed, 102 insertions(+), 5 deletions(-)
diff --git a/cpukit/score/cpu/arm/include/rtems/score/cpuimpl.h b/cpukit/score/cpu/arm/include/rtems/score/cpuimpl.h
index edc4525..d007a79 100644
--- a/cpukit/score/cpu/arm/include/rtems/score/cpuimpl.h
+++ b/cpukit/score/cpu/arm/include/rtems/score/cpuimpl.h
@@ -106,6 +106,11 @@ void _CPU_Context_volatile_clobber( uintptr_t pattern );
void _CPU_Context_validate( uintptr_t pattern );
+RTEMS_INLINE_ROUTINE void _CPU_Instruction_no_operation( void )
+{
+ __asm__ volatile ( "nop" );
+}
+
#ifdef __cplusplus
}
#endif
diff --git a/cpukit/score/cpu/bfin/include/rtems/score/cpuimpl.h b/cpukit/score/cpu/bfin/include/rtems/score/cpuimpl.h
index ee188be..5d8bd77 100644
--- a/cpukit/score/cpu/bfin/include/rtems/score/cpuimpl.h
+++ b/cpukit/score/cpu/bfin/include/rtems/score/cpuimpl.h
@@ -37,6 +37,11 @@ RTEMS_INLINE_ROUTINE void _CPU_Context_validate( uintptr_t pattern )
}
}
+RTEMS_INLINE_ROUTINE void _CPU_Instruction_no_operation( void )
+{
+ __asm__ volatile ( "nop" );
+}
+
#ifdef __cplusplus
}
#endif
diff --git a/cpukit/score/cpu/epiphany/include/rtems/score/cpuimpl.h b/cpukit/score/cpu/epiphany/include/rtems/score/cpuimpl.h
index ee188be..5d8bd77 100644
--- a/cpukit/score/cpu/epiphany/include/rtems/score/cpuimpl.h
+++ b/cpukit/score/cpu/epiphany/include/rtems/score/cpuimpl.h
@@ -37,6 +37,11 @@ RTEMS_INLINE_ROUTINE void _CPU_Context_validate( uintptr_t pattern )
}
}
+RTEMS_INLINE_ROUTINE void _CPU_Instruction_no_operation( void )
+{
+ __asm__ volatile ( "nop" );
+}
+
#ifdef __cplusplus
}
#endif
diff --git a/cpukit/score/cpu/i386/include/rtems/score/cpuimpl.h b/cpukit/score/cpu/i386/include/rtems/score/cpuimpl.h
index ee188be..5d8bd77 100644
--- a/cpukit/score/cpu/i386/include/rtems/score/cpuimpl.h
+++ b/cpukit/score/cpu/i386/include/rtems/score/cpuimpl.h
@@ -37,6 +37,11 @@ RTEMS_INLINE_ROUTINE void _CPU_Context_validate( uintptr_t pattern )
}
}
+RTEMS_INLINE_ROUTINE void _CPU_Instruction_no_operation( void )
+{
+ __asm__ volatile ( "nop" );
+}
+
#ifdef __cplusplus
}
#endif
diff --git a/cpukit/score/cpu/lm32/include/rtems/score/cpuimpl.h b/cpukit/score/cpu/lm32/include/rtems/score/cpuimpl.h
index ee188be..5d8bd77 100644
--- a/cpukit/score/cpu/lm32/include/rtems/score/cpuimpl.h
+++ b/cpukit/score/cpu/lm32/include/rtems/score/cpuimpl.h
@@ -37,6 +37,11 @@ RTEMS_INLINE_ROUTINE void _CPU_Context_validate( uintptr_t pattern )
}
}
+RTEMS_INLINE_ROUTINE void _CPU_Instruction_no_operation( void )
+{
+ __asm__ volatile ( "nop" );
+}
+
#ifdef __cplusplus
}
#endif
diff --git a/cpukit/score/cpu/m32c/include/rtems/score/cpuimpl.h b/cpukit/score/cpu/m32c/include/rtems/score/cpuimpl.h
index ee188be..5d8bd77 100644
--- a/cpukit/score/cpu/m32c/include/rtems/score/cpuimpl.h
+++ b/cpukit/score/cpu/m32c/include/rtems/score/cpuimpl.h
@@ -37,6 +37,11 @@ RTEMS_INLINE_ROUTINE void _CPU_Context_validate( uintptr_t pattern )
}
}
+RTEMS_INLINE_ROUTINE void _CPU_Instruction_no_operation( void )
+{
+ __asm__ volatile ( "nop" );
+}
+
#ifdef __cplusplus
}
#endif
diff --git a/cpukit/score/cpu/m68k/include/rtems/score/cpuimpl.h b/cpukit/score/cpu/m68k/include/rtems/score/cpuimpl.h
index ee188be..5d8bd77 100644
--- a/cpukit/score/cpu/m68k/include/rtems/score/cpuimpl.h
+++ b/cpukit/score/cpu/m68k/include/rtems/score/cpuimpl.h
@@ -37,6 +37,11 @@ RTEMS_INLINE_ROUTINE void _CPU_Context_validate( uintptr_t pattern )
}
}
+RTEMS_INLINE_ROUTINE void _CPU_Instruction_no_operation( void )
+{
+ __asm__ volatile ( "nop" );
+}
+
#ifdef __cplusplus
}
#endif
diff --git a/cpukit/score/cpu/mips/include/rtems/score/cpuimpl.h b/cpukit/score/cpu/mips/include/rtems/score/cpuimpl.h
index ee188be..5d8bd77 100644
--- a/cpukit/score/cpu/mips/include/rtems/score/cpuimpl.h
+++ b/cpukit/score/cpu/mips/include/rtems/score/cpuimpl.h
@@ -37,6 +37,11 @@ RTEMS_INLINE_ROUTINE void _CPU_Context_validate( uintptr_t pattern )
}
}
+RTEMS_INLINE_ROUTINE void _CPU_Instruction_no_operation( void )
+{
+ __asm__ volatile ( "nop" );
+}
+
#ifdef __cplusplus
}
#endif
diff --git a/cpukit/score/cpu/moxie/include/rtems/score/cpuimpl.h b/cpukit/score/cpu/moxie/include/rtems/score/cpuimpl.h
index ee188be..5d8bd77 100644
--- a/cpukit/score/cpu/moxie/include/rtems/score/cpuimpl.h
+++ b/cpukit/score/cpu/moxie/include/rtems/score/cpuimpl.h
@@ -37,6 +37,11 @@ RTEMS_INLINE_ROUTINE void _CPU_Context_validate( uintptr_t pattern )
}
}
+RTEMS_INLINE_ROUTINE void _CPU_Instruction_no_operation( void )
+{
+ __asm__ volatile ( "nop" );
+}
+
#ifdef __cplusplus
}
#endif
diff --git a/cpukit/score/cpu/nios2/include/rtems/score/cpuimpl.h b/cpukit/score/cpu/nios2/include/rtems/score/cpuimpl.h
index 19afb25..a291aab 100644
--- a/cpukit/score/cpu/nios2/include/rtems/score/cpuimpl.h
+++ b/cpukit/score/cpu/nios2/include/rtems/score/cpuimpl.h
@@ -29,6 +29,11 @@ void _CPU_Context_volatile_clobber( uintptr_t pattern );
void _CPU_Context_validate( uintptr_t pattern );
+RTEMS_INLINE_ROUTINE void _CPU_Instruction_no_operation( void )
+{
+ __asm__ volatile ( "nop" );
+}
+
#ifdef __cplusplus
}
#endif
diff --git a/cpukit/score/cpu/no_cpu/include/rtems/score/cpuimpl.h b/cpukit/score/cpu/no_cpu/include/rtems/score/cpuimpl.h
index 1e970cb..c13180a 100644
--- a/cpukit/score/cpu/no_cpu/include/rtems/score/cpuimpl.h
+++ b/cpukit/score/cpu/no_cpu/include/rtems/score/cpuimpl.h
@@ -104,6 +104,16 @@ void _CPU_Context_volatile_clobber( uintptr_t pattern );
*/
void _CPU_Context_validate( uintptr_t pattern );
+/**
+ * @brief Emits a no operation instruction (nop).
+ *
+ * This function is used only in test sptests/spcache01.
+ */
+RTEMS_INLINE_ROUTINE void _CPU_Instruction_no_operation( void )
+{
+ __asm__ volatile ( "nop" );
+}
+
#ifdef __cplusplus
}
#endif
diff --git a/cpukit/score/cpu/or1k/include/rtems/score/cpuimpl.h b/cpukit/score/cpu/or1k/include/rtems/score/cpuimpl.h
index 19afb25..148e23c 100644
--- a/cpukit/score/cpu/or1k/include/rtems/score/cpuimpl.h
+++ b/cpukit/score/cpu/or1k/include/rtems/score/cpuimpl.h
@@ -29,6 +29,11 @@ void _CPU_Context_volatile_clobber( uintptr_t pattern );
void _CPU_Context_validate( uintptr_t pattern );
+RTEMS_INLINE_ROUTINE void _CPU_Instruction_no_operation( void )
+{
+ __asm__ volatile ( "l.nop" );
+}
+
#ifdef __cplusplus
}
#endif
diff --git a/cpukit/score/cpu/powerpc/include/rtems/score/cpuimpl.h b/cpukit/score/cpu/powerpc/include/rtems/score/cpuimpl.h
index 6dd8196..4f5efe5 100644
--- a/cpukit/score/cpu/powerpc/include/rtems/score/cpuimpl.h
+++ b/cpukit/score/cpu/powerpc/include/rtems/score/cpuimpl.h
@@ -242,6 +242,11 @@ void _CPU_Context_volatile_clobber( uintptr_t pattern );
void _CPU_Context_validate( uintptr_t pattern );
+RTEMS_INLINE_ROUTINE void _CPU_Instruction_no_operation( void )
+{
+ __asm__ volatile ( "nop" );
+}
+
#ifdef __cplusplus
}
#endif
diff --git a/cpukit/score/cpu/riscv/include/rtems/score/cpuimpl.h b/cpukit/score/cpu/riscv/include/rtems/score/cpuimpl.h
index 3c2e0d9..c6e1015 100644
--- a/cpukit/score/cpu/riscv/include/rtems/score/cpuimpl.h
+++ b/cpukit/score/cpu/riscv/include/rtems/score/cpuimpl.h
@@ -325,6 +325,11 @@ void _CPU_Context_volatile_clobber( uintptr_t pattern );
void _CPU_Context_validate( uintptr_t pattern );
+RTEMS_INLINE_ROUTINE void _CPU_Instruction_no_operation( void )
+{
+ __asm__ volatile ( "nop" );
+}
+
#ifdef __cplusplus
}
#endif
diff --git a/cpukit/score/cpu/sh/include/rtems/score/cpuimpl.h b/cpukit/score/cpu/sh/include/rtems/score/cpuimpl.h
index ee188be..5d8bd77 100644
--- a/cpukit/score/cpu/sh/include/rtems/score/cpuimpl.h
+++ b/cpukit/score/cpu/sh/include/rtems/score/cpuimpl.h
@@ -37,6 +37,11 @@ RTEMS_INLINE_ROUTINE void _CPU_Context_validate( uintptr_t pattern )
}
}
+RTEMS_INLINE_ROUTINE void _CPU_Instruction_no_operation( void )
+{
+ __asm__ volatile ( "nop" );
+}
+
#ifdef __cplusplus
}
#endif
diff --git a/cpukit/score/cpu/sparc/include/rtems/score/cpuimpl.h b/cpukit/score/cpu/sparc/include/rtems/score/cpuimpl.h
index 7b47b1f..93e5b45 100644
--- a/cpukit/score/cpu/sparc/include/rtems/score/cpuimpl.h
+++ b/cpukit/score/cpu/sparc/include/rtems/score/cpuimpl.h
@@ -150,6 +150,11 @@ void _CPU_Context_volatile_clobber( uintptr_t pattern );
void _CPU_Context_validate( uintptr_t pattern );
+RTEMS_INLINE_ROUTINE void _CPU_Instruction_no_operation( void )
+{
+ __asm__ volatile ( "nop" );
+}
+
#ifdef __cplusplus
}
#endif
diff --git a/cpukit/score/cpu/sparc64/include/rtems/score/cpuimpl.h b/cpukit/score/cpu/sparc64/include/rtems/score/cpuimpl.h
index ee188be..5d8bd77 100644
--- a/cpukit/score/cpu/sparc64/include/rtems/score/cpuimpl.h
+++ b/cpukit/score/cpu/sparc64/include/rtems/score/cpuimpl.h
@@ -37,6 +37,11 @@ RTEMS_INLINE_ROUTINE void _CPU_Context_validate( uintptr_t pattern )
}
}
+RTEMS_INLINE_ROUTINE void _CPU_Instruction_no_operation( void )
+{
+ __asm__ volatile ( "nop" );
+}
+
#ifdef __cplusplus
}
#endif
diff --git a/cpukit/score/cpu/v850/include/rtems/score/cpuimpl.h b/cpukit/score/cpu/v850/include/rtems/score/cpuimpl.h
index ee188be..5d8bd77 100644
--- a/cpukit/score/cpu/v850/include/rtems/score/cpuimpl.h
+++ b/cpukit/score/cpu/v850/include/rtems/score/cpuimpl.h
@@ -37,6 +37,11 @@ RTEMS_INLINE_ROUTINE void _CPU_Context_validate( uintptr_t pattern )
}
}
+RTEMS_INLINE_ROUTINE void _CPU_Instruction_no_operation( void )
+{
+ __asm__ volatile ( "nop" );
+}
+
#ifdef __cplusplus
}
#endif
diff --git a/cpukit/score/cpu/x86_64/include/rtems/score/cpuimpl.h b/cpukit/score/cpu/x86_64/include/rtems/score/cpuimpl.h
index a16a3d0..543c091 100644
--- a/cpukit/score/cpu/x86_64/include/rtems/score/cpuimpl.h
+++ b/cpukit/score/cpu/x86_64/include/rtems/score/cpuimpl.h
@@ -54,6 +54,11 @@ RTEMS_INLINE_ROUTINE void _CPU_Context_validate( uintptr_t pattern )
}
}
+RTEMS_INLINE_ROUTINE void _CPU_Instruction_no_operation( void )
+{
+ __asm__ volatile ( "nop" );
+}
+
#ifdef __cplusplus
}
#endif
diff --git a/testsuites/sptests/spcache01/init.c b/testsuites/sptests/spcache01/init.c
index 09bb300..8f5623c 100644
--- a/testsuites/sptests/spcache01/init.c
+++ b/testsuites/sptests/spcache01/init.c
@@ -23,17 +23,14 @@
#include <rtems.h>
#include <rtems/counter.h>
+#include <rtems/score/cpuimpl.h>
#include <rtems/score/sysstate.h>
#include "tmacros.h"
const char rtems_test_name[] = "SPCACHE 1";
-#ifdef __or1k__
- #define I() __asm__ volatile ("l.nop")
-#else
- #define I() __asm__ volatile ("nop")
-#endif
+#define I() _CPU_Instruction_no_operation()
#define I8() I(); I(); I(); I(); I(); I(); I(); I()
More information about the vc
mailing list