asmmacro-32.h 2.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192
  1. /* SPDX-License-Identifier: GPL-2.0 */
  2. /*
  3. * asmmacro.h: Assembler macros to make things easier to read.
  4. *
  5. * Copyright (C) 1996 David S. Miller (davem@davemloft.net)
  6. * Copyright (C) 1998, 1999, 2003 Ralf Baechle
  7. */
  8. #ifndef _ASM_ASMMACRO_32_H
  9. #define _ASM_ASMMACRO_32_H
  10. #include <asm/asm-offsets.h>
  11. #include <asm/regdef.h>
  12. #include <asm/fpregdef.h>
  13. #include <asm/mipsregs.h>
  14. .macro fpu_save_single thread tmp=t0
  15. .set push
  16. SET_HARDFLOAT
  17. cfc1 \tmp, fcr31
  18. s.d $f0, THREAD_FPR0(\thread)
  19. s.d $f2, THREAD_FPR2(\thread)
  20. s.d $f4, THREAD_FPR4(\thread)
  21. s.d $f6, THREAD_FPR6(\thread)
  22. s.d $f8, THREAD_FPR8(\thread)
  23. s.d $f10, THREAD_FPR10(\thread)
  24. s.d $f12, THREAD_FPR12(\thread)
  25. s.d $f14, THREAD_FPR14(\thread)
  26. s.d $f16, THREAD_FPR16(\thread)
  27. s.d $f18, THREAD_FPR18(\thread)
  28. s.d $f20, THREAD_FPR20(\thread)
  29. s.d $f22, THREAD_FPR22(\thread)
  30. s.d $f24, THREAD_FPR24(\thread)
  31. s.d $f26, THREAD_FPR26(\thread)
  32. s.d $f28, THREAD_FPR28(\thread)
  33. s.d $f30, THREAD_FPR30(\thread)
  34. sw \tmp, THREAD_FCR31(\thread)
  35. .set pop
  36. .endm
  37. .macro fpu_restore_single thread tmp=t0
  38. .set push
  39. SET_HARDFLOAT
  40. lw \tmp, THREAD_FCR31(\thread)
  41. l.d $f0, THREAD_FPR0(\thread)
  42. l.d $f2, THREAD_FPR2(\thread)
  43. l.d $f4, THREAD_FPR4(\thread)
  44. l.d $f6, THREAD_FPR6(\thread)
  45. l.d $f8, THREAD_FPR8(\thread)
  46. l.d $f10, THREAD_FPR10(\thread)
  47. l.d $f12, THREAD_FPR12(\thread)
  48. l.d $f14, THREAD_FPR14(\thread)
  49. l.d $f16, THREAD_FPR16(\thread)
  50. l.d $f18, THREAD_FPR18(\thread)
  51. l.d $f20, THREAD_FPR20(\thread)
  52. l.d $f22, THREAD_FPR22(\thread)
  53. l.d $f24, THREAD_FPR24(\thread)
  54. l.d $f26, THREAD_FPR26(\thread)
  55. l.d $f28, THREAD_FPR28(\thread)
  56. l.d $f30, THREAD_FPR30(\thread)
  57. ctc1 \tmp, fcr31
  58. .set pop
  59. .endm
  60. .macro cpu_save_nonscratch thread
  61. LONG_S s0, THREAD_REG16(\thread)
  62. LONG_S s1, THREAD_REG17(\thread)
  63. LONG_S s2, THREAD_REG18(\thread)
  64. LONG_S s3, THREAD_REG19(\thread)
  65. LONG_S s4, THREAD_REG20(\thread)
  66. LONG_S s5, THREAD_REG21(\thread)
  67. LONG_S s6, THREAD_REG22(\thread)
  68. LONG_S s7, THREAD_REG23(\thread)
  69. LONG_S sp, THREAD_REG29(\thread)
  70. LONG_S fp, THREAD_REG30(\thread)
  71. .endm
  72. .macro cpu_restore_nonscratch thread
  73. LONG_L s0, THREAD_REG16(\thread)
  74. LONG_L s1, THREAD_REG17(\thread)
  75. LONG_L s2, THREAD_REG18(\thread)
  76. LONG_L s3, THREAD_REG19(\thread)
  77. LONG_L s4, THREAD_REG20(\thread)
  78. LONG_L s5, THREAD_REG21(\thread)
  79. LONG_L s6, THREAD_REG22(\thread)
  80. LONG_L s7, THREAD_REG23(\thread)
  81. LONG_L sp, THREAD_REG29(\thread)
  82. LONG_L fp, THREAD_REG30(\thread)
  83. LONG_L ra, THREAD_REG31(\thread)
  84. .endm
  85. #endif /* _ASM_ASMMACRO_32_H */