resolve.S 2.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495
  1. /* vi: set sw=8 ts=8: */
  2. /*
  3. * ldso/ldso/sh64/resolve.S
  4. *
  5. * SuperH (sh64) dynamic resolver support
  6. *
  7. * Copyright (C) 2003 Paul Mundt <lethal@linux-sh.org>
  8. *
  9. * All rights reserved.
  10. *
  11. * Redistribution and use in source and binary forms, with or without
  12. * modification, are permitted provided that the following conditions
  13. * are met:
  14. * 1. Redistributions of source code must retain the above copyright
  15. * notice, this list of conditions and the following disclaimer.
  16. * 2. The name of the above contributors may not be
  17. * used to endorse or promote products derived from this software
  18. * without specific prior written permission.
  19. *
  20. * THIS SOFTWARE IS PROVIDED BY THE CONTRIBUTORS ``AS IS'' AND
  21. * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
  22. * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
  23. * ARE DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE
  24. * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
  25. * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
  26. * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
  27. * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
  28. * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
  29. * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  30. * SUCH DAMAGE.
  31. */
  32. .section .text..SHmedia32,"ax"
  33. .globl _dl_linux_resolver
  34. .globl _dl_linux_resolve
  35. .type _dl_linux_resolve, @function
  36. .balign 16
  37. _dl_linux_resolve:
  38. addi r15, -72, r15 ! make room on the stack
  39. pt _dl_linux_resolver, tr0
  40. st.q r15, 0, r2 ! save regs
  41. st.q r15, 8, r3
  42. st.q r15, 16, r4
  43. st.q r15, 24, r5
  44. st.q r15, 32, r6
  45. st.q r15, 40, r7
  46. st.q r15, 48, r8
  47. st.q r15, 56, r9
  48. st.q r15, 64, r18
  49. #ifdef HAVE_FPU
  50. addi r15, -48, r15 ! make room for FP regs
  51. fst.d r15, 0, dr0 ! save FP regs
  52. fst.d r15, 8, dr2
  53. fst.d r15, 16, dr4
  54. fst.d r15, 24, dr6
  55. fst.d r15, 32, dr8
  56. fst.d r15, 40, dr10
  57. #endif
  58. /*
  59. * Args for _dl_linux_resolver(), set in r17/r21 by PLT code
  60. */
  61. add r17, r63, r2 ! link map address
  62. add r21, r63, r3 ! GOT offset
  63. blink tr0, r18 ! call _dl_linux_resolver()
  64. ptabs/l r2, tr0 ! save result = addr of function called
  65. #ifdef HAVE_FPU
  66. fld.d r15, 0, dr0 ! restore FP regs
  67. fld.d r15, 8, dr2
  68. fld.d r15, 16, dr4
  69. fld.d r15, 24, dr6
  70. fld.d r15, 32, dr8
  71. fld.d r15, 40, dr10
  72. addi r15, 48, r15
  73. #endif
  74. ld.q r15, 0, r2 ! restore regs
  75. ld.q r15, 8, r3
  76. ld.q r15, 16, r4
  77. ld.q r15, 24, r5
  78. ld.q r15, 32, r6
  79. ld.q r15, 40, r7
  80. ld.q r15, 48, r8
  81. ld.q r15, 56, r9
  82. ld.q r15, 64, r18
  83. addi r15, 72, r15
  84. blink tr0, r63 ! jump to function address
  85. .size _dl_linux_resolve, . - _dl_linux_resolve