It is needed to restore PSR just before return because condition codes are dirty after the CMP instructions and this may cause undefined program behavior after returning from the switching procedure (on following branch instruction, for example). --- cpukit/score/cpu/sparc/syscall.S | 4 ++++ 1 file changed, 4 insertions(+)
diff --git a/cpukit/score/cpu/sparc/syscall.S b/cpukit/score/cpu/sparc/syscall.S index 603ed7a738..bfd070a214 100644 --- a/cpukit/score/cpu/sparc/syscall.S +++ b/cpukit/score/cpu/sparc/syscall.S @@ -241,12 +241,16 @@ SYM(syscall_lazy_fp_switch): .Lfp_restore_done: + mov %l0, %psr ! Resore condition codes. PSR[EF] is 1 here + nop; nop ! PSR write delay + /* Now, retry the floating point instruction with PSR[EF] == 1 */ jmp %l1 rett %l2 .Lillegal_use_of_floating_point_unit: + mov %l0, %psr ! Restore condition codes. Write delay 3 instr sethi %hi(_Internal_error), %l1 or %l1, %lo(_Internal_error), %l1 mov 38, %i0 -- 2.17.1 _______________________________________________ devel mailing list devel@rtems.org http://lists.rtems.org/mailman/listinfo/devel