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