From ce3bfb7e477cfdb6ca332f6477f4d97e394f9f87 Mon Sep 17 00:00:00 2001 From: Joel Sherrill Date: Wed, 25 Aug 2010 20:33:25 +0000 Subject: 2010-08-25 Gedare Bloom PR 1688/libcpu * shared/score/interrupt.S: Fix bug in the sun4u _ISR_Dispatch code that ends up cloberring the global registers. It manifests primarily as a memory alignment error when the globals are used to read to/from memory. --- c/src/lib/libcpu/sparc64/ChangeLog | 8 ++++++++ c/src/lib/libcpu/sparc64/shared/score/interrupt.S | 12 ++++++------ 2 files changed, 14 insertions(+), 6 deletions(-) diff --git a/c/src/lib/libcpu/sparc64/ChangeLog b/c/src/lib/libcpu/sparc64/ChangeLog index a648f63bf2..d1b5400f85 100644 --- a/c/src/lib/libcpu/sparc64/ChangeLog +++ b/c/src/lib/libcpu/sparc64/ChangeLog @@ -1,3 +1,11 @@ +2010-08-25 Gedare Bloom + + PR 1688/libcpu + * shared/score/interrupt.S: Fix bug in the sun4u _ISR_Dispatch code + that ends up cloberring the global registers. It manifests primarily + as a memory alignment error when the globals are used to read to/from + memory. + 2010-08-20 Gedare Bloom PR 1681/cpukit diff --git a/c/src/lib/libcpu/sparc64/shared/score/interrupt.S b/c/src/lib/libcpu/sparc64/shared/score/interrupt.S index 4532cc563b..a8169025ea 100644 --- a/c/src/lib/libcpu/sparc64/shared/score/interrupt.S +++ b/c/src/lib/libcpu/sparc64/shared/score/interrupt.S @@ -357,7 +357,7 @@ PUBLIC(_ISR_Handler) ldub [%g7], %o5 orcc %o5, %g0, %g0 ! Is thread switch necessary? - bnz SYM(_ISR_Dispatch) ! yes, then invoke the dispatcher + bz simple_return ! no, then do a simple return. otherwise fallthru nop /* @@ -502,16 +502,16 @@ dispatchAgain: ldx [%sp + STACK_BIAS + ISF_G6_OFFSET], %g6 ! restore g6 ldx [%sp + STACK_BIAS + ISF_G7_OFFSET], %g7 ! restore g7 - - + ! Assume the interrupted context is in TL 0 with GL 0 / normal globals. + ! When tstate is restored at done/retry, the interrupted context is restored. ! return to TL[1], GL[1], and restore TSTATE, TPC, and TNPC wrpr %g0, 1, %tl ! return to GL=1 or AG #if defined(SUN4U) - rdpr %pstate, %g1 - andn %g1, SPARC_PSTATE_AG_MASK, %g1 - wrpr %g1, %g0, %pstate ! go to regular global + rdpr %pstate, %o1 + or %o1, SPARC_PSTATE_AG_MASK, %o1 + wrpr %o1, %g0, %pstate ! go to AG. #elif defined(SUN4V) wrpr %g0, 1, %gl #endif -- cgit v1.2.3