VISsave.S 1.8 KB

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