1 /* SPDX-License-Identifier: GPL-2.0 */ << 2 /* 1 /* 3 * VISsave.S: Code for saving FPU register sta 2 * VISsave.S: Code for saving FPU register state for 4 * VIS routines. One should not cal 3 * VIS routines. One should not call this directly, 5 * but use macros provided in <asm/ 4 * but use macros provided in <asm/visasm.h>. 6 * 5 * 7 * Copyright (C) 1998 Jakub Jelinek (jj@ultra. 6 * Copyright (C) 1998 Jakub Jelinek (jj@ultra.linux.cz) 8 */ 7 */ 9 8 10 #include <linux/export.h> << 11 #include <linux/linkage.h> 9 #include <linux/linkage.h> 12 10 13 #include <asm/asi.h> 11 #include <asm/asi.h> 14 #include <asm/page.h> 12 #include <asm/page.h> 15 #include <asm/ptrace.h> 13 #include <asm/ptrace.h> 16 #include <asm/visasm.h> 14 #include <asm/visasm.h> 17 #include <asm/thread_info.h> 15 #include <asm/thread_info.h> 18 16 19 /* On entry: %o5=current FPRS value, % 17 /* On entry: %o5=current FPRS value, %g7 is callers address */ 20 /* May clobber %o5, %g1, %g2, %g3, %g7 18 /* May clobber %o5, %g1, %g2, %g3, %g7, %icc, %xcc */ 21 19 22 /* Nothing special need be done here t 20 /* Nothing special need be done here to handle pre-emption, this 23 * FPU save/restore mechanism is alrea 21 * FPU save/restore mechanism is already preemption safe. 24 */ 22 */ 25 .text 23 .text 26 .align 32 24 .align 32 27 ENTRY(VISenter) 25 ENTRY(VISenter) 28 ldub [%g6 + TI_FPDEPTH], %g 26 ldub [%g6 + TI_FPDEPTH], %g1 29 brnz,a,pn %g1, 1f 27 brnz,a,pn %g1, 1f 30 cmp %g1, 1 28 cmp %g1, 1 31 stb %g0, [%g6 + TI_FPSAVED 29 stb %g0, [%g6 + TI_FPSAVED] 32 stx %fsr, [%g6 + TI_XFSR] 30 stx %fsr, [%g6 + TI_XFSR] 33 9: jmpl %g7 + %g0, %g0 31 9: jmpl %g7 + %g0, %g0 34 nop 32 nop 35 1: bne,pn %icc, 2f 33 1: bne,pn %icc, 2f 36 34 37 srl %g1, 1, %g1 35 srl %g1, 1, %g1 38 vis1: ldub [%g6 + TI_FPSAVED], %g 36 vis1: ldub [%g6 + TI_FPSAVED], %g3 39 stx %fsr, [%g6 + TI_XFSR] 37 stx %fsr, [%g6 + TI_XFSR] 40 or %g3, %o5, %g3 38 or %g3, %o5, %g3 41 stb %g3, [%g6 + TI_FPSAVED 39 stb %g3, [%g6 + TI_FPSAVED] 42 rd %gsr, %g3 40 rd %gsr, %g3 43 clr %g1 41 clr %g1 44 ba,pt %xcc, 3f 42 ba,pt %xcc, 3f 45 43 46 stx %g3, [%g6 + TI_GSR] 44 stx %g3, [%g6 + TI_GSR] 47 2: add %g6, %g1, %g3 45 2: add %g6, %g1, %g3 48 mov FPRS_DU | FPRS_DL | FP 46 mov FPRS_DU | FPRS_DL | FPRS_FEF, %o5 49 sll %g1, 3, %g1 47 sll %g1, 3, %g1 50 stb %o5, [%g3 + TI_FPSAVED 48 stb %o5, [%g3 + TI_FPSAVED] 51 rd %gsr, %g2 49 rd %gsr, %g2 52 add %g6, %g1, %g3 50 add %g6, %g1, %g3 53 stx %g2, [%g3 + TI_GSR] 51 stx %g2, [%g3 + TI_GSR] 54 52 55 add %g6, %g1, %g2 53 add %g6, %g1, %g2 56 stx %fsr, [%g2 + TI_XFSR] 54 stx %fsr, [%g2 + TI_XFSR] 57 sll %g1, 5, %g1 55 sll %g1, 5, %g1 58 3: andcc %o5, FPRS_DL|FPRS_DU, 56 3: andcc %o5, FPRS_DL|FPRS_DU, %g0 59 be,pn %icc, 9b 57 be,pn %icc, 9b 60 add %g6, TI_FPREGS, %g2 58 add %g6, TI_FPREGS, %g2 61 andcc %o5, FPRS_DL, %g0 59 andcc %o5, FPRS_DL, %g0 62 60 63 be,pn %icc, 4f 61 be,pn %icc, 4f 64 add %g6, TI_FPREGS+0x40, % 62 add %g6, TI_FPREGS+0x40, %g3 65 membar #Sync 63 membar #Sync 66 stda %f0, [%g2 + %g1] ASI_B 64 stda %f0, [%g2 + %g1] ASI_BLK_P 67 stda %f16, [%g3 + %g1] ASI_ 65 stda %f16, [%g3 + %g1] ASI_BLK_P 68 membar #Sync 66 membar #Sync 69 andcc %o5, FPRS_DU, %g0 67 andcc %o5, FPRS_DU, %g0 70 be,pn %icc, 5f 68 be,pn %icc, 5f 71 4: add %g1, 128, %g1 69 4: add %g1, 128, %g1 72 membar #Sync 70 membar #Sync 73 stda %f32, [%g2 + %g1] ASI_ 71 stda %f32, [%g2 + %g1] ASI_BLK_P 74 72 75 stda %f48, [%g3 + %g1] ASI_ 73 stda %f48, [%g3 + %g1] ASI_BLK_P 76 5: membar #Sync 74 5: membar #Sync 77 ba,pt %xcc, 80f 75 ba,pt %xcc, 80f 78 nop 76 nop 79 77 80 .align 32 78 .align 32 81 80: jmpl %g7 + %g0, %g0 79 80: jmpl %g7 + %g0, %g0 82 nop 80 nop 83 ENDPROC(VISenter) 81 ENDPROC(VISenter) 84 EXPORT_SYMBOL(VISenter) <<
Linux® is a registered trademark of Linus Torvalds in the United States and other countries.
TOMOYO® is a registered trademark of NTT DATA CORPORATION.