[Bug 1932] New: SMP: SPARC switch_to_first_task_smp creates bad window
bugzilla-daemon at rtems.org
bugzilla-daemon at rtems.org
Fri Oct 7 11:46:42 UTC 2011
https://www.rtems.org/bugzilla/show_bug.cgi?id=1932
Summary: SMP: SPARC switch_to_first_task_smp creates bad window
Product: RTEMS
Version: HEAD
Platform: sparc
OS/Version: RTEMS
Status: NEW
Severity: normal
Priority: P3
Component: cpukit
AssignedTo: joel.sherrill at oarcorp.com
ReportedBy: daniel at gaisler.com
Created attachment 1350
--> https://www.rtems.org/bugzilla/attachment.cgi?id=1350
_CPU_Context_switch_to_first_task_smp() WIM patch
I have got SMP the smphack01.exe test to successfully complete on a dual core
LEON3 GR712RC ASIC today, the below patch is required.
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. The below code is rewritten:
* 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?)
Daniel
Index: cpukit/score/cpu/sparc/cpu_asm.S
===================================================================
RCS file:
/home/cvspserver/SMP_Repository/rtems-smp/cpukit/score/cpu/sparc/cpu_asm.S,v
retrieving revision 1.1.1.1
diff -u -r1.1.1.1 cpu_asm.S
--- cpukit/score/cpu/sparc/cpu_asm.S 31 Mar 2011 18:32:59 -0000 1.1.1.1
+++ cpukit/score/cpu/sparc/cpu_asm.S 7 Oct 2011 11:28:05 -0000
@@ -336,22 +336,22 @@
*
* 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 */
--
Configure bugmail: https://www.rtems.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are watching all bug changes.
More information about the bugs
mailing list