summaryrefslogtreecommitdiffstats
path: root/c/src/lib/libbsp/powerpc/support/new_exception_processing
diff options
context:
space:
mode:
authorJoel Sherrill <joel.sherrill@OARcorp.com>2002-05-14 17:45:53 +0000
committerJoel Sherrill <joel.sherrill@OARcorp.com>2002-05-14 17:45:53 +0000
commit830e5f74eab67787b9c30fe658a0160035f2a3f2 (patch)
treeb0fe5a96e5a10b237047a3f3759adac640d7c038 /c/src/lib/libbsp/powerpc/support/new_exception_processing
parent2001-05-14 Till Straumann <strauman@slac.stanford.edu> (diff)
downloadrtems-830e5f74eab67787b9c30fe658a0160035f2a3f2.tar.bz2
2001-05-14 Till Straumann <strauman@slac.stanford.edu>
* cpu.c: Per PR211 fix saving/restoring floating point context. The fpsave and fprestore routines are only used in a executing context which _is_ fp and hence has the FPU enabled. The current behavior required the FPU always to be on which is very dangerous if lazy context switching is used. [Joel Note: Some ports explicitly enabled the FPU in the FP save and restore routines to avoid this.] The patch also makes sure (on powerpc only) that the FPU is disabled for integer tasks. Note that this is crucial if deferred fp context switching is used. Otherwise, fp context corruption may go undetected! Also note that even tasks which merely push/pop FP registers to/from the stack without modifying them still MUST be FP tasks - otherwise (if lazy FP context switching is used), FP register corruption (of other, FP, tasks may occur)! Furthermore, (on PPC) by default, lazy FP context save/restore is _disabled_.
Diffstat (limited to 'c/src/lib/libbsp/powerpc/support/new_exception_processing')
-rw-r--r--c/src/lib/libbsp/powerpc/support/new_exception_processing/ChangeLog21
-rw-r--r--c/src/lib/libbsp/powerpc/support/new_exception_processing/cpu.c14
2 files changed, 34 insertions, 1 deletions
diff --git a/c/src/lib/libbsp/powerpc/support/new_exception_processing/ChangeLog b/c/src/lib/libbsp/powerpc/support/new_exception_processing/ChangeLog
index 4d8955d6b4..f5690d88e7 100644
--- a/c/src/lib/libbsp/powerpc/support/new_exception_processing/ChangeLog
+++ b/c/src/lib/libbsp/powerpc/support/new_exception_processing/ChangeLog
@@ -1,3 +1,24 @@
+2001-05-14 Till Straumann <strauman@slac.stanford.edu>
+
+ * cpu.c: Per PR211 fix
+ saving/restoring floating point context. The fpsave and fprestore
+ routines are only used in a executing context which _is_ fp and hence
+ has the FPU enabled. The current behavior required the FPU always to
+ be on which is very dangerous if lazy context switching is used.
+ [Joel Note: Some ports explicitly enabled the FPU in the FP save and
+ restore routines to avoid this.]
+
+ The patch also makes sure (on powerpc only) that the FPU is disabled
+ for integer tasks. Note that this is crucial if deferred fp context
+ switching is used. Otherwise, fp context corruption may go undetected!
+ Also note that even tasks which merely push/pop FP registers to/from
+ the stack without modifying them still MUST be FP tasks - otherwise
+ (if lazy FP context switching is used), FP register corruption (of
+ other, FP, tasks may occur)!
+
+ Furthermore, (on PPC) by default, lazy FP context save/restore
+ is _disabled_.
+
2002-04-18 Ralf Corsepius <corsepiu@faw.uni-ulm.de>
* rtems/score/cpu.h: Removed.
diff --git a/c/src/lib/libbsp/powerpc/support/new_exception_processing/cpu.c b/c/src/lib/libbsp/powerpc/support/new_exception_processing/cpu.c
index 10d38fab1a..01c5a31e37 100644
--- a/c/src/lib/libbsp/powerpc/support/new_exception_processing/cpu.c
+++ b/c/src/lib/libbsp/powerpc/support/new_exception_processing/cpu.c
@@ -93,8 +93,20 @@ void _CPU_Context_Initialize(
* time (7 July 1997), this restructuring is not being done.
*/
- /*if ( is_fp ) */
+ /* Till Straumann: For deferred FPContext save/restore, make sure integer
+ * tasks have no FPU access in order to catch violations.
+ * Otherwise, the FP registers may be corrupted.
+ * Since we set the_contex->msr using our current MSR,
+ * we must make sure MSR_FP is off if (!is_fp)...
+ */
+#if defined(CPU_USE_DEFERRED_FP_SWITCH) && (CPU_USE_DEFERRED_FP_SWITCH==TRUE)
+ if ( is_fp )
+#endif
the_context->msr |= PPC_MSR_FP;
+#if defined(CPU_USE_DEFERRED_FP_SWITCH) && (CPU_USE_DEFERRED_FP_SWITCH==TRUE)
+ else
+ the_context->msr &= ~PPC_MSR_FP;
+#endif
the_context->pc = (unsigned32)entry_point;
}