windowspill.S 2.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495
  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, write to the Free
  14. Software Foundation, Inc., 51 Franklin Street - Fifth Floor,
  15. Boston, MA 02110-1301, USA. */
  16. #include <bits/xtensa-config.h>
  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. _entry a1, 48 // touch NUM_REGS-36 (x/x/28)
  38. mov a12, a0
  39. _entry a1, 48 // touch NUM_REGS-48 (x/x/16)
  40. mov a12, a0
  41. _entry a1, 16 // touch NUM_REGS-60 (x/x/4)
  42. #endif
  43. #endif
  44. mov a4, a0
  45. retw
  46. /* Called with call4: touch register NUM_REGS-8 (8/24/56) */
  47. .L4:
  48. #if XCHAL_NUM_AREGS == 16
  49. mov a8, a0
  50. #else
  51. call12 1f
  52. retw
  53. .align 4
  54. 1: _entry a1, 48 // touch NUM_REGS-20 (x/12/44)
  55. mov a12, a0
  56. #if XCHAL_NUM_AREGS > 32
  57. _entry a1, 48 // touch NUM_REGS-32 (x/x/32)
  58. mov a12, a0
  59. _entry a1, 48 // touch NUM_REGS-44 (x/x/20)
  60. mov a12, a0
  61. _entry a1, 48 // touch NUM_REGS-56 (x/x/8)
  62. mov a8, a0
  63. #endif
  64. #endif
  65. retw
  66. /* Called with call12: touch register NUM_REGS-16 (x/16/48) */
  67. .L12:
  68. #if XCHAL_NUM_AREGS > 16
  69. call12 1f
  70. retw
  71. .align 4
  72. 1: _entry a1, 48 // touch NUM_REGS-28 (x/4/36)
  73. #if XCHAL_NUM_AREGS == 32
  74. mov a4, a0
  75. #else
  76. mov a12, a0
  77. _entry a1, 48 // touch NUM_REGS-40 (x/x/24)
  78. mov a12, a0
  79. _entry a1, 48 // touch NUM_REGS-52 (x/x/12)
  80. mov a12, a0
  81. #endif
  82. #endif
  83. retw