summaryrefslogtreecommitdiffstats
path: root/cpukit/score/cpu/sparc/cpu_asm.S
diff options
context:
space:
mode:
authorSebastian Huber <sebastian.huber@embedded-brains.de>2017-07-17 07:30:46 +0200
committerSebastian Huber <sebastian.huber@embedded-brains.de>2017-07-25 11:41:12 +0200
commit146adb1edfaa0271ee0df5180a1f64d54e6e860d (patch)
tree4957ce3cfe1c5818ab121bf11465e131042f4952 /cpukit/score/cpu/sparc/cpu_asm.S
parentINTERNAL_ERROR_ILLEGAL_USE_OF_FLOATING_POINT_UNIT (diff)
downloadrtems-146adb1edfaa0271ee0df5180a1f64d54e6e860d.tar.bz2
sparc: Add lazy floating point switch
The SPARC ABI is a bit special with respect to the floating point context. The complete floating point context is volatile. Thus, from an ABI point of view nothing needs to be saved and restored during a context switch. Instead the floating point context must be saved and restored during interrupt processing. Historically, the deferred floating point switch was used for SPARC and the complete floating point context is saved and restored during a context switch to the new floating point unit owner. This is a bit dangerous since post-switch actions (e.g. signal handlers) and context switch extensions may silently corrupt the floating point context. The floating point unit is disabled for interrupt handlers. Thus, in case an interrupt handler uses the floating point unit then this will result in a trap (INTERNAL_ERROR_ILLEGAL_USE_OF_FLOATING_POINT_UNIT). In uniprocessor configurations, a lazy floating point context switch is used. In case an active floating point thread is interrupted (PSR[EF] == 1) and a thread dispatch is carried out, then this thread is registered as the floating point owner. When a floating point owner is present during a context switch, the floating point unit is disabled for the heir thread (PSR[EF] == 0). The floating point disabled trap checks that the use of the floating point unit is allowed and saves/restores the floating point context on demand. Update #3077.
Diffstat (limited to 'cpukit/score/cpu/sparc/cpu_asm.S')
-rw-r--r--cpukit/score/cpu/sparc/cpu_asm.S127
1 files changed, 0 insertions, 127 deletions
diff --git a/cpukit/score/cpu/sparc/cpu_asm.S b/cpukit/score/cpu/sparc/cpu_asm.S
deleted file mode 100644
index 66d36935a3..0000000000
--- a/cpukit/score/cpu/sparc/cpu_asm.S
+++ /dev/null
@@ -1,127 +0,0 @@
-/* cpu_asm.s
- *
- * This file contains the basic algorithms for all assembly code used
- * in an specific CPU port of RTEMS. These algorithms must be implemented
- * in assembly language.
- *
- * COPYRIGHT (c) 1989-2011.
- * On-Line Applications Research Corporation (OAR).
- *
- * The license and distribution terms for this file may be
- * found in the file LICENSE in this distribution or at
- * http://www.rtems.org/license/LICENSE.
- *
- * Ported to ERC32 implementation of the SPARC by On-Line Applications
- * Research Corporation (OAR) under contract to the European Space
- * Agency (ESA).
- *
- * ERC32 modifications of respective RTEMS file: COPYRIGHT (c) 1995.
- * European Space Agency.
- */
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include <rtems/asm.h>
-#include <rtems/system.h>
-
-#if (SPARC_HAS_FPU == 1) && !defined(SPARC_USE_SYNCHRONOUS_FP_SWITCH)
-
-/*
- * void _CPU_Context_save_fp(
- * void **fp_context_ptr
- * )
- *
- * This routine is responsible for saving the FP context
- * at *fp_context_ptr. If the point to load the FP context
- * from is changed then the pointer is modified by this routine.
- *
- * NOTE: See the README in this directory for information on the
- * management of the "EF" bit in the PSR.
- */
-
- .align 4
- PUBLIC(_CPU_Context_save_fp)
-SYM(_CPU_Context_save_fp):
- ld [%o0], %o1
- std %f0, [%o1 + FO_F1_OFFSET]
- SPARC_LEON3FT_B2BST_NOP
- std %f2, [%o1 + F2_F3_OFFSET]
- SPARC_LEON3FT_B2BST_NOP
- std %f4, [%o1 + F4_F5_OFFSET]
- SPARC_LEON3FT_B2BST_NOP
- std %f6, [%o1 + F6_F7_OFFSET]
- SPARC_LEON3FT_B2BST_NOP
- std %f8, [%o1 + F8_F9_OFFSET]
- SPARC_LEON3FT_B2BST_NOP
- std %f10, [%o1 + F1O_F11_OFFSET]
- SPARC_LEON3FT_B2BST_NOP
- std %f12, [%o1 + F12_F13_OFFSET]
- SPARC_LEON3FT_B2BST_NOP
- std %f14, [%o1 + F14_F15_OFFSET]
- SPARC_LEON3FT_B2BST_NOP
- std %f16, [%o1 + F16_F17_OFFSET]
- SPARC_LEON3FT_B2BST_NOP
- std %f18, [%o1 + F18_F19_OFFSET]
- SPARC_LEON3FT_B2BST_NOP
- std %f20, [%o1 + F2O_F21_OFFSET]
- SPARC_LEON3FT_B2BST_NOP
- std %f22, [%o1 + F22_F23_OFFSET]
- SPARC_LEON3FT_B2BST_NOP
- std %f24, [%o1 + F24_F25_OFFSET]
- SPARC_LEON3FT_B2BST_NOP
- std %f26, [%o1 + F26_F27_OFFSET]
- SPARC_LEON3FT_B2BST_NOP
- std %f28, [%o1 + F28_F29_OFFSET]
- SPARC_LEON3FT_B2BST_NOP
- std %f30, [%o1 + F3O_F31_OFFSET]
- SPARC_LEON3FT_B2BST_NOP
-#if defined(__FIX_LEON3FT_B2BST)
- st %fsr, [%o1 + FSR_OFFSET]
- jmp %o7 + 8
- nop
-#else
- jmp %o7 + 8
- st %fsr, [%o1 + FSR_OFFSET]
-#endif
-
-/*
- * void _CPU_Context_restore_fp(
- * void **fp_context_ptr
- * )
- *
- * This routine is responsible for restoring the FP context
- * at *fp_context_ptr. If the point to load the FP context
- * from is changed then the pointer is modified by this routine.
- *
- * NOTE: See the README in this directory for information on the
- * management of the "EF" bit in the PSR.
- */
-
- .align 4
- PUBLIC(_CPU_Context_restore_fp)
-SYM(_CPU_Context_restore_fp):
- ld [%o0], %o1
- ldd [%o1 + FO_F1_OFFSET], %f0
- ldd [%o1 + F2_F3_OFFSET], %f2
- ldd [%o1 + F4_F5_OFFSET], %f4
- ldd [%o1 + F6_F7_OFFSET], %f6
- ldd [%o1 + F8_F9_OFFSET], %f8
- ldd [%o1 + F1O_F11_OFFSET], %f10
- ldd [%o1 + F12_F13_OFFSET], %f12
- ldd [%o1 + F14_F15_OFFSET], %f14
- ldd [%o1 + F16_F17_OFFSET], %f16
- ldd [%o1 + F18_F19_OFFSET], %f18
- ldd [%o1 + F2O_F21_OFFSET], %f20
- ldd [%o1 + F22_F23_OFFSET], %f22
- ldd [%o1 + F24_F25_OFFSET], %f24
- ldd [%o1 + F26_F27_OFFSET], %f26
- ldd [%o1 + F28_F29_OFFSET], %f28
- ldd [%o1 + F3O_F31_OFFSET], %f30
- jmp %o7 + 8
- ld [%o1 + FSR_OFFSET], %fsr
-
-#endif /* SPARC_HAS_FPU */
-
-/* end of file */