VISsave.S 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384
  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. #include <asm/export.h>
  15. /* On entry: %o5=current FPRS value, %g7 is callers address */
  16. /* May clobber %o5, %g1, %g2, %g3, %g7, %icc, %xcc */
  17. /* Nothing special need be done here to handle pre-emption, this
  18. * FPU save/restore mechanism is already preemption safe.
  19. */
  20. .text
  21. .align 32
  22. ENTRY(VISenter)
  23. ldub [%g6 + TI_FPDEPTH], %g1
  24. brnz,a,pn %g1, 1f
  25. cmp %g1, 1
  26. stb %g0, [%g6 + TI_FPSAVED]
  27. stx %fsr, [%g6 + TI_XFSR]
  28. 9: jmpl %g7 + %g0, %g0
  29. nop
  30. 1: bne,pn %icc, 2f
  31. srl %g1, 1, %g1
  32. vis1: ldub [%g6 + TI_FPSAVED], %g3
  33. stx %fsr, [%g6 + TI_XFSR]
  34. or %g3, %o5, %g3
  35. stb %g3, [%g6 + TI_FPSAVED]
  36. rd %gsr, %g3
  37. clr %g1
  38. ba,pt %xcc, 3f
  39. stx %g3, [%g6 + TI_GSR]
  40. 2: add %g6, %g1, %g3
  41. mov FPRS_DU | FPRS_DL | FPRS_FEF, %o5
  42. sll %g1, 3, %g1
  43. stb %o5, [%g3 + TI_FPSAVED]
  44. rd %gsr, %g2
  45. add %g6, %g1, %g3
  46. stx %g2, [%g3 + TI_GSR]
  47. add %g6, %g1, %g2
  48. stx %fsr, [%g2 + TI_XFSR]
  49. sll %g1, 5, %g1
  50. 3: andcc %o5, FPRS_DL|FPRS_DU, %g0
  51. be,pn %icc, 9b
  52. add %g6, TI_FPREGS, %g2
  53. andcc %o5, FPRS_DL, %g0
  54. be,pn %icc, 4f
  55. add %g6, TI_FPREGS+0x40, %g3
  56. membar #Sync
  57. stda %f0, [%g2 + %g1] ASI_BLK_P
  58. stda %f16, [%g3 + %g1] ASI_BLK_P
  59. membar #Sync
  60. andcc %o5, FPRS_DU, %g0
  61. be,pn %icc, 5f
  62. 4: add %g1, 128, %g1
  63. membar #Sync
  64. stda %f32, [%g2 + %g1] ASI_BLK_P
  65. stda %f48, [%g3 + %g1] ASI_BLK_P
  66. 5: membar #Sync
  67. ba,pt %xcc, 80f
  68. nop
  69. .align 32
  70. 80: jmpl %g7 + %g0, %g0
  71. nop
  72. ENDPROC(VISenter)
  73. EXPORT_SYMBOL(VISenter)