We must not load registers (e.g. PSR) from the heir context area before the heir stopped execution. Bug reported by Daniel Cederman. --- c/src/lib/libbsp/sparc/shared/irq_asm.S | 32 ++++++++++++++++---------------- 1 file changed, 16 insertions(+), 16 deletions(-)
diff --git a/c/src/lib/libbsp/sparc/shared/irq_asm.S b/c/src/lib/libbsp/sparc/shared/irq_asm.S index 9d8600e..d6c0ee6 100644 --- a/c/src/lib/libbsp/sparc/shared/irq_asm.S +++ b/c/src/lib/libbsp/sparc/shared/irq_asm.S @@ -91,6 +91,22 @@ SYM(_CPU_Context_switch): PUBLIC(_CPU_Context_restore_heir) SYM(_CPU_Context_restore_heir): +#if defined(RTEMS_SMP) + ! The executing context no longer executes on this processor + st %g0, [%o0 + SPARC_CONTEXT_CONTROL_IS_EXECUTING_OFFSET] + + ! Try to update the is executing indicator of the heir context + mov 1, %g1 + +try_update_is_executing: + + swap [%o1 + SPARC_CONTEXT_CONTROL_IS_EXECUTING_OFFSET], %g1 + cmp %g1, 0 + bne check_is_executing + + ! The next load is in a delay slot, which is all right +#endif + /* * Flush all windows with valid contents except the current one. * In examining the set register windows, one may logically divide @@ -186,22 +202,6 @@ done_flushing: nop nop -#if defined(RTEMS_SMP) - ! The executing context no longer executes on this processor - st %g0, [%o0 + SPARC_CONTEXT_CONTROL_IS_EXECUTING_OFFSET] - - ! Try to update the is executing indicator of the heir context - mov 1, %g1 - -try_update_is_executing: - - swap [%o1 + SPARC_CONTEXT_CONTROL_IS_EXECUTING_OFFSET], %g1 - cmp %g1, 0 - bne check_is_executing - - ! The next load is in a delay slot, which is all right -#endif - ld [%o1 + G5_OFFSET], %g5 ! restore the global registers ld [%o1 + G7_OFFSET], %g7 -- 1.8.4.5 _______________________________________________ devel mailing list devel@rtems.org http://lists.rtems.org/mailman/listinfo/devel