[PATCH 08/10] sparc: Move FP frame offset defines to cpuimpl.h

Sebastian Huber sebastian.huber at embedded-brains.de
Wed Jun 23 06:49:34 UTC 2021


This makes them usable in multiple files.

Update #4458.
---
 cpukit/score/cpu/sparc/cpu_asm.S              | 93 +++++++------------
 .../cpu/sparc/include/rtems/score/cpuimpl.h   | 21 +++++
 2 files changed, 57 insertions(+), 57 deletions(-)

diff --git a/cpukit/score/cpu/sparc/cpu_asm.S b/cpukit/score/cpu/sparc/cpu_asm.S
index a7b87ad5f8..16f5c70206 100644
--- a/cpukit/score/cpu/sparc/cpu_asm.S
+++ b/cpukit/score/cpu/sparc/cpu_asm.S
@@ -25,27 +25,6 @@
 #include <rtems/score/percpu.h>
 #include <libcpu/grlib-tn-0018.h>
 
-#if defined(SPARC_USE_SYNCHRONOUS_FP_SWITCH)
-  #define FP_FRAME_OFFSET_FO_F1 (SPARC_MINIMUM_STACK_FRAME_SIZE + 0)
-  #define FP_FRAME_OFFSET_F2_F3 (FP_FRAME_OFFSET_FO_F1 + 8)
-  #define FP_FRAME_OFFSET_F4_F5 (FP_FRAME_OFFSET_F2_F3 + 8)
-  #define FP_FRAME_OFFSET_F6_F7 (FP_FRAME_OFFSET_F4_F5 + 8)
-  #define FP_FRAME_OFFSET_F8_F9 (FP_FRAME_OFFSET_F6_F7 + 8)
-  #define FP_FRAME_OFFSET_F1O_F11 (FP_FRAME_OFFSET_F8_F9 + 8)
-  #define FP_FRAME_OFFSET_F12_F13 (FP_FRAME_OFFSET_F1O_F11 + 8)
-  #define FP_FRAME_OFFSET_F14_F15 (FP_FRAME_OFFSET_F12_F13 + 8)
-  #define FP_FRAME_OFFSET_F16_F17 (FP_FRAME_OFFSET_F14_F15 + 8)
-  #define FP_FRAME_OFFSET_F18_F19 (FP_FRAME_OFFSET_F16_F17 + 8)
-  #define FP_FRAME_OFFSET_F2O_F21 (FP_FRAME_OFFSET_F18_F19 + 8)
-  #define FP_FRAME_OFFSET_F22_F23 (FP_FRAME_OFFSET_F2O_F21 + 8)
-  #define FP_FRAME_OFFSET_F24_F25 (FP_FRAME_OFFSET_F22_F23 + 8)
-  #define FP_FRAME_OFFSET_F26_F27 (FP_FRAME_OFFSET_F24_F25 + 8)
-  #define FP_FRAME_OFFSET_F28_F29 (FP_FRAME_OFFSET_F26_F27 + 8)
-  #define FP_FRAME_OFFSET_F3O_F31 (FP_FRAME_OFFSET_F28_F29 + 8)
-  #define FP_FRAME_OFFSET_FSR (FP_FRAME_OFFSET_F3O_F31 + 8)
-  #define FP_FRAME_SIZE (FP_FRAME_OFFSET_FSR + 8)
-#endif
-
 /*
  *  void _CPU_Context_switch(
  *    Context_Control  *run,
@@ -707,40 +686,40 @@ isr_dispatch:
          * Post-switch actions (e.g. signal handlers) and context switch
          * extensions may safely use the floating point unit.
          */
-        sub     %sp, FP_FRAME_SIZE, %sp
-        std     %f0, [%sp + FP_FRAME_OFFSET_FO_F1]
+        sub     %sp, SPARC_FP_FRAME_SIZE, %sp
+        std     %f0, [%sp + SPARC_FP_FRAME_OFFSET_FO_F1]
         SPARC_LEON3FT_B2BST_NOP
-        std     %f2, [%sp + FP_FRAME_OFFSET_F2_F3]
+        std     %f2, [%sp + SPARC_FP_FRAME_OFFSET_F2_F3]
         SPARC_LEON3FT_B2BST_NOP
-        std     %f4, [%sp + FP_FRAME_OFFSET_F4_F5]
+        std     %f4, [%sp + SPARC_FP_FRAME_OFFSET_F4_F5]
         SPARC_LEON3FT_B2BST_NOP
-        std     %f6, [%sp + FP_FRAME_OFFSET_F6_F7]
+        std     %f6, [%sp + SPARC_FP_FRAME_OFFSET_F6_F7]
         SPARC_LEON3FT_B2BST_NOP
-        std     %f8, [%sp + FP_FRAME_OFFSET_F8_F9]
+        std     %f8, [%sp + SPARC_FP_FRAME_OFFSET_F8_F9]
         SPARC_LEON3FT_B2BST_NOP
-        std     %f10, [%sp + FP_FRAME_OFFSET_F1O_F11]
+        std     %f10, [%sp + SPARC_FP_FRAME_OFFSET_F1O_F11]
         SPARC_LEON3FT_B2BST_NOP
-        std     %f12, [%sp + FP_FRAME_OFFSET_F12_F13]
+        std     %f12, [%sp + SPARC_FP_FRAME_OFFSET_F12_F13]
         SPARC_LEON3FT_B2BST_NOP
-        std     %f14, [%sp + FP_FRAME_OFFSET_F14_F15]
+        std     %f14, [%sp + SPARC_FP_FRAME_OFFSET_F14_F15]
         SPARC_LEON3FT_B2BST_NOP
-        std     %f16, [%sp + FP_FRAME_OFFSET_F16_F17]
+        std     %f16, [%sp + SPARC_FP_FRAME_OFFSET_F16_F17]
         SPARC_LEON3FT_B2BST_NOP
-        std     %f18, [%sp + FP_FRAME_OFFSET_F18_F19]
+        std     %f18, [%sp + SPARC_FP_FRAME_OFFSET_F18_F19]
         SPARC_LEON3FT_B2BST_NOP
-        std     %f20, [%sp + FP_FRAME_OFFSET_F2O_F21]
+        std     %f20, [%sp + SPARC_FP_FRAME_OFFSET_F2O_F21]
         SPARC_LEON3FT_B2BST_NOP
-        std     %f22, [%sp + FP_FRAME_OFFSET_F22_F23]
+        std     %f22, [%sp + SPARC_FP_FRAME_OFFSET_F22_F23]
         SPARC_LEON3FT_B2BST_NOP
-        std     %f24, [%sp + FP_FRAME_OFFSET_F24_F25]
+        std     %f24, [%sp + SPARC_FP_FRAME_OFFSET_F24_F25]
         SPARC_LEON3FT_B2BST_NOP
-        std     %f26, [%sp + FP_FRAME_OFFSET_F26_F27]
+        std     %f26, [%sp + SPARC_FP_FRAME_OFFSET_F26_F27]
         SPARC_LEON3FT_B2BST_NOP
-        std     %f28, [%sp + FP_FRAME_OFFSET_F28_F29]
+        std     %f28, [%sp + SPARC_FP_FRAME_OFFSET_F28_F29]
         SPARC_LEON3FT_B2BST_NOP
-        std     %f30, [%sp + FP_FRAME_OFFSET_F3O_F31]
+        std     %f30, [%sp + SPARC_FP_FRAME_OFFSET_F3O_F31]
         SPARC_LEON3FT_B2BST_NOP
-        st      %fsr, [%sp + FP_FRAME_OFFSET_FSR]
+        st      %fsr, [%sp + SPARC_FP_FRAME_OFFSET_FSR]
         call    SYM(_Thread_Do_dispatch)
          mov    %g6, %o0
 
@@ -748,25 +727,25 @@ isr_dispatch:
          * Restore the floating point context from stack frame and release the
          * stack frame.
          */
-        ldd     [%sp + FP_FRAME_OFFSET_FO_F1], %f0
-        ldd     [%sp + FP_FRAME_OFFSET_F2_F3], %f2
-        ldd     [%sp + FP_FRAME_OFFSET_F4_F5], %f4
-        ldd     [%sp + FP_FRAME_OFFSET_F6_F7], %f6
-        ldd     [%sp + FP_FRAME_OFFSET_F8_F9], %f8
-        ldd     [%sp + FP_FRAME_OFFSET_F1O_F11], %f10
-        ldd     [%sp + FP_FRAME_OFFSET_F12_F13], %f12
-        ldd     [%sp + FP_FRAME_OFFSET_F14_F15], %f14
-        ldd     [%sp + FP_FRAME_OFFSET_F16_F17], %f16
-        ldd     [%sp + FP_FRAME_OFFSET_F18_F19], %f18
-        ldd     [%sp + FP_FRAME_OFFSET_F2O_F21], %f20
-        ldd     [%sp + FP_FRAME_OFFSET_F22_F23], %f22
-        ldd     [%sp + FP_FRAME_OFFSET_F24_F25], %f24
-        ldd     [%sp + FP_FRAME_OFFSET_F26_F27], %f26
-        ldd     [%sp + FP_FRAME_OFFSET_F28_F29], %f28
-        ldd     [%sp + FP_FRAME_OFFSET_F3O_F31], %f30
-        ld      [%sp + FP_FRAME_OFFSET_FSR], %fsr
+        ldd     [%sp + SPARC_FP_FRAME_OFFSET_FO_F1], %f0
+        ldd     [%sp + SPARC_FP_FRAME_OFFSET_F2_F3], %f2
+        ldd     [%sp + SPARC_FP_FRAME_OFFSET_F4_F5], %f4
+        ldd     [%sp + SPARC_FP_FRAME_OFFSET_F6_F7], %f6
+        ldd     [%sp + SPARC_FP_FRAME_OFFSET_F8_F9], %f8
+        ldd     [%sp + SPARC_FP_FRAME_OFFSET_F1O_F11], %f10
+        ldd     [%sp + SPARC_FP_FRAME_OFFSET_F12_F13], %f12
+        ldd     [%sp + SPARC_FP_FRAME_OFFSET_F14_F15], %f14
+        ldd     [%sp + SPARC_FP_FRAME_OFFSET_F16_F17], %f16
+        ldd     [%sp + SPARC_FP_FRAME_OFFSET_F18_F19], %f18
+        ldd     [%sp + SPARC_FP_FRAME_OFFSET_F2O_F21], %f20
+        ldd     [%sp + SPARC_FP_FRAME_OFFSET_F22_F23], %f22
+        ldd     [%sp + SPARC_FP_FRAME_OFFSET_F24_F25], %f24
+        ldd     [%sp + SPARC_FP_FRAME_OFFSET_F26_F27], %f26
+        ldd     [%sp + SPARC_FP_FRAME_OFFSET_F28_F29], %f28
+        ldd     [%sp + SPARC_FP_FRAME_OFFSET_F3O_F31], %f30
+        ld      [%sp + SPARC_FP_FRAME_OFFSET_FSR], %fsr
         ba      .Lthread_dispatch_done
-         add    %sp, FP_FRAME_SIZE, %sp
+         add    %sp, SPARC_FP_FRAME_SIZE, %sp
 
 .Lnon_fp_thread_dispatch:
 #endif
diff --git a/cpukit/score/cpu/sparc/include/rtems/score/cpuimpl.h b/cpukit/score/cpu/sparc/include/rtems/score/cpuimpl.h
index a8ed0aec23..8aa4030a45 100644
--- a/cpukit/score/cpu/sparc/include/rtems/score/cpuimpl.h
+++ b/cpukit/score/cpu/sparc/include/rtems/score/cpuimpl.h
@@ -139,6 +139,27 @@
 #define SPARC_EXCEPTION_FRAME_SIZE 536
 #endif
 
+#if defined(SPARC_USE_SYNCHRONOUS_FP_SWITCH)
+#define SPARC_FP_FRAME_OFFSET_FO_F1 (SPARC_MINIMUM_STACK_FRAME_SIZE + 0)
+#define SPARC_FP_FRAME_OFFSET_F2_F3 (SPARC_FP_FRAME_OFFSET_FO_F1 + 8)
+#define SPARC_FP_FRAME_OFFSET_F4_F5 (SPARC_FP_FRAME_OFFSET_F2_F3 + 8)
+#define SPARC_FP_FRAME_OFFSET_F6_F7 (SPARC_FP_FRAME_OFFSET_F4_F5 + 8)
+#define SPARC_FP_FRAME_OFFSET_F8_F9 (SPARC_FP_FRAME_OFFSET_F6_F7 + 8)
+#define SPARC_FP_FRAME_OFFSET_F1O_F11 (SPARC_FP_FRAME_OFFSET_F8_F9 + 8)
+#define SPARC_FP_FRAME_OFFSET_F12_F13 (SPARC_FP_FRAME_OFFSET_F1O_F11 + 8)
+#define SPARC_FP_FRAME_OFFSET_F14_F15 (SPARC_FP_FRAME_OFFSET_F12_F13 + 8)
+#define SPARC_FP_FRAME_OFFSET_F16_F17 (SPARC_FP_FRAME_OFFSET_F14_F15 + 8)
+#define SPARC_FP_FRAME_OFFSET_F18_F19 (SPARC_FP_FRAME_OFFSET_F16_F17 + 8)
+#define SPARC_FP_FRAME_OFFSET_F2O_F21 (SPARC_FP_FRAME_OFFSET_F18_F19 + 8)
+#define SPARC_FP_FRAME_OFFSET_F22_F23 (SPARC_FP_FRAME_OFFSET_F2O_F21 + 8)
+#define SPARC_FP_FRAME_OFFSET_F24_F25 (SPARC_FP_FRAME_OFFSET_F22_F23 + 8)
+#define SPARC_FP_FRAME_OFFSET_F26_F27 (SPARC_FP_FRAME_OFFSET_F24_F25 + 8)
+#define SPARC_FP_FRAME_OFFSET_F28_F29 (SPARC_FP_FRAME_OFFSET_F26_F27 + 8)
+#define SPARC_FP_FRAME_OFFSET_F3O_F31 (SPARC_FP_FRAME_OFFSET_F28_F29 + 8)
+#define SPARC_FP_FRAME_OFFSET_FSR (SPARC_FP_FRAME_OFFSET_F3O_F31 + 8)
+#define SPARC_FP_FRAME_SIZE (SPARC_FP_FRAME_OFFSET_FSR + 8)
+#endif
+
 #ifndef ASM
 
 #ifdef __cplusplus
-- 
2.26.2



More information about the devel mailing list