VISsave.S 1.8 KB

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