URL
https://opencores.org/ocsvn/or1k/or1k/trunk
Details |
Compare with Previous |
View Log
Line No. |
Rev |
Author |
Line |
1 |
1325 |
phoenix |
/*
|
2 |
|
|
* This function is _not_ called directly. It is jumped to (so no return
|
3 |
|
|
* address is on the stack) when attempting to use a symbol that has not yet
|
4 |
|
|
* been resolved. The first time a jump symbol (such as a function call inside
|
5 |
|
|
* a shared library) is used (before it gets resolved) it will jump here to
|
6 |
|
|
* _dl_linux_resolve. When we get called the stack looks like this:
|
7 |
|
|
* reloc_entry
|
8 |
|
|
* tpnt
|
9 |
|
|
*
|
10 |
|
|
* This function saves all the registers, puts a copy of reloc_entry and tpnt
|
11 |
|
|
* on the stack (as function arguments) then make the function call
|
12 |
|
|
* _dl_linux_resolver(tpnt, reloc_entry). _dl_linux_resolver() figures out
|
13 |
|
|
* where the jump symbol is _really_ supposed to have jumped to and returns
|
14 |
|
|
* that to us. Once we have that, we overwrite tpnt with this fixed up
|
15 |
|
|
* address. We then clean up after ourselves, put all the registers back how we
|
16 |
|
|
* found them, then we jump to the fixed up address, which is where the jump
|
17 |
|
|
* symbol that got us here really wanted to jump to in the first place.
|
18 |
|
|
* -Erik Andersen
|
19 |
|
|
*/
|
20 |
|
|
|
21 |
|
|
#define sl r10
|
22 |
|
|
#define fp r11
|
23 |
|
|
#define ip r12
|
24 |
|
|
|
25 |
|
|
.text
|
26 |
|
|
.globl _dl_linux_resolve
|
27 |
|
|
.type _dl_linux_resolve,%function
|
28 |
|
|
.align 4;
|
29 |
|
|
|
30 |
|
|
_dl_linux_resolve:
|
31 |
|
|
stmdb sp!, {r0, r1, r2, r3, sl, fp}
|
32 |
|
|
sub r1, ip, lr
|
33 |
|
|
sub r1, r1, #4
|
34 |
|
|
add r1, r1, r1
|
35 |
|
|
ldr r0, [lr, #-4]
|
36 |
|
|
mov r3,r0
|
37 |
|
|
|
38 |
|
|
bl _dl_linux_resolver
|
39 |
|
|
|
40 |
|
|
mov ip, r0
|
41 |
|
|
ldmia sp!, {r0, r1, r2, r3, sl, fp, lr}
|
42 |
|
|
mov pc,ip
|
43 |
|
|
.size _dl_linux_resolve, .-_dl_linux_resolve
|
© copyright 1999-2024
OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.