summaryrefslogtreecommitdiffstats
path: root/cpukit/score
diff options
context:
space:
mode:
authorJoel Sherrill <joel.sherrill@OARcorp.com>2011-10-07 14:31:44 +0000
committerJoel Sherrill <joel.sherrill@OARcorp.com>2011-10-07 14:31:44 +0000
commit8f582bc637ca4d899c9bffc961a36e0b3e2777ee (patch)
tree8ac7df7e098fe04e26b296501be4727477370162 /cpukit/score
parent2011-10-07 Ralf Corsépius <ralf.corsepius@rtems.org> (diff)
downloadrtems-8f582bc637ca4d899c9bffc961a36e0b3e2777ee.tar.bz2
2011-10-07 Daniel Hellstrom <daniel@gaisler.com>
PR 1932/cpukit * cpu_asm.S: At some point the interrupt trap handler causes a window-overflow and the window overflow trap handler crashes when writing to 0. I found that this is because the WIM was bad, to the window overflow handler uses a uninitialized stack pointer in a window never used. * g3=CWP, not WIM * CWP is incremented by done_flushing no need doing that here also * I see no reason to create an additional stack frame (save) * Must turn off traps when updating WIM (maybe already done by caller?)
Diffstat (limited to 'cpukit/score')
-rw-r--r--cpukit/score/cpu/sparc/ChangeLog12
-rw-r--r--cpukit/score/cpu/sparc/cpu_asm.S22
2 files changed, 23 insertions, 11 deletions
diff --git a/cpukit/score/cpu/sparc/ChangeLog b/cpukit/score/cpu/sparc/ChangeLog
index 10b7a98e52..eab5f805c1 100644
--- a/cpukit/score/cpu/sparc/ChangeLog
+++ b/cpukit/score/cpu/sparc/ChangeLog
@@ -1,3 +1,15 @@
+2011-10-07 Daniel Hellstrom <daniel@gaisler.com>
+
+ PR 1932/cpukit
+ * cpu_asm.S: At some point the interrupt trap handler causes a
+ window-overflow and the window overflow trap handler crashes when
+ writing to 0. I found that this is because the WIM was bad, to the
+ window overflow handler uses a uninitialized stack pointer in a
+ window never used.
+ * g3=CWP, not WIM
+ * CWP is incremented by done_flushing no need doing that here also
+ * I see no reason to create an additional stack frame (save)
+ * Must turn off traps when updating WIM (maybe already done by caller?)
2011-09-27 Sebastian Huber <sebastian.huber@embedded-brains.de>
PR 1914/cpukit
diff --git a/cpukit/score/cpu/sparc/cpu_asm.S b/cpukit/score/cpu/sparc/cpu_asm.S
index fb9835d16a..ccfbefd655 100644
--- a/cpukit/score/cpu/sparc/cpu_asm.S
+++ b/cpukit/score/cpu/sparc/cpu_asm.S
@@ -336,22 +336,22 @@ SYM(_CPU_Context_restore):
*
* This routine is only used to switch to the first task on a
* secondary core in an SMP configuration. We do not need to
- * flush all the windows and, in fact, this can be dangerous
+ * flush any windows and, in fact, this can be dangerous
* as they may or may not be initialized properly. So we just
* reinitialize the PSR and WIM.
*/
PUBLIC(_CPU_Context_switch_to_first_task_smp)
SYM(_CPU_Context_switch_to_first_task_smp):
- save %sp, -CPU_MINIMUM_STACK_FRAME_SIZE, %sp
-
- mov %psr, %g1 ! Initialize WIM
- add %g1, 1, %g2
- and %g2, 0x7, %g2
- set 1, %g3
- sll %g3, %g2, %g3
- mov %g3, %wim
- ba done_flushing
- mov %i0, %o1 ! in the delay slot
+ mov %psr, %g1 ! Turn of traps when modifying WIM
+ andn %g1, SPARC_PSR_ET_MASK, %g1
+ mov %g1, %psr
+ /* WIM and PSR will be set in done_flushing, it need args:
+ * g1=PSR, g3=CWP, o1=Context
+ */
+ and %g1, SPARC_NUMBER_OF_REGISTER_WINDOWS - 1, %g3
+ nop
+ mov %o0, %o1 ! in the delay slot
+ ba,a done_flushing
#endif
/* end of file */