resolve.S 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  1. ;;
  2. ;; Copyright (C) 2010 Texas Instruments Incorporated
  3. ;; Mark Salter <msalter@redhat.com>
  4. ;;
  5. ;; Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
  6. ;;
  7. ;; The function below is tail-called by resolver stubs when a
  8. ;; lazily-bound function is called. It must preserve all
  9. ;; registers that could be used to pass arguments to the actual
  10. ;; function.
  11. ;; _dl_linux_resolver() figures out where the jump symbol is
  12. ;; _really_ supposed to have jumped to and returns that to us.
  13. ;; Once we have that, we prepare to tail-call the actual
  14. ;; function, clean up after ourselves, restoring the original
  15. ;; arguments, then jump to the fixed up address. */
  16. ; resolver stub - called from PLT to resolve target address and update GOT
  17. ;
  18. ; B0 : reloc offset (bytes from DT_RELPLT)
  19. ; B1 : module pointer, loaded from GOT[1]
  20. ; DP : caller's DP
  21. ; A4,B4, etc: callee's arguments
  22. ; B3 : return address
  23. .text
  24. .align 5
  25. .global _dl_linux_resolve
  26. _dl_linux_resolve:
  27. stw .d2t2 B14, *B15--[2]
  28. stdw .d2t1 A15:A14, *B15--
  29. stdw .d2t2 B13:B12, *B15--
  30. stdw .d2t1 A13:A12, *B15--
  31. stdw .d2t2 B11:B10, *B15--
  32. stdw .d2t1 A11:A10, *B15--
  33. stdw .d2t2 B9:B8, *B15--
  34. stdw .d2t1 A9:A8, *B15--
  35. stdw .d2t2 B7:B6, *B15--
  36. stdw .d2t1 A7:A6, *B15--
  37. stdw .d2t2 B5:B4, *B15--
  38. stdw .d2t1 A5:A4, *B15--
  39. stdw .d2t2 B3:B2, *B15--
  40. stdw .d2t1 A3:A2, *B15--
  41. ; call lookup routine
  42. MV .S1X B1, A4 ; arg 1: module id
  43. || MV .S2 B0,B4 ; arg 2: reloc offset
  44. CALLP .S2 _dl_linux_resolver, B3 ; returns &f in A4
  45. MV .S2X A4,B0 ; &f
  46. lddw .d2t1 *++B15, A3:A2
  47. lddw .d2t2 *++B15, B3:B2
  48. lddw .d2t1 *++B15, A5:A4
  49. lddw .d2t2 *++B15, B5:B4
  50. lddw .d2t1 *++B15, A7:A6
  51. lddw .d2t2 *++B15, B7:B6
  52. lddw .d2t1 *++B15, A9:A8
  53. lddw .d2t2 *++B15, B9:B8
  54. lddw .d2t1 *++B15, A11:A10
  55. lddw .d2t2 *++B15, B11:B10
  56. lddw .d2t1 *++B15, A13:A12
  57. lddw .d2t2 *++B15, B13:B12
  58. lddw .d2t1 *++B15, A15:A14
  59. ldw .d2t2 *++B15[2], B14
  60. B .S2 B0 ; tail-call f
  61. NOP 5