entry-fpsimd.S 2.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980
  1. /*
  2. * FP/SIMD state saving and restoring
  3. *
  4. * Copyright (C) 2012 ARM Ltd.
  5. * Author: Catalin Marinas <catalin.marinas@arm.com>
  6. *
  7. * This program is free software; you can redistribute it and/or modify
  8. * it under the terms of the GNU General Public License version 2 as
  9. * published by the Free Software Foundation.
  10. *
  11. * This program is distributed in the hope that it will be useful,
  12. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  13. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  14. * GNU General Public License for more details.
  15. *
  16. * You should have received a copy of the GNU General Public License
  17. * along with this program. If not, see <http://www.gnu.org/licenses/>.
  18. */
  19. #include <linux/linkage.h>
  20. #include <asm/assembler.h>
  21. /*
  22. * Save the FP registers.
  23. *
  24. * x0 - pointer to struct fpsimd_state
  25. */
  26. ENTRY(fpsimd_save_state)
  27. stp q0, q1, [x0, #16 * 0]
  28. stp q2, q3, [x0, #16 * 2]
  29. stp q4, q5, [x0, #16 * 4]
  30. stp q6, q7, [x0, #16 * 6]
  31. stp q8, q9, [x0, #16 * 8]
  32. stp q10, q11, [x0, #16 * 10]
  33. stp q12, q13, [x0, #16 * 12]
  34. stp q14, q15, [x0, #16 * 14]
  35. stp q16, q17, [x0, #16 * 16]
  36. stp q18, q19, [x0, #16 * 18]
  37. stp q20, q21, [x0, #16 * 20]
  38. stp q22, q23, [x0, #16 * 22]
  39. stp q24, q25, [x0, #16 * 24]
  40. stp q26, q27, [x0, #16 * 26]
  41. stp q28, q29, [x0, #16 * 28]
  42. stp q30, q31, [x0, #16 * 30]!
  43. mrs x8, fpsr
  44. str w8, [x0, #16 * 2]
  45. mrs x8, fpcr
  46. str w8, [x0, #16 * 2 + 4]
  47. ret
  48. ENDPROC(fpsimd_save_state)
  49. /*
  50. * Load the FP registers.
  51. *
  52. * x0 - pointer to struct fpsimd_state
  53. */
  54. ENTRY(fpsimd_load_state)
  55. ldp q0, q1, [x0, #16 * 0]
  56. ldp q2, q3, [x0, #16 * 2]
  57. ldp q4, q5, [x0, #16 * 4]
  58. ldp q6, q7, [x0, #16 * 6]
  59. ldp q8, q9, [x0, #16 * 8]
  60. ldp q10, q11, [x0, #16 * 10]
  61. ldp q12, q13, [x0, #16 * 12]
  62. ldp q14, q15, [x0, #16 * 14]
  63. ldp q16, q17, [x0, #16 * 16]
  64. ldp q18, q19, [x0, #16 * 18]
  65. ldp q20, q21, [x0, #16 * 20]
  66. ldp q22, q23, [x0, #16 * 22]
  67. ldp q24, q25, [x0, #16 * 24]
  68. ldp q26, q27, [x0, #16 * 26]
  69. ldp q28, q29, [x0, #16 * 28]
  70. ldp q30, q31, [x0, #16 * 30]!
  71. ldr w8, [x0, #16 * 2]
  72. ldr w9, [x0, #16 * 2 + 4]
  73. msr fpsr, x8
  74. msr fpcr, x9
  75. ret
  76. ENDPROC(fpsimd_load_state)