windowspill.S 2.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798
  1. /* Function to force register windows to the stack.
  2. Copyright (C) 2005, 2007 Free Software Foundation, Inc.
  3. This file is part of the GNU C Library.
  4. The GNU C Library is free software; you can redistribute it and/or
  5. modify it under the terms of the GNU Lesser General Public
  6. License as published by the Free Software Foundation; either
  7. version 2.1 of the License, or (at your option) any later version.
  8. The GNU C Library is distributed in the hope that it will be useful,
  9. but WITHOUT ANY WARRANTY; without even the implied warranty of
  10. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  11. Lesser General Public License for more details.
  12. You should have received a copy of the GNU Lesser General Public
  13. License along with the GNU C Library; if not, see
  14. <http://www.gnu.org/licenses/>. */
  15. #include <bits/xtensa-config.h>
  16. #ifdef __XTENSA_WINDOWED_ABI__
  17. .text
  18. .align 4
  19. .literal_position
  20. .global __window_spill
  21. .type __window_spill, @function
  22. __window_spill:
  23. entry a1, 48
  24. bbci.l a0, 31, .L4 /* branch if called with call4 */
  25. bbsi.l a0, 30, .L12 /* branch if called with call12 */
  26. /* Called with call8: touch register NUM_REGS-12 (4/20/52) */
  27. .L8:
  28. #if XCHAL_NUM_AREGS > 16
  29. call12 1f
  30. retw
  31. .align 4
  32. 1: _entry a1, 48 /* touch NUM_REGS-24 (x/8/40) */
  33. #if XCHAL_NUM_AREGS == 32
  34. mov a8, a0
  35. retw
  36. #else
  37. mov a12, a0
  38. _entry a1, 48 /* touch NUM_REGS-36 (x/x/28) */
  39. mov a12, a0
  40. _entry a1, 48 /* touch NUM_REGS-48 (x/x/16) */
  41. mov a12, a0
  42. _entry a1, 16 /* touch NUM_REGS-60 (x/x/4) */
  43. #endif
  44. #endif
  45. mov a4, a0
  46. retw
  47. /* Called with call4: touch register NUM_REGS-8 (8/24/56) */
  48. .L4:
  49. #if XCHAL_NUM_AREGS == 16
  50. mov a8, a0
  51. #else
  52. call12 1f
  53. retw
  54. .align 4
  55. 1: _entry a1, 48 /* touch NUM_REGS-20 (x/12/44) */
  56. mov a12, a0
  57. #if XCHAL_NUM_AREGS > 32
  58. _entry a1, 48 /* touch NUM_REGS-32 (x/x/32) */
  59. mov a12, a0
  60. _entry a1, 48 /* touch NUM_REGS-44 (x/x/20) */
  61. mov a12, a0
  62. _entry a1, 48 /* touch NUM_REGS-56 (x/x/8) */
  63. mov a8, a0
  64. #endif
  65. #endif
  66. retw
  67. /* Called with call12: touch register NUM_REGS-16 (x/16/48) */
  68. .L12:
  69. #if XCHAL_NUM_AREGS > 16
  70. call12 1f
  71. retw
  72. .align 4
  73. 1: _entry a1, 48 /* touch NUM_REGS-28 (x/4/36) */
  74. #if XCHAL_NUM_AREGS == 32
  75. mov a4, a0
  76. #else
  77. mov a12, a0
  78. _entry a1, 48 /* touch NUM_REGS-40 (x/x/24) */
  79. mov a12, a0
  80. _entry a1, 48 /* touch NUM_REGS-52 (x/x/12) */
  81. mov a12, a0
  82. #endif
  83. #endif
  84. retw
  85. #endif