From: Russ Cox Date: Thu, 1 Aug 2013 04:16:31 +0000 (-0400) Subject: runtime: fix arm preemption X-Git-Tag: go1.2rc2~848 X-Git-Url: http://www.git.cypherpunks.su/?a=commitdiff_plain;h=cba880e04a074806f0e948fbdee8e2fe31705f14;p=gostls13.git runtime: fix arm preemption Preemption during the software floating point code could cause m (R9) to change, so that when the original registers were restored at the end of the floating point handler, the changed and correct m would be replaced by the old and incorrect m. TBR=dvyukov CC=golang-dev https://golang.org/cl/11883045 --- diff --git a/src/pkg/runtime/vlop_arm.s b/src/pkg/runtime/vlop_arm.s index 02eb985f7b..cd56898dc6 100644 --- a/src/pkg/runtime/vlop_arm.s +++ b/src/pkg/runtime/vlop_arm.s @@ -59,7 +59,15 @@ TEXT _sfloat(SB), 7, $64-0 // 4 arg + 14*4 saved regs + cpsr MOVW 64(R13), R1 WORD $0xe128f001 // msr cpsr_f, r1 MOVW $12(R13), R0 - MOVM.IA.W (R0), [R1-R12] + // Restore R1-R8 and R11-R12, but ignore the saved R9 (m) and R10 (g). + // Both are maintained by the runtime and always have correct values, + // so there is no need to restore old values here. + // The g should not have changed, but m may have, if we were preempted + // and restarted on a different thread, in which case restoring the old + // value is incorrect and will cause serious confusion in the runtime. + MOVM.IA.W (R0), [R1-R8] + MOVW $52(R13), R0 + MOVM.IA.W (R0), [R11-R12] MOVW 8(R13), R0 RET